deployer WIP

This commit is contained in:
Jannis Portmann 2022-01-11 20:31:44 +01:00
parent e01500ad0f
commit cb90ba1eb3

View file

@ -1,13 +1,13 @@
<?php <?php
namespace Deployer; namespace Deployer;
require 'recipe/symfony.php'; require 'recipe/symfony4.php';
// Project name // Project name
set('application', 'plant-exchange'); set('application', 'beta.pflaenz.li');
// Project repository // Project repository
set('repository', 'ssh://git@git.thisfro.ch:222/thisfro/plant-exchange.git'); set('repository', 'ssh://git@git.thisfro.ch:222/thisfro/pflaenz.li.git');
// [Optional] Allocate tty for git clone. Default value is false. // [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true); set('git_tty', true);
@ -19,22 +19,40 @@ add('shared_dirs', []);
// Writable dirs by web server // Writable dirs by web server
add('writable_dirs', []); add('writable_dirs', []);
// Set composer options
set('composer_options', '{{composer_action}} --verbose --prefer-dist --no-progress --no-interaction --optimize-autoloader --no-scripts');
// Hosts // Hosts
host('pflaenz.li') host('beta.xn--pflnz-ira.li')
->set('deploy_path', '~/{{application}}'); ->user('lq5xi_thisfro')
->set('deploy_path', '~/sites/{{application}}');
set('http_user', 'uid153060');
// Tasks // Tasks
task('build', function () { task('upload:build', function() {
run('cd {{release_path}} && build'); upload('public/build/', '{{release_path}}/public/build/');
}); });
// Build yarn locally
task('deploy:build:assets', function (): void {
run('yarn install');
run('yarn encore production');
})->local()->desc('Install front-end assets');
before('deploy:symlink', 'deploy:build:assets');
// Upload assets
task('upload:assets', function (): void {
upload(__DIR__.'/public/build/', '{{release_path}}/public/build');
});
after('deploy:build:assets', 'upload:assets');
// [Optional] if deploy fails automatically unlock. // [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock'); after('deploy:failed', 'deploy:unlock');
// Migrate database before symlink new release. // Migrate database before symlink new release.
before('deploy:symlink', 'database:migrate'); before('deploy:symlink', 'database:migrate');