Skip to content

Instantly share code, notes, and snippets.

@PierreLebedel
Last active February 8, 2024 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PierreLebedel/c39e6c962dcc31df3f4cfad67198de4e to your computer and use it in GitHub Desktop.
Save PierreLebedel/c39e6c962dcc31df3f4cfad67198de4e to your computer and use it in GitHub Desktop.
Laravel Envoy config for staging & production
@servers([
'staging' => 'user@X.X.X.Y -p 22',
'production' => 'user@X.X.X.Z -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