Update deployer for new server with caddy and move to own file
This commit is contained in:
parent
aeb2d3ee4b
commit
9b699ea4c7
70
deploy.php
70
deploy.php
@ -2,76 +2,16 @@
|
||||
|
||||
namespace Deployer;
|
||||
|
||||
require_once 'recipe/common.php';
|
||||
require_once 'deploy/git.php';
|
||||
require_once 'deploy/symfony.php';
|
||||
|
||||
|
||||
// Project name
|
||||
set('application', 'snips');
|
||||
|
||||
// Project repository
|
||||
set('repository', 'git@git.loken.nl:ardent/Snips.git');
|
||||
|
||||
// [Optional] Allocate tty for git clone. Default value is false.
|
||||
set('git_tty', true);
|
||||
|
||||
// Shared files/dirs between deploys
|
||||
set('shared_dirs', ['var/log', 'var/sessions']);
|
||||
set('shared_files', ['.env.local']);
|
||||
//set('writable_dirs', ['var']);
|
||||
|
||||
set('migrations_config', '');
|
||||
set('allow_anonymous_stats', false);
|
||||
|
||||
set('console_options', fn() => '--no-interaction');
|
||||
set('bin/console', fn() => parse('{{release_path}}/bin/console'));
|
||||
|
||||
set('composer_options', '--verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-scripts');
|
||||
|
||||
// Hosts
|
||||
host('snips.loken.nl')
|
||||
->setRemoteUser('www-data')
|
||||
->setRemoteUser('tim')
|
||||
->set('branch', function () {
|
||||
return input()->getOption('branch') ?: 'master';
|
||||
})
|
||||
->set('deploy_path', '~/snips.loken.nl')
|
||||
;
|
||||
|
||||
desc('Clear cache');
|
||||
task('cache:clear', fn() => run('{{bin/php}} {{bin/console}} cache:clear {{console_options}} --no-warmup'));
|
||||
|
||||
desc('Warm up cache');
|
||||
task('cache:warmup', fn() => run('{{bin/php}} {{bin/console}} cache:warmup {{console_options}}'));
|
||||
|
||||
desc('Migrate database');
|
||||
task('database:migrate', function () {
|
||||
$options = '--allow-no-migration';
|
||||
if (get('migrations_config') !== '') {
|
||||
$options = sprintf('%s --configuration={{release_path}}/{{migrations_config}}', $options);
|
||||
}
|
||||
|
||||
run(sprintf('{{bin/php}} {{bin/console}} doctrine:migrations:migrate %s {{console_options}}', $options));
|
||||
});
|
||||
|
||||
desc('Shows current deployed version');
|
||||
task('deploy:current', function () {
|
||||
$current = run('readlink {{deploy_path}}/current');
|
||||
writeln("Current deployed version: $current");
|
||||
});
|
||||
|
||||
desc('Deploy project');
|
||||
task('deploy', [
|
||||
'deploy:prepare',
|
||||
'deploy:vendors',
|
||||
'database:migrate',
|
||||
'cache:clear',
|
||||
'cache:warmup',
|
||||
'deployment:log',
|
||||
'deploy:symlink',
|
||||
'deploy:unlock',
|
||||
'deploy:cleanup',
|
||||
'deploy:current',
|
||||
]);
|
||||
|
||||
after('deploy', 'deploy:success');
|
||||
|
||||
after('deploy:failed', 'deploy:unlock');
|
||||
->set('deploy_path', '/var/www/snips.loken.nl')
|
||||
;
|
65
deploy/symfony.php
Normal file
65
deploy/symfony.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Deployer;
|
||||
|
||||
require_once 'recipe/common.php';
|
||||
require_once 'deploy/git.php';
|
||||
|
||||
// [Optional] Allocate tty for git clone. Default value is false.
|
||||
set('git_tty', true);
|
||||
|
||||
// Shared files/dirs between deploys
|
||||
set('shared_dirs', ['var/log', 'var/sessions']);
|
||||
set('shared_files', ['.env.local']);
|
||||
|
||||
set('writable_dirs', ['.']);
|
||||
set('writable_mode', 'sticky');
|
||||
set('http-group', 'var-www');
|
||||
|
||||
set('migrations_config', '');
|
||||
set('allow_anonymous_stats', false);
|
||||
|
||||
set('console_options', fn() => '--no-interaction');
|
||||
set('bin/console', fn() => parse('{{release_path}}/bin/console'));
|
||||
|
||||
set('composer_options', '--verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-scripts');
|
||||
|
||||
desc('Clear cache');
|
||||
task('cache:clear', fn() => run('{{bin/php}} {{bin/console}} cache:clear {{console_options}} --no-warmup'));
|
||||
|
||||
desc('Warm up cache');
|
||||
task('cache:warmup', fn() => run('{{bin/php}} {{bin/console}} cache:warmup {{console_options}}'));
|
||||
|
||||
desc('Migrate database');
|
||||
task('database:migrate', function () {
|
||||
$options = '--allow-no-migration';
|
||||
if (get('migrations_config') !== '') {
|
||||
$options = sprintf('%s --configuration={{release_path}}/{{migrations_config}}', $options);
|
||||
}
|
||||
|
||||
run(sprintf('{{bin/php}} {{bin/console}} doctrine:migrations:migrate %s {{console_options}}', $options));
|
||||
});
|
||||
|
||||
desc('Shows current deployed version');
|
||||
task('deploy:current', function () {
|
||||
$current = run('readlink {{deploy_path}}/current');
|
||||
writeln("Current deployed version: $current");
|
||||
});
|
||||
|
||||
desc('Deploy project');
|
||||
task('deploy', [
|
||||
'deploy:prepare',
|
||||
'deploy:vendors',
|
||||
'database:migrate',
|
||||
'cache:clear',
|
||||
'cache:warmup',
|
||||
'deployment:log',
|
||||
'deploy:symlink',
|
||||
'deploy:unlock',
|
||||
'deploy:cleanup',
|
||||
'deploy:current',
|
||||
]);
|
||||
|
||||
after('deploy', 'deploy:success');
|
||||
|
||||
after('deploy:failed', 'deploy:unlock');
|
Loading…
x
Reference in New Issue
Block a user