出于某种原因,每当我将所有图像从所有用户中删除时,Capistrano都会删除我数据库中的所有图像。通常,我所做的是必须使用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'
答案 0 :(得分:1)
您的public/images
(或Paperclip存储图像的任何地方)很可能不是共享符号链接,因此当Capistrano链接新版本时,不会复制图像。
有关于此right in the Paperclip README文件的文档,介绍了如何不陷入此陷阱。