1

私はマイクロブログアプリにckeditorを使用していますが、実行cap deployするたびにckditorディレクトリが削除されます。vpsサーバーのckeditorアセットディレクトリを削除せずにcapdeployを実行できるように、これを修正するにはどうすればよいですか。

私の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. ckeditorアセットでディレクトリを指すcapistranoを使用して、リリースパスからシンボリックリンクを作成する必要があります

これが私がする帽子です:

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