chore: cleanup and optimize deployer config
This commit is contained in:
+27
-20
@@ -9,7 +9,6 @@ require 'recipe/symfony.php';
|
|||||||
add('shared_dirs', [
|
add('shared_dirs', [
|
||||||
'config/secret',
|
'config/secret',
|
||||||
'var/bpn',
|
'var/bpn',
|
||||||
'var/log',
|
|
||||||
'var/sessions',
|
'var/sessions',
|
||||||
'var/jsonexport',
|
'var/jsonexport',
|
||||||
'var/xmlexport',
|
'var/xmlexport',
|
||||||
@@ -35,6 +34,8 @@ $rsyncOptions = [
|
|||||||
'.jj',
|
'.jj',
|
||||||
'node_modules',
|
'node_modules',
|
||||||
'.editorconfig',
|
'.editorconfig',
|
||||||
|
'.env.local',
|
||||||
|
'.env.local.php',
|
||||||
'.env.dev.local',
|
'.env.dev.local',
|
||||||
'.env.dev.local.php',
|
'.env.dev.local.php',
|
||||||
'.env.test',
|
'.env.test',
|
||||||
@@ -76,17 +77,21 @@ $rsyncOptions = [
|
|||||||
'timeout' => 300,
|
'timeout' => 300,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Shared by all hosts. The deploy path only differs by the host alias.
|
||||||
|
set('deploy_path', '/usr/home/myepsf/public_html/{{alias}}');
|
||||||
|
set('bin/php', '/usr/bin/php');
|
||||||
|
set('http_user', 'myepsf');
|
||||||
|
// Must stay here: contrib/rsync.php sets the same key, but its __DIR__ is the vendor dir.
|
||||||
|
set('rsync_src', __DIR__);
|
||||||
|
set('rsync', $rsyncOptions);
|
||||||
|
set('cachetool_args', '--web=SymfonyHttpClient --web-path={{release_or_current_path}}/public/ --web-url={{web_url}}');
|
||||||
|
|
||||||
host('prod')
|
host('prod')
|
||||||
->setHostname('dedi10193.your-server.de')
|
->setHostname('dedi10193.your-server.de')
|
||||||
->setRemoteUser('myepsf')
|
->setRemoteUser('myepsf')
|
||||||
->setForwardAgent(true)
|
->setForwardAgent(true)
|
||||||
->setSshMultiplexing(true)
|
->setSshMultiplexing(true)
|
||||||
->setDeployPath('/usr/home/myepsf/public_html/prod')
|
->set('web_url', 'https://my.ep-reisen.de')
|
||||||
->set('bin/php', '/usr/bin/php')
|
|
||||||
->set('http_user', 'myepsf')
|
|
||||||
->set('rsync_src', __DIR__)
|
|
||||||
->set('rsync', $rsyncOptions)
|
|
||||||
->set('cachetool_args', '--web=SymfonyHttpClient --web-path={{current_path}}/public/ --web-url=https://my.ep-reisen.de')
|
|
||||||
;
|
;
|
||||||
|
|
||||||
host('staging')
|
host('staging')
|
||||||
@@ -94,12 +99,7 @@ host('staging')
|
|||||||
->setRemoteUser('myepsf')
|
->setRemoteUser('myepsf')
|
||||||
->setForwardAgent(true)
|
->setForwardAgent(true)
|
||||||
->setSshMultiplexing(true)
|
->setSshMultiplexing(true)
|
||||||
->setDeployPath('/usr/home/myepsf/public_html/staging')
|
->set('web_url', 'https://my.ep-reisen.net')
|
||||||
->set('bin/php', '/usr/bin/php')
|
|
||||||
->set('http_user', 'myepsf')
|
|
||||||
->set('rsync_src', __DIR__)
|
|
||||||
->set('rsync', $rsyncOptions)
|
|
||||||
->set('cachetool_args', '--web=SymfonyHttpClient --web-path={{current_path}}/public/ --web-url=https://my.ep-reisen.net')
|
|
||||||
->add('shared_files', [
|
->add('shared_files', [
|
||||||
'public/.htpasswd',
|
'public/.htpasswd',
|
||||||
])
|
])
|
||||||
@@ -107,27 +107,34 @@ host('staging')
|
|||||||
|
|
||||||
task('deploy', [
|
task('deploy', [
|
||||||
'deploy:info',
|
'deploy:info',
|
||||||
|
'deploy:assets',
|
||||||
'deploy:setup',
|
'deploy:setup',
|
||||||
'deploy:lock',
|
'deploy:lock',
|
||||||
'deploy:release',
|
'deploy:release',
|
||||||
'deploy:assets',
|
|
||||||
'rsync',
|
'rsync',
|
||||||
'deploy:shared',
|
'deploy:shared',
|
||||||
'deploy:writable',
|
'deploy:writable',
|
||||||
'deploy:cache:clear',
|
'deploy:cache:warmup',
|
||||||
'database:migrate',
|
'database:migrate',
|
||||||
'cachetool:clear:opcache',
|
|
||||||
'deploy:publish',
|
'deploy:publish',
|
||||||
'deploy:stop-workers',
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Purely local, so it runs before anything is created on the remote. once(), so
|
||||||
|
// deploying multiple hosts at the same time builds the bundle only once.
|
||||||
task('deploy:assets', function () {
|
task('deploy:assets', function () {
|
||||||
runLocally('ddev exec npm ci');
|
runLocally('ddev exec npm ci');
|
||||||
runLocally('ddev exec npm run build');
|
runLocally('ddev exec npm run build');
|
||||||
|
})->once();
|
||||||
|
|
||||||
|
// The recipe's deploy:cache:clear only does something when composer ran with
|
||||||
|
// --no-scripts, which never happens here: vendor/ is rsynced, composer never runs
|
||||||
|
// remotely. A fresh release has no var/cache to clear, so warm it up directly.
|
||||||
|
// Runs after deploy:writable so the default ACLs are already in place.
|
||||||
|
task('deploy:cache:warmup', function () {
|
||||||
|
run('{{bin/console}} cache:warmup {{console_options}}');
|
||||||
});
|
});
|
||||||
|
|
||||||
task('deploy:stop-workers', function () {
|
// Opcache has to be reset once the new release is actually live.
|
||||||
run('{{bin/console}} messenger:stop-workers');
|
after('deploy:symlink', 'cachetool:clear:opcache');
|
||||||
});
|
|
||||||
|
|
||||||
after('deploy:failed', 'deploy:unlock');
|
after('deploy:failed', 'deploy:unlock');
|
||||||
|
|||||||
Reference in New Issue
Block a user