Fix deployment steps order to prevent permissions issue during composer install
All checks were successful
Setup EC2 Tools / setup-server (push) Successful in 50s
All checks were successful
Setup EC2 Tools / setup-server (push) Successful in 50s
This commit is contained in:
parent
8c1a409563
commit
d4c5ae2cf2
1 changed files with 8 additions and 5 deletions
|
|
@ -65,21 +65,24 @@ jobs:
|
|||
cd /var/www/trypost && git pull origin main
|
||||
fi
|
||||
|
||||
# Install PHP dependencies and set permissions
|
||||
# Ensure all storage subdirectories exist and have proper permissions BEFORE composer install
|
||||
cd /var/www/trypost
|
||||
composer install --no-interaction --prefer-dist --optimize-autoloader
|
||||
|
||||
# Ensure all storage subdirectories exist
|
||||
mkdir -p storage/logs storage/framework/views storage/framework/sessions storage/framework/cache bootstrap/cache
|
||||
sudo chown -R www-data:www-data storage bootstrap/cache
|
||||
sudo chown -R $USER:www-data storage bootstrap/cache
|
||||
sudo chmod -R 775 storage bootstrap/cache
|
||||
|
||||
# Install PHP dependencies
|
||||
composer install --no-interaction --prefer-dist --optimize-autoloader
|
||||
|
||||
# Setup Laravel environment file and key
|
||||
if [ ! -f .env ]; then
|
||||
cp .env.example .env
|
||||
php artisan key:generate
|
||||
fi
|
||||
|
||||
# Ensure web server owns the files after composer finishes writing caches
|
||||
sudo chown -R www-data:www-data storage bootstrap/cache
|
||||
|
||||
# Temporarily enable debug mode to see exactly why it is failing!
|
||||
sed -i 's/APP_DEBUG=false/APP_DEBUG=true/g' .env
|
||||
sed -i 's/APP_ENV=production/APP_ENV=local/g' .env
|
||||
|
|
|
|||
Loading…
Reference in a new issue