new deployer command
This commit is contained in:
+15
-12
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Deployer;
|
||||
|
||||
require_once 'recipe/laravel.php';
|
||||
require 'recipe/laravel.php';
|
||||
|
||||
set('writable_use_sudo', true);
|
||||
set('clear_use_sudo', true);
|
||||
@@ -12,6 +12,9 @@ set('repository', 'git@git.absdev.net:mag/WMS.git');
|
||||
set('node_version', '22.12.0');
|
||||
set('allow_anonymous_stats', false);
|
||||
|
||||
const RELEASE_CD = 'cd {{release_path}} && ';
|
||||
const DEPLOY_SYMLINK = 'deploy:symlink';
|
||||
|
||||
add('shared_files', ['.env']);
|
||||
add('shared_dirs', ['storage']);
|
||||
add('writable_dirs', ['storage', 'bootstrap/cache']);
|
||||
@@ -70,30 +73,30 @@ task('build', function (): void {
|
||||
});
|
||||
|
||||
task('queue:restart', function (): void {
|
||||
run('cd {{release_path}} && php artisan queue:restart');
|
||||
run(RELEASE_CD . 'php artisan queue:restart');
|
||||
});
|
||||
|
||||
task('deploy:write_revision_file', function (): void {
|
||||
run('cd {{release_path}} && echo "{{branch}}" > BRANCH');
|
||||
run('cd {{release_path}} && date -u +"%Y-%m-%dT%H:%M:%SZ" > DEPLOYED_AT');
|
||||
run(RELEASE_CD . 'echo "{{branch}}" > BRANCH');
|
||||
run(RELEASE_CD . 'date -u +"%Y-%m-%dT%H:%M:%SZ" > DEPLOYED_AT');
|
||||
});
|
||||
|
||||
task('artisan:clear', function (): void {
|
||||
run('cd {{release_path}} && php artisan view:clear');
|
||||
run('cd {{release_path}} && php artisan optimize:clear');
|
||||
run('cd {{release_path}} && php artisan config:clear');
|
||||
run('cd {{release_path}} && php artisan route:clear');
|
||||
run(RELEASE_CD . 'php artisan view:clear');
|
||||
run(RELEASE_CD . 'php artisan optimize:clear');
|
||||
run(RELEASE_CD . 'php artisan config:clear');
|
||||
run(RELEASE_CD . 'php artisan route:clear');
|
||||
});
|
||||
|
||||
task('services:restart', function (): void {
|
||||
run('sudo -n nginx -t');
|
||||
run('sudo -n systemctl reload nginx');
|
||||
run('sudo -n systemctl restart php8.3-fpm');
|
||||
run('sudo -n systemctl restart php8.4-fpm');
|
||||
});
|
||||
|
||||
after('deploy:update_code', 'deploy:write_revision_file');
|
||||
after('deploy:vendors', 'build');
|
||||
after('deploy:symlink', 'artisan:clear');
|
||||
after('deploy:symlink', 'queue:restart');
|
||||
after(DEPLOY_SYMLINK, 'artisan:clear');
|
||||
after(DEPLOY_SYMLINK, 'queue:restart');
|
||||
after('deploy:failed', 'deploy:unlock');
|
||||
after('deploy:symlink', 'services:restart');
|
||||
after(DEPLOY_SYMLINK, 'services:restart');
|
||||
|
||||
Reference in New Issue
Block a user