Skip to content

Instantly share code, notes, and snippets.

@PierreLebedel
Last active February 8, 2024 08:57
Show Gist options
  • 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' => '[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