Files
website-typo3/deploy.php
T

132 lines
3.9 KiB
PHP

<?php
namespace Deployer;
require 'recipe/typo3.php';
require 'contrib/rsync.php';
require 'contrib/cachetool.php';
set('typo3_webroot', 'public');
set('application', 'ep-reisen-typo3');
set('keep_releases', 3);
add('shared_files', [
'{{typo3_webroot}}/typo3conf/LocalConfiguration.php',
'{{typo3_webroot}}/sinkhole.html',
'{{typo3_webroot}}/.htpasswd',
]);
add('shared_dirs', [
'config/sites',
]);
$rsyncOptions = [
'exclude' => [
'.ddev',
'.DS_Store',
'.git',
'.github',
'.idea',
'.nvmrc',
'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', 'chmod=D755,F664'],
'timeout' => 300,
];
host('production')
->setHostname('185.237.67.190')
->setRemoteUser('p546128')
->setForwardAgent(true)
->setSshMultiplexing(true)
->setDeployPath('/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('writable_mode', 'chmod')
->set('bin/composer', '/usr/local/bin/composer')
->set('composer_options', '--prefer-dist --no-progress --no-interaction --optimize-autoloader')
->set('rsync_src', __DIR__)
->set('rsync', $rsyncOptions)
->set('cachetool_args', '--web=SymfonyHttpClient --web-path={{release_or_current_path}}/public/ --web-url=https://www.ep-reisen.de')
;
$sharedFilesStaging = get('shared_files');
$sharedFilesStaging[] = '{{typo3_webroot}}/.htpasswd';
host('staging')
->setHostname('185.237.67.190')
->setRemoteUser('p546128')
->setForwardAgent(true)
->setSshMultiplexing(true)
->setDeployPath('/home/www/p546128/html/{{application}}-staging')
->set('buspronet_path', '/home/www/p546128/html/kuschick/buspronet/buspronet')
->set('bin/php', '/usr/local/bin/php')
->set('http_user', 'p546128')
->set('writable_mode', 'chmod')
->set('bin/composer', '/usr/local/bin/composer')
->set('composer_options', '--prefer-dist --no-progress --no-interaction --optimize-autoloader')
->set('rsync_src', __DIR__)
->set('rsync', $rsyncOptions)
->set('cachetool_args', '--web=SymfonyHttpClient --web-path={{release_or_current_path}}/public/ --web-url=https://staging.ep-reisen.de --web-basic-auth=ep:reisen')
->set('shared_files', $sharedFilesStaging)
;
task('deploy', [
'deploy:info',
'deploy:setup',
'deploy:lock',
'deploy:release',
'deploy:assets:build',
'rsync',
'deploy:shared',
'deploy:writable',
'typo3:database:migrate',
'typo3:language:update',
'typo3:cache:flush',
'deploy:publish',
'deploy:buspronet:symlink',
'cachetool:clear:opcache',
]);
task('deploy:buspronet:symlink', function () {
run('ln -s {{buspronet_path}} {{release_or_current_path}}/public/buchung');
});
task ('deploy:assets:build', function () {
runLocally('npm i && npm rebuild node-sass && npm run build');
});
task('typo3:database:migrate', function () {
run('{{bin/php}} {{release_or_current_path}}/vendor/bin/typo3cms database:updateschema');
});
task('typo3:language:update', function () {
run('{{bin/php}} {{release_or_current_path}}/vendor/bin/typo3cms language:update');
});
task('typo3:cache:flush', function () {
run('{{bin/php}} {{release_or_current_path}}/vendor/bin/typo3cms cache:flush');
});
after('deploy:failed', 'deploy:unlock');