1
我正在使用ckeditor作爲微博客應用程序,並且每次運行cap deploy
ckditor目錄都會被刪除。我如何解決這個問題,以便我可以運行cap部署而不刪除我的vps服務器上的ckeditor資產目錄。ckeditor資產目錄在運行cap部署時被刪除
我的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, "[email protected]: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
如何將資產複製到共享部分首先。因爲如果我這樣做,我會有一個空目錄 – Uchenna
我應該創建一個任務在部署之前運行:update_cod並從current_path複製到shared_path運行部署後,您必須從共享路徑複製到發佈路徑 – Uchenna
不應將資產置於版本控制之下,然後在部署後沒有資產處於修訂目錄中的目錄。您必須手動移動您的資產。 – pkubicki