Commit 60b07e83 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Add deployment pipeline

parent 080597a6
Pipeline #6438 failed
include:
- project: 't3o/t3olayout'
ref: master
file: '/Configuration/GitLab/t3o-builds.yml'
stages:
- test
- build
- layout
- deploy
variables:
GIT_STRATEGY: "none"
GIT_SSL_NO_VERIFY: "true"
PRODUCTION_PORT: 22201
PRODUCTION_HOST: "condolences.typo3.org"
DUMP_USER: "condolences"
DUMP_EXCLUDE_TABLES_LIST: "be_groups,be_sessions,be_users,cf_cache_hash,cf_cache_hash_tags,cf_cache_imagesizes,cf_cache_imagesizes_tags,cf_cache_news_category,cf_cache_news_category_tags,cf_cache_pages,cf_cache_pages_tags,cf_cache_pagesection,cf_cache_pagesection_tags,cf_cache_rootline,cf_cache_rootline_tags,cf_extbase_datamapfactory_datamap,cf_extbase_datamapfactory_datamap_tags,cf_extbase_object,cf_extbase_object_tags,cf_extbase_reflection,cf_extbase_reflection_tags,cf_tx_solr,cf_tx_solr_configuration,cf_tx_solr_configuration_tags,cf_tx_solr_tags,fe_groups,fe_sessions,fe_users,sys_domain,sys_log,tx_solr_cache,tx_solr_cache_tags"
PHP_EXECUTABLE: "/opt/php/php72/bin/php"
.deploy-template: &deploy_template
stage: deploy
image: composer:1
before_script:
- apk add rsync --update
- mkdir -p /root/.ssh/
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY_PRODUCTION" | ssh-add -
- ssh-keyscan -p ${PRODUCTION_PORT} ${PRODUCTION_HOST} >> /root/.ssh/known_hosts
- composer config cache-dir /cache/composer
- composer global require deployer/deployer
- composer global require deployer/recipes
script:
- /tmp/vendor/bin/dep --file=./.gitlab-ci/deployer/deploy.php deploy ${CI_BUILD_REF_NAME}
dependencies:
- layout
except:
- assets
deploy-master:
<<: *deploy_template
environment:
name: master
url: https://${PRODUCTION_HOST}
only:
- master
<?php
namespace Deployer;
require_once '/tmp/vendor/deployer/deployer/recipe/common.php';
require_once '/tmp/vendor/deployer/recipes/recipe/rsync.php';
$sharedDirectories = [
'private/fileadmin',
'private/uploads',
'public/.well-known'
];
set('shared_dirs', $sharedDirectories);
$sharedFiles = [
'private/typo3conf/AdditionalConfiguration.php',
'.cachetool.yml'
];
set('shared_files', $sharedFiles);
$writeableDirectories = [
'public/typo3temp'
];
set('writable_dirs', $writeableDirectories);
$exclude = [
'.gitignore',
'.htaccess',
'.git',
'.ddev',
'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
]);
set('rsync_src', './');
set('keep_releases', 10);
inventory('./.gitlab-ci/deployer/servers.yml');
set('php', '/opt/php/php72/bin/php');
set('bin_folder', 'vendor/bin/');
task('typo3', function() {
run('cd {{release_path}} && {{php}} {{bin_folder}}typo3cms install:generatepackagestates');
run('cd {{release_path}} && {{php}} {{bin_folder}}typo3cms install:extensionsetupifpossible');
});
task('cache', function () {
run('cd {{release_path}} && {{php}} {{bin_folder}}cachetool opcache:reset');
});
task('deploy', [
'deploy:prepare',
'deploy:release',
'rsync:warmup',
'rsync',
'deploy:shared',
'deploy:writable',
'typo3',
'deploy:symlink',
'cache',
'cleanup'
]);
master:
stage: production
hostname: condolences.typo3.org
port: 22201
user: condolences
writable_mode: chmod
forward_agent: true
deploy_path: ~/ci/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment