在我的部署脚本deploy.rb
lock "3.11.0"
set :application, "myapp"
set :repo_url, "ssh://app@git.whitebear.com/home/app/myGit/myapp.git"
set :branch, 'master'
set :deploy_to, "/var/www/html/myapp"
#set :linked_files, %w{app/config/parameters.yml}
set :linked_dirs, %w{log vendor var node_modules public/build public/dlstore config/spool}
#somehow app/cache doesn't work...
set :format, :pretty
set :log_level, :debug
set :keep_releases, 3
after 'deploy:starting', 'composer:install_executable'
set :yarn_flags, "--prefer-offline --production --no-progress"
set :yarn_roles, :app
在production.rb
set :stage, :prod
set :symfony_env, "prod"
set :webserver_user, "app"
#set :controllers_to_clear, ["app_*.php"]
set :composer_install_flags, '--prefer-dist --no-interaction --optimize-autoloader'
server 'myapp.com', user: 'app', port: 22, roles: %w{app db web} # edit IP / Port and SSH user of your production server
SSHKit.config.command_map[:composer] = "php #{shared_path.join("composer.phar")}"
我设置了keep_releases 3,但是在部署时遇到权限问题。
我不知道为什么Aapache会更改权限,
部署时是否可以强制执行rm
?
DEBUG [cd2bf6b1] cannot remove `/var/www/html/myApp/releases/20190212120003/var/cache/prod/pools/VQruNbwKF0/X/3/tCcgRMw5TEmYO-kHpJ0t'
DEBUG [cd2bf6b1] : Permission denied
答案 0 :(得分:1)
这是由服务器配置不佳或错误用户部署导致的常见问题。您尝试使用用户x执行脚本,并且该文件的权限属于www-data,而用户x无法删除该脚本,则会出现此错误。您的用户必须有权删除该文件。执行脚本的用户与执行Web请求的用户不同。