deploy.rb
# config valid only for current version of Capistrano
lock "3.8.2"
set :application, "wisdom"
set :repo_url, "ssh://app@extreammmm.jp/home/app/myGit/wisdom.git"
set :branch, 'master'
set :deploy_to, "/var/www/html/wisdom"
set :linked_files, %w{app/config/parameters.yml}
set :linked_dirs, %w{app/logs app/spool app/cache vendor web/vendor node_modules web/assets}
#somehow app/cache doesn't work...
set :format, :pretty
set :log_level, :debug
set :keep_releases, 3
after 'deploy:update_code' do
capifony_pretty_print "--> Ensuring cache directory permissions"
run "setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX #{latest_release}/#{cache_path}"
run "setfacl -dR -m u:www-data:rwX -m u:`whoami`:rwX #{latest_release}/#{cache_path}"
capifony_puts_ok
end
after 'deploy:starting', 'composer:install_executable'
#after 'deploy:updated', 'npm:install' # remove it if you don't use npm
#after 'deploy:updated', 'bower:install' # remove it if you don't use bower
after 'deploy:updated', 'symfony:assets:install'
after 'deploy:updated', 'symfony:assetic:dump'
我希望在部署后更改app/cache
777的权限。
首先我将app/cache
放在linked_dirs
中,但不知怎的,它不起作用。
所以现在我正在尝试通过acl更改权限并将其设为deploy.rb
但是此代码显示错误。
ArgumentError: wrong number of arguments (given 1, expected 2+)
我猜这个错误与after 'deploy:update_code' do
有关,但我不确定如何修复它。
请有人帮助我吗?
cap production deploy --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
cap aborted!
ArgumentError: wrong number of arguments (given 1, expected 2+)
/usr/local/lib/ruby/gems/2.4.0/gems/capistrano-3.8.2/lib/capistrano/dsl/task_enhancements.rb:10:in `after'
config/deploy.rb:19:in `<top (required)>'
/usr/local/lib/ruby/gems/2.4.0/gems/capistrano-3.8.2/lib/capistrano/setup.rb:27:in `load'
/usr/local/lib/ruby/gems/2.4.0/gems/capistrano-3.8.2/lib/capistrano/setup.rb:27:in `block (3 levels) in <top (required)>'
/usr/local/lib/ruby/gems/2.4.0/gems/capistrano-3.8.2/lib/capistrano/configuration/variables.rb:32:in `untrusted!'
/usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/delegate.rb:83:in `method_missing'
/usr/local/lib/ruby/gems/2.4.0/gems/capistrano-3.8.2/lib/capistrano/setup.rb:26:in `block (2 levels) in <top (required)>'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
/usr/local/lib/ruby/gems/2.4.0/gems/capistrano-3.8.2/lib/capistrano/application.rb:14:in `run'
/usr/local/lib/ruby/gems/2.4.0/gems/capistrano-3.8.2/bin/cap:3:in `<top (required)>'
/usr/local/bin/cap:22:in `load'
/usr/local/bin/cap:22:in `<main>'
Tasks: TOP => production
感谢@kiddorails
最后我将这些添加到deploy.rb中,问题解决了。
after 'deploy:updated', :updated_cache do
on roles(:app) do
execute :chmod, "-R 777 #{fetch(:deploy_to)}/current/#{fetch(:cache_path)}"
end
end