Clear-compiled before running composer install on Envoyer

1.1k views Asked by At

It seems that when deploying from Laravel Envoyer we cannot clear-compiled before running composer install/update so Envoyer is loading from packages from cache.

This can obviously be manually fixed by ssh into the release folder and running:

php artisan clear-compiled
composer update

This is a problem most of the times. I encountered this while upgrading: pda/pheanstalk

as envoyer keeps loading the previous version from cache and thus it doesn't work.

At the moment my temporary fix is to run:

cd {{release}}
php artisan clear-compiled
composer update
php artisan optimize

Deployment hook but I can only run this after the initial composer-install hook of envoyer as before that there's no compiled file in the release folder.

This is okay for now but the issue is that my deployment task is running composer install/update twice which is unnecessary overhead.

Is there a better way on how to do this?

1

There are 1 answers

0
Elf Sundae On

My deploy hook:

cd "$DEPLOY_PATH"
php artisan down

git reset --hard HEAD
git clean -fd
git pull origin "$BRANCH"

composer install --no-dev --profile
composer dump-autoload --optimize --profile
php artisan optimize --force
php artisan config:cache
php artisan route:cache
php artisan migrate --force
php artisan up