deploy.php 1.97 KB
Newer Older
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
1 2 3 4 5 6
<?php

namespace Deployer;

require_once '/composer/vendor/deployer/deployer/recipe/common.php';
require_once '/composer/vendor/deployer/recipes/rsync.php';
7
require_once '/composer/vendor/deployer/recipes/cachetool.php';
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
8 9 10 11 12 13 14 15 16

$sharedDirectories = [
    'html/fileadmin',
    'html/uploads',
    'html/.well-known'
];
set('shared_dirs', $sharedDirectories);

$sharedFiles = [
17
    'html/typo3conf/AdditionalConfiguration.php',
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
];
set('shared_files', $sharedFiles);

$writeableDirectories = [
    'html/typo3temp',
    'html/fileadmin',
    'html/uploads'
];
set('writable_dirs', $writeableDirectories);

$exclude = [
    '.gitignore',
    '.htaccess',
    '.git',
    'Readme.rst',
    'Readme.txt',
    'Upgrading.rst',
    'Upgrading.txt',
    'README',
    '*.example',
    'AdditionalConfiguration.sample.php'
];
set('rsync', [
    'exclude' => array_merge($sharedDirectories, $sharedFiles, $exclude),
    'exclude-file' => false,
    'include' => [],
    'include-file' => false,
    'filter' => [],
    'filter-file' => false,
    'filter-perdir' => false,
48
    'flags' => 'avz',
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
49 50 51 52 53
    'options' => ['delete'],
    'timeout' => 300
]);
set('rsync_src', '/src/');
set('keep_releases', 10);
54
set('cachetool', '/run/php7-fpm-tthreeorgstage.sock');
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
55 56
serverList('/src/.gitlab-ci/deployer/servers.yml');

57
task('typo3', function () {
58
    run('cd {{release_path}} && /opt/php/php70/bin/php bin/typo3cms install:generatepackagestates 0 1');
59 60 61 62 63 64
    run('cd {{release_path}} && /opt/php/php70/bin/php bin/typo3cms database:updateschema');
    run('cd {{release_path}} && /opt/php/php70/bin/php bin/typo3cms language:update');
    run('cd {{release_path}} && /opt/php/php70/bin/php bin/typo3cms install:fixfolderstructure');
    run('cd {{release_path}} && /opt/php/php70/bin/php bin/typo3cms cache:flush');
});

65

Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
66 67 68 69 70 71 72 73
task('deploy', [
    'deploy:prepare',
    'deploy:release',
    'rsync:warmup',
    'rsync',
    'deploy:shared',
    'deploy:writable',
    'deploy:symlink',
74
    'cachetool:clear:opcache',
75
    'cleanup',
76
    'typo3'
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
77
]);