1

我正在将 ckeditor 用于微博应用程序,并且每次运行cap deployckditor 目录都会被删除。我该如何解决这个问题,以便我可以在不删除我的 vps 服务器上的 ckeditor 资产目录的情况下运行 cap deploy。

我的 deploy.rb 在下面。

set :whenever_command, "bundle exec whenever"
require "bundler/capistrano"
require "whenever/capistrano"

server "xxx.xx.xx.xxx", :web, :app, :db, primary: true

set :application, "cf"
set :user, "deployer"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false

set :scm, "git"
set :repository, "git@github.com:ramza1/#{application}.git"
set :branch, "master"

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

after "deploy", "deploy:cleanup" # keep only the last 5 releases

namespace :deploy do
  %w[start stop restart].each do |command|
    desc "#{command} unicorn server"
    task command, roles: :app, except: {no_release: true} do
      run "/etc/init.d/unicorn_#{application} #{command}"
    end
  end

  task :setup_config, roles: :app do
    sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
    sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
    run "mkdir -p #{shared_path}/config"
    put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
    puts "Now edit the config files in #{shared_path}."
  end
  after "deploy:setup", "deploy:setup_config"

  task :symlink_config, roles: :app do
    run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
  end
  after "deploy:finalize_update", "deploy:symlink_config"

  desc "Make sure local git is in sync with remote."
  task :check_revision, roles: :web do
    unless `git rev-parse HEAD` == `git rev-parse origin/master`
      puts "WARNING: HEAD is not the same as origin/master"
      puts "Run `git push` to sync changes."
      exit
    end
  end
  before "deploy", "deploy:check_revision"
end
4

2 回答 2

1

如果您使用的是 Capistrano 3,请添加public/ckeditor_assets到共享目录并添加符号链接:

set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/ckeditor_assets}
于 2015-08-13T07:56:05.233 回答
0
  1. 您必须将带有资产的目录复制到共享路径。
  2. 您必须使用 capistrano 从发布路径创建一个符号链接,该链接指向带有 ckeditor 资产的目录

这是我做的帽子:

after "deploy:update_code" do
  run "ln -s #{shared_path}/uploads #{release_path}/public/uploads"
end
于 2012-11-28T07:38:07.330 回答