2021-05-07 15:27:49 +02:00
|
|
|
<?php
|
|
|
|
namespace Deployer;
|
|
|
|
|
2023-02-08 17:11:54 +01:00
|
|
|
require 'recipe/symfony.php';
|
2021-05-07 15:27:49 +02:00
|
|
|
|
|
|
|
// Project name
|
2022-01-24 17:40:19 +01:00
|
|
|
set('application', 'pflaenz.li');
|
2021-05-07 15:27:49 +02:00
|
|
|
|
|
|
|
// Project repository
|
2022-01-11 20:31:44 +01:00
|
|
|
set('repository', 'ssh://git@git.thisfro.ch:222/thisfro/pflaenz.li.git');
|
2021-05-07 15:27:49 +02:00
|
|
|
|
|
|
|
// [Optional] Allocate tty for git clone. Default value is false.
|
|
|
|
set('git_tty', true);
|
|
|
|
|
2022-01-14 14:20:21 +01:00
|
|
|
set('bin/php', function() {
|
2023-02-08 17:11:54 +01:00
|
|
|
return '/opt/php8.2/bin/php';
|
2022-01-14 14:20:21 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
set('bin/composer', function() {
|
2023-02-08 17:11:54 +01:00
|
|
|
return '/opt/php8.2/bin/composer2';
|
2022-01-14 14:20:21 +01:00
|
|
|
});
|
|
|
|
|
2021-05-07 15:27:49 +02:00
|
|
|
// Shared files/dirs between deploys
|
2022-01-14 13:57:12 +01:00
|
|
|
add('shared_files', ['public/.htaccess']);
|
|
|
|
add('shared_dirs', ['public/uploads']);
|
2021-05-07 15:27:49 +02:00
|
|
|
|
|
|
|
// Writable dirs by web server
|
|
|
|
add('writable_dirs', []);
|
|
|
|
|
2022-01-11 20:31:44 +01:00
|
|
|
// Set composer options
|
2023-02-08 17:11:54 +01:00
|
|
|
set('composer_options', '--verbose --prefer-dist --no-progress --no-interaction --optimize-autoloader --no-scripts');
|
2021-05-07 15:27:49 +02:00
|
|
|
|
|
|
|
// Hosts
|
2023-02-08 17:11:54 +01:00
|
|
|
host('lq5xi.ftp.infomaniak.com')
|
|
|
|
->set('remote_user', 'lq5xi_thisfro')
|
2022-01-24 17:40:19 +01:00
|
|
|
->set('deploy_path', '~/sites/{{stage}}.{{application}}')
|
2022-01-14 13:57:44 +01:00
|
|
|
->set('http_user', 'uid153060')
|
2023-02-08 17:11:54 +01:00
|
|
|
->set('stage', 'beta');
|
2022-01-11 20:31:44 +01:00
|
|
|
|
2021-05-07 15:27:49 +02:00
|
|
|
// Tasks
|
|
|
|
|
2022-01-11 20:31:44 +01:00
|
|
|
task('upload:build', function() {
|
|
|
|
upload('public/build/', '{{release_path}}/public/build/');
|
2021-05-07 15:27:49 +02:00
|
|
|
});
|
|
|
|
|
2022-01-11 20:31:44 +01:00
|
|
|
// Build yarn locally
|
|
|
|
task('deploy:build:assets', function (): void {
|
2023-02-08 17:11:54 +01:00
|
|
|
runLocally('yarn install');
|
|
|
|
runLocally('yarn encore production');
|
|
|
|
})->desc('Install front-end assets');
|
2022-01-11 20:31:44 +01:00
|
|
|
|
|
|
|
before('deploy:symlink', 'deploy:build:assets');
|
|
|
|
|
|
|
|
// Upload assets
|
|
|
|
task('upload:assets', function (): void {
|
|
|
|
upload(__DIR__.'/public/build/', '{{release_path}}/public/build');
|
|
|
|
});
|
|
|
|
|
2022-01-11 22:43:43 +01:00
|
|
|
task('upload:build', function() {
|
|
|
|
upload("public/build/", '{{release_path}}/public/build/');
|
|
|
|
});
|
|
|
|
|
|
|
|
task('upload:build', function() {
|
|
|
|
upload("public/build/", '{{release_path}}/public/build/');
|
|
|
|
});
|
|
|
|
|
2022-01-11 20:31:44 +01:00
|
|
|
after('deploy:build:assets', 'upload:assets');
|
|
|
|
|
2021-05-07 15:27:49 +02:00
|
|
|
// [Optional] if deploy fails automatically unlock.
|
|
|
|
after('deploy:failed', 'deploy:unlock');
|
|
|
|
|
2022-01-11 22:43:43 +01:00
|
|
|
before('deploy:symlink', 'database:migrate');
|