deploy.php 1.85 KB
Newer Older
1 2 3 4 5 6 7 8
<?php

namespace Deployer;

require_once '/composer/vendor/deployer/deployer/recipe/common.php';
require_once '/composer/vendor/deployer/recipes/rsync.php';

$sharedDirectories = [
9 10 11
    'html/fileadmin',
    'html/uploads',
    'html/.well-known'
12 13 14 15
];
set('shared_dirs', $sharedDirectories);

$sharedFiles = [
16
    'html/typo3conf/AdditionalConfiguration.php',
17
    '.cachetool.yml'
18 19 20 21
];
set('shared_files', $sharedFiles);

$writeableDirectories = [
22 23 24
    'html/typo3temp',
    'html/fileadmin',
    'html/uploads'
25 26 27 28 29
];
set('writable_dirs', $writeableDirectories);

$exclude = [
    '.gitignore',
30
    '.htaccess',
31
    '.git',
32
    '.ddev',
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
    '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,
    'flags' => 'az',
    'options' => ['delete'],
    'timeout' => 300
]);
53
set('rsync_src', './');
54
set('keep_releases', 10);
55
serverList('./.gitlab-ci/deployer/servers.yml');
56
set('php', '/opt/php/php70/bin/php');
57
set('typo3_console', 'vendor/bin/typo3cms');
58

59
task('typo3', function() {
60
    run('cd {{release_path}} && {{php}} /usr/local/bin/composer install');
61 62
    run('cd {{release_path}} && {{php}} {{typo3_console}} install:generatepackagestates');
    run('cd {{release_path}} && {{php}} {{typo3_console}} install:extensionsetupifpossible');
63 64 65
});

task('cache', function () {
66
    run('cd {{release_path}} && {{php}} vendor/bin/cachetool opcache:reset');
67 68
});

69

70 71 72 73 74 75 76
task('deploy', [
    'deploy:prepare',
    'deploy:release',
    'rsync:warmup',
    'rsync',
    'deploy:shared',
    'deploy:writable',
77
    'typo3',
78
    'deploy:symlink',
79 80
    'cache',
    'cleanup'
81
]);