New updates for deployer
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace Deployer;
|
||||
|
||||
require 'recipe/laravel.php';
|
||||
|
||||
// System Config
|
||||
set('writable_use_sudo', true);
|
||||
set('clear_use_sudo', true);
|
||||
set('cleanup_use_sudo', true);
|
||||
set('keep_releases', 1);
|
||||
set('repository', 'git@git.absdev.net:admin/RSync-Studio.git');
|
||||
set('node_version', '22.12.0');
|
||||
set('allow_anonymous_stats', false);
|
||||
|
||||
add('shared_files', ['.env']);
|
||||
add('shared_dirs', ['storage']);
|
||||
add('writable_dirs', ['storage', 'bootstrap/cache']);
|
||||
|
||||
// Host Definitions
|
||||
host('main')
|
||||
->set('hostname', '')
|
||||
->set('remote_user', 'mag')
|
||||
->set('branch', 'main')
|
||||
->set('deploy_path', '/var/www/rsyncstudio');
|
||||
host('stage')
|
||||
->set('hostname', 'pegasus.absdev.net')
|
||||
->set('remote_user', 'mag')
|
||||
->set('branch', 'stage')
|
||||
->set('deploy_path', '/var/www/rsyncstudio');
|
||||
|
||||
task('build', function (): void {
|
||||
run('export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && nvm use {{node_version}} && cd {{release_path}} && npm ci --no-audit --no-fund');
|
||||
run('export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && nvm use {{node_version}} && cd {{release_path}} && npm run build');
|
||||
});
|
||||
task('queue:restart', function (): void {
|
||||
run('cd {{release_path}} && 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');
|
||||
});
|
||||
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');
|
||||
});
|
||||
task('services:restart', function (): void {
|
||||
run('sudo -n nginx -t');
|
||||
run('sudo -n systemctl reload nginx');
|
||||
run('sudo -n systemctl restart php8.3-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:failed', 'deploy:unlock');
|
||||
after('deploy:symlink', 'services:restart');
|
||||
Reference in New Issue
Block a user