Files
website-typo3/deploy.php
T

153 lines
4.0 KiB
PHP

<?php
namespace Deployer;
require 'vendor/deployer/deployer/recipe/typo3.php';
require 'vendor/deployer/recipes/recipe/rsync.php';
require 'vendor/deployer/recipes/recipe/cachetool.php';
set('typo3_webroot', 'public');
set('application', 'ep-reisen-typo3');
set('repository', '[email protected]:dreipunktnull/ep-reisen-web');
set('git_tty', false);
set('ssh_type', 'native');
set('allow_anonymous_stats', false);
add('shared_files', [
'{{typo3_webroot}}/typo3conf/LocalConfiguration.php',
'{{typo3_webroot}}/sinkhole.html',
]);
add('shared_dirs', [
'config/sites',
]);
$rsyncOptions = [
'exclude' => [
'.ddev',
'.DS_Store',
'.git',
'.github',
'.idea',
'node_modules',
'public/fileadmin',
'public/typo3temp',
'public/uploads',
'var',
'.editorconfig',
'.gitignore',
'.htaccess_prod',
'deploy.php',
'package.json',
'package-lock.json',
'postcss.config.js',
'tailwind.config.js',
'webpack.config.js',
],
'exclude-file' => false,
'include' => [],
'include-file' => false,
'filter' => [],
'filter-file' => false,
'filter-perdir' => false,
'flags' => 'rz',
'options' => ['delete', 'links'],
'timeout' => 300,
];
host('production')
->hostname('185.237.67.190')
->stage('production')
->user('p546128')
->forwardAgent()
->multiplexing()
->set('deploy_path', '/home/www/p546128/html/{{application}}')
->set('buspronet_path', '/home/www/p546128/html/kuschick/buspronet/buspronet')
->set('bin/php', '/usr/local/bin/php')
->set('http_user', 'p546128')
->set('bin/composer', '/usr/local/bin/composer')
->set('rsync_src', __DIR__)
->set('rsync', $rsyncOptions)
->set('bin/cachetool', 'cachetool-7.0.0.phar')
->set('cachetool_args', '--web=SymfonyHttpClient --web-path={{release_path}}/public/ --web-url=https://www.ep-reisen.de')
;
$sharedFilesStaging = get('shared_files');
$sharedFilesStaging[] = '{{typo3_webroot}}/.htpasswd';
host('staging')
->hostname('185.237.67.190')
->stage('staging')
->user('p546128')
->forwardAgent()
->multiplexing()
->set('deploy_path', '/home/www/p546128/html/{{application}}-staging')
->set('bin/php', '/usr/local/bin/php')
->set('http_user', 'p546128')
->set('bin/composer', '/usr/local/bin/composer')
->set('rsync_src', __DIR__)
->set('rsync', $rsyncOptions)
->set('bin/cachetool', 'cachetool-7.0.0.phar')
->set('cachetool_args', '--web=SymfonyHttpClient --web-path={{release_path}}/public/ --web-url=https://staging.ep-reisen.de --web-basic-auth=ep:reisen')
->set('shared_files', $sharedFilesStaging)
;
task('deploy', [
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'rsync',
'deploy:clear_paths',
'deploy:shared',
'typo3:database:migrate',
'typo3:language:update',
'typo3:cache:flush',
'deploy:symlink',
'deploy:buspronet:symlink',
'deploy:unlock',
'cachetool:clear:opcache',
'cleanup',
]);
task('deploy_staging', [
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:assets:build',
'rsync',
'deploy:clear_paths',
'deploy:shared',
'typo3:database:migrate',
'typo3:language:update',
'typo3:cache:flush',
'deploy:symlink',
'deploy:unlock',
'cachetool:clear:opcache',
'cleanup',
]);
task('deploy:buspronet:symlink', function () {
run('ln -s {{buspronet_path}} {{release_path}}/public/buchung');
});
task ('deploy:assets:build', function () {
runLocally('npm i && npm run build');
});
task('typo3:database:migrate', function () {
run('{{bin/php}} {{release_path}}/vendor/bin/typo3cms database:updateschema');
});
task('typo3:language:update', function () {
run('{{bin/php}} {{release_path}}/vendor/bin/typo3cms language:update');
});
task('typo3:cache:flush', function () {
run('{{bin/php}} {{release_path}}/vendor/bin/typo3cms cache:flush');
});
after('deploy:failed', 'deploy:unlock');