Last active
February 8, 2024 08:57
-
-
Save PierreLebedel/c39e6c962dcc31df3f4cfad67198de4e to your computer and use it in GitHub Desktop.
Laravel Envoy config for staging & production
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@servers([ | |
'staging' => '[email protected] -p 22', | |
'production' => '[email protected] -p 22', | |
]) | |
@setup | |
if (empty($server)) { | |
exit('ERROR: envoy run option --server is undefined'.PHP_EOL); | |
} | |
if($server=='production'){ | |
$laravelPath = "/var/www/production-path/"; | |
}elseif($server=='staging'){ | |
$laravelPath = "/var/www/staging-path/"; | |
}else{ | |
exit('ERROR: envoy run option --server is unknown'.PHP_EOL); | |
} | |
@endsetup | |
@task('deploy', ['on' => $server]) | |
cd {{ $laravelPath }}; | |
git pull origin main; | |
php artisan migrate --force; | |
php artisan clear-compiled; | |
php artisan config:cache; | |
php artisan cache:clear; | |
php artisan event:cache; | |
php artisan route:clear; | |
@endtask | |
@task('update', ['on' => $server]) | |
cd {{ $laravelPath }}; | |
composer update --no-dev; | |
npm install; | |
npm update; | |
npm run build; | |
@endtask |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment