何らかの理由で、すべての画像がすべてのユーザーから削除されるたびに、Capistrano はデータベース内のすべての画像を削除します。通常、私が行ったことは、カピストラーノによって削除されたのと同じ画像でデータベースを補充する必要があることです。deploy.rb ファイルを添付しました。誰かが私に洞察を与えることができますか。
require "bundler/capistrano"
set :rvm_ruby_string, '1.9.3p429'
set :rvm_type, :user
set :user, ""
set :password, ""
set :domain, ""
set :applicationdir, ""
set :scm, :git
set :repository, ""
set :git_enable_submodules, 1 # if you have vendored rails
set :branch, "release"
set :rails_env, 'production'
#set :git_shallow_clone, 1
set :scm_verbose, true
# roles (servers)
role :web, domain
role :app, domain
role :db, domain, :primary => true
set :port, 22
# deploy config
set :deploy_to, applicationdir
set :deploy_via, :remote_cache
# additional settings
default_run_options[:pty] = true # Forgo errors when deploying from windows
ssh_options[:forward_agent] = true
#ssh_options[:keys] = %w(/home/user/.ssh/id_rsa) # If you are using ssh_keysset :chmod755, "app config db lib public vendor script script/* public/disp*"set :use_sudo, false
# runtime dependencies
depend :remote, :gem, "bundler", ">=1.0.0.rc.2"
# tasks
namespace :deploy do
task :start, :roles => :app do
run "touch #{current_path}/tmp/restart.txt"
end
task :stop, :roles => :app do
# Do nothing.
end
desc "Restart Application"
task :restart, :roles => :app do
run "touch #{current_path}/tmp/restart.txt"
end
desc "Symlink shared resources on each release"
task :symlink_shared, :roles => :app do
#run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
end
after 'deploy:update_code', 'deploy:symlink_shared'
namespace :bundler do
desc "Symlink bundled gems on each release"
task :symlink_bundled_gems, :roles => :app do
run "mkdir -p #{shared_path}/bundled_gems"
run "ln -nfs #{shared_path}/bundled_gems #{release_path}/vendor/bundle"
end
desc "Install for production"
task :install, :roles => :app do
run "cd #{release_path} && bundle install --without development test"
end
end
after 'deploy:update_code', 'bundler:symlink_bundled_gems'
after 'deploy:update_code', 'bundler:install'