我正在一個完全離線的環境中開發一個網站。還有,我用gitlab轉輪CI和主機是CentOS的7Laravel在離線環境下與Gitlab-runner持續集成(CentOS 7)
問題是gitlab亞軍使用gitlab-runner
用戶在CentOS部署laravel應用和Apache使用apache
用戶運行laravel。 我得到了Permission denied
錯誤,直到我改變了文件的所有權。之後,我得到Apache日誌此錯誤:
Uncaught UnexpectedValueException: The stream or file "storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
似乎像monolog
一些供應商庫想寫錯誤或調試日誌到storage/logs/laravel.log
但它得到許可被拒絕。 :(
.gitlab-ci.yml
stages:
- build
- test
- deploy
buildBash:
stage: build
script:
- bash build.sh
testBash:
stage: test
script:
- bash test.sh
deployBash:
stage: deploy
script:
- sudo bash deploy.sh
build.sh
#!/bin/bash
set -xe
# creating env file from production file
cp .env.production .env
# initializing laravel
php artisan key:generate
php artisan config:cache
# database migration
php artisan migrate --force
deploy.sh
#!/bin/bash
PWD=$(pwd)'/public'
STG=$(pwd)'/storage'
ln -s $PWD /var/www/html/public
chown apache.apache -R /var/www/html/public
chmod -R 755 /var/www/html/public
chmod -R 775 $STG
我使用gitlab運行正確嗎?我如何解決權限被拒絕的錯誤?