我有一个带有两个节点的网络服务器集群。他们使用相同的文件服务器来托管文件。由于文件是共享的,我只需要到其中一台服务器上进行部署,但我想清除它们上的 APC 缓存。我有没有办法告诉 Capifony 不要部署到第二台服务器,只需运行“symfony:clear_apc”?
我的 deploy.rb 目前的样子:
set :application, "app.domain.net"
set :domain, "#{application}"
set :deploy_to, "/hosting_files/#{application}"
set :app_path, "app"
set :web_path, "web"
set :repository, "git@bitbucket.org:company/#{application}.git"
set :scm, :git
set :deploy_via, :remote_cache
set :model_manager, "doctrine"
role :web, "X.domain.com"
role :app, "X.domain.com"
role :db, "X.domain.com", :primary => true
set :keep_releases, 10
set :shared_files, ["app/config/parameters.yml"]
set :shared_children, [app_path + "/logs", web_path + "/uploads", "vendor"]
set :permission_method, :acl
set :use_composer, true
set :interactive_mode, false
set :branch, `git tag`.split("\n").last
set :user, "applicationUser"
set :use_sudo, false
ssh_options[:forward_agent] = true
ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "id_rsa")]
"symfony:cache:warmup"
logger.level = Logger::MAX_LEVEL
namespace :symfony do
desc "Clear apc cache"
task :clear_apc do
capifony_pretty_print "--> Clear apc cache"
run "php #{deploy_to}/current/app/console apc:clear"
capifony_puts_ok
end
end
after "deploy", "symfony:clear_apc"