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

namespace Deployer;

Thomas Löffler's avatar
Thomas Löffler committed
5 6
require_once '/tmp/vendor/deployer/deployer/recipe/common.php';
require_once '/tmp/vendor/deployer/recipes/recipe/rsync.php';
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
7 8

$sharedDirectories = [
9 10
    'private/fileadmin',
    'private/uploads',
11
    'public/.well-known'
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
12 13 14 15
];
set('shared_dirs', $sharedDirectories);

$sharedFiles = [
16
    'private/typo3conf/AdditionalConfiguration.php',
17
    '.cachetool.yml',
18
    'public/services/api-keys.php'
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
19 20 21 22
];
set('shared_files', $sharedFiles);

$writeableDirectories = [
Thomas Löffler's avatar
Thomas Löffler committed
23
    'public/typo3temp'
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
24 25 26 27 28 29 30
];
set('writable_dirs', $writeableDirectories);

$exclude = [
    '.gitignore',
    '.htaccess',
    '.git',
Thomas Löffler's avatar
Thomas Löffler committed
31 32 33
    '.ddev',
    '.gitlab-ci.yml',
    'auth.json',
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
34 35 36 37 38 39
    'Readme.rst',
    'Readme.txt',
    'Upgrading.rst',
    'Upgrading.txt',
    'README',
    '*.example',
40
    'Build'
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
41 42 43 44 45 46 47 48 49
];
set('rsync', [
    'exclude' => array_merge($sharedDirectories, $sharedFiles, $exclude),
    'exclude-file' => false,
    'include' => [],
    'include-file' => false,
    'filter' => [],
    'filter-file' => false,
    'filter-perdir' => false,
50
    'flags' => 'avz',
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
51 52 53
    'options' => ['delete'],
    'timeout' => 300
]);
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
54
set('rsync_src', './');
Thomas Löffler's avatar
Thomas Löffler committed
55 56
inventory('./.gitlab-ci/deployer/servers.yml');
set('php', '/opt/php/php72/bin/php');
Thomas Löffler's avatar
Thomas Löffler committed
57
set('bin_folder', 'vendor/bin/');
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
58

59 60 61 62
task('solr_host', function () {
    run('cd {{deploy_path}} && ./solr_change_host.sh');
});

63
task('typo3', function () {
64 65
    run('cd {{release_path}} && {{php}} {{bin_folder}}typo3cms install:generatepackagestates');
    run('cd {{release_path}} && {{php}} {{bin_folder}}typo3cms install:extensionsetupifpossible');
66 67
});

68
task('cache', function () {
69
    run('cd {{release_path}} && {{php}} {{bin_folder}}cachetool opcache:reset');
70
});
71

Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
72 73 74 75 76 77 78
task('deploy', [
    'deploy:prepare',
    'deploy:release',
    'rsync:warmup',
    'rsync',
    'deploy:shared',
    'deploy:writable',
79
    'typo3',
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
80
    'deploy:symlink',
81
    'solr_host',
82
    'cache',
Thomas Löffler's avatar
Thomas Löffler committed
83
    'cleanup'
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
84
]);