我有一个包含两个节点的网络服务器群集。他们使用相同的文件服务器来托管文件。由于文件是共享的,我只需要到其中一个服务器进行部署,但我想在两个服务器上清除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"
答案 0 :(得分:2)
您应该使用多级扩展来配置两个节点的访问参数:http://capifony.org/cookbook/using-the-multistage-extension.html
创建部署配置node1和node2。您将能够将文件部署到任何节点。更好的是,使用
将其中一个节点设置为默认阶段set :default_stage "node1"
之后,您可以通过在cap命令之后添加stage(节点)名称来分别在每个服务器上执行symfony命令:
cap node2 symfony:clear_apc