Commit 0686c23b authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Add deployment stage

parent 54581f91
Pipeline #2510 failed with stages
in 1 minute and 48 seconds
<?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',
'var/labels'
];
set('shared_dirs', $sharedDirectories);
$sharedFiles = [
'private/typo3conf/AdditionalConfiguration.php'
];
set('shared_files', $sharedFiles);
$writeableDirectories = [
'public/typo3temp',
];
set('writable_dirs', $writeableDirectories);
$exclude = [
'.gitignore',
'.git',
'Readme.rst',
'Readme.txt',
'Upgrading.rst',
'Upgrading.txt',
'README',
'*.example',
'AdditionalConfiguration.ddev.php'
];
set('rsync', [
'exclude' => array_merge($sharedDirectories, $sharedFiles, $exclude),
'exclude-file' => false,
'include' => [],
'include-file' => false,
'filter' => [],
'filter-file' => false,
'filter-perdir' => false,
'flags' => 'avz',
'options' => ['delete'],
'timeout' => 300
]);
set('rsync_src', './');
set('keep_releases', 5);
set('typo3_console', './vendor/bin/typo3cms');
set('cache_file', 'cache.php');
set('cache_file_content', '<?php opcache_reset();');
inventory('.deployer/hosts.yml');
task('typo3', function () {
run('cd {{release_path}} && {{typo3_console}} install:generatepackagestates');
run('cd {{release_path}} && {{typo3_console}} install:extensionsetupifpossible');
});
task('opcache', function () {
run('cd {{release_path}} && echo "{{cache_file_content}}" > public/{{cache_file}}');
run('curl -s https://{{hostname}}/{{cache_file}} > /dev/null');
run('cd {{release_path}} && rm -f public/{{cache_file}}');
});
task('deploy', [
'deploy:prepare',
'deploy:release',
'rsync:warmup',
'rsync',
'deploy:shared',
'deploy:writable',
'typo3',
'deploy:symlink',
'opcache',
'cleanup',
]);
develop:
hostname: test.spooner.zone
user: root
port: 22
deploy_path: /var/www/spooner.zone/test/
identity_file: ~/.ssh/id_rsa
forward_agent: true
multiplexing: false
http_user: www-data
cache:
paths:
- /cache/composer
stages:
- composer
- frontend
- test
- test2
- deploy
- whatever
"Run composer":
stage: composer
image: composer:1
before_script:
- composer config cache-dir /cache/composer
script:
- composer install
artifacts:
paths:
- ./
expire_in: 2 hours
"Run deployment":
stage: deploy
image: composer:1
before_script:
- apk add rsync --update
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- echo "$PRIVATE_KEY" | ssh-add -
- composer config cache-dir /cache/composer
- composer require global deployer/deployer
- composer require global deployer/recipes
script:
- /tmp/vendor/bin/deploy .deploy/deploy.php -v
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