使用簡單的Symfony應用程序來演示持續交付管道。但是,我無法使用Magallanes完成部署。部署完成後,我需要每次手動運行bin/console cache:clear --env=prod --no-debug
。我有以下環境配置:使用Magallanes部署基本的Symfony應用程序
#production
deployment:
user: root
from: ./
to: /var/www/foo/
excludes:
strategy: rsync
releases:
enabled: false
max: 2
symlink: current
directory: releases
hosts:
- foo
tasks:
pre-deploy:
on-deploy:
post-release:
post-deploy:
- composer/install
- general/manually:
- HTTPDUSER=`ps axo user,comm | grep -E \'[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx\' | grep -v root | head -1 | cut -d\ -f1`
- general/manually:
- setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var
- general/manually:
- setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var
- general/manually:
- chmod +x bin/console
- general/manually:
- bin/console cache:clear --env=prod --no-debug
正如您所看到的,許多手動任務可以獲得權限。當我訪問我的網頁是跟着我收到的錯誤:
PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/omnia/var/logs/prod.log" could not be opened: failed to open stream: Permission denied'
我希望我的工作可以解決這個問題權限問題,特別是最後一個,在那裏我稱之爲cache:clear
。
怎麼辦?
我曾經使用Magallanes,但遇到了同樣的問題,你是,這是地獄。很多時候,它不在馬加蘭斯的控制之下。最好的解決方案是確保安裝並運行apache,php,composer,ssh和擁有www目錄的用戶是相同的。 –
@DonOmondi感謝您與Magallanes分享您的經驗。我確實發現執行Symfony3應用程序並將其降級爲Symfony2是一件困難的事情。這使得它更容易,因爲Magallanes的支持與Symfony2更加兼容。 – Lars