Commit e41c377d authored by Thomas Löffler's avatar Thomas Löffler

Adds configuration for deployment

parent 9b2afb7f
variables:
GIT_STRATEGY: "none"
GIT_SSL_NO_VERIFY: "true"
before_script:
- apk add bash --no-cache
stages:
- dump
- build
- layout
- deploy
build:
stage: build
image: composer
variables:
GIT_STRATEGY: "clone"
GIT_SUBMODULE_STRATEGY: "recursive"
script:
- composer config store-auths false
- composer config http-basic.git-t3o.typo3.org gitlab-ci-token ${CI_BUILD_TOKEN}
- composer install
artifacts:
paths:
- ./
expire_in: '1h'
except:
- assets
layout:
stage: layout
image: node:7
before_script:
- cd html/typo3conf/ext/t3olayout/Build
script:
- npm install
- npm run build
artifacts:
paths:
- ./
expire_in: '7d'
dependencies:
- build
except:
- assets
.deploy-template: &deploy_template
stage: deploy
before_script:
- apk add openssh-client bash --no-cache
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY_STAGE" | ssh-add -
- echo "$SSH_PRIVATE_KEY_PRODUCTION" | ssh-add -
- ssh-keyscan -p 22191 stage.typo3.org >> /root/.ssh/known_hosts
- ssh-keyscan -p 22193 typo3.org >> /root/.ssh/known_hosts
script:
- VERSION=4.0.0-alpine ./.gitlab-ci/scripts/deployer.sh -f/src/.gitlab-ci/deployer/deploy.php deploy ${CI_BUILD_REF_NAME}
when: manual
dependencies:
- layout
except:
- assets
deploy-master:
<<: *deploy_template
environment:
name: master
url: https://typo3.org/
only:
- master
deploy-develop:
<<: *deploy_template
environment:
name: develop
url: https://stage.typo3.org/
only:
- develop
dump-assets:
<<: *deploy_template
stage: dump
image: alpine:3.5
artifacts:
paths:
- ./assets/
expire_in: '3d'
script:
- apk add rsync --no-cache
- rsync -ah -e "ssh -p 22191" tthreeorgstage@stage.typo3.org:ci/shared/ ./assets/
- ssh -p22191 tthreeorgstage@stage.typo3.org "mysqldump -u${STAGE_DATABASE_USER} -p${STAGE_DATABASE_PASSWORD} -h127.0.0.1 tthreeorgstage | gzip -9 -c" > ./assets/db.sql.gz
dependencies:
when:
tags:
- proxy
only:
- assets
except:
<?php
namespace Deployer;
require_once '/composer/vendor/deployer/deployer/recipe/common.php';
require_once '/composer/vendor/deployer/recipes/rsync.php';
$sharedDirectories = [
'html/fileadmin',
'html/uploads',
'html/.well-known'
];
set('shared_dirs', $sharedDirectories);
$sharedFiles = [
'html/typo3conf/AdditionalConfiguration.php',
];
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,
'flags' => 'avz',
'options' => ['delete'],
'timeout' => 300
]);
set('rsync_src', '/src/');
set('keep_releases', 10);
serverList('/src/.gitlab-ci/deployer/servers.yml');
task('typo3', function () {
run('cd {{release_path}} && /opt/php/php70/bin/php bin/typo3cms install:generatepackagestates 0 1');
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');
});
task('deploy', [
'deploy:prepare',
'deploy:release',
'rsync:warmup',
'rsync',
'deploy:shared',
'deploy:writable',
'deploy:symlink',
'cleanup',
'typo3'
]);
master:
host: my.typo3.org
port: 22193
user: my
forward_agent: true
deploy_path: ~/ci
develop:
host: my-stage.typo3.org
port: 22191
user: mystage
forward_agent: true
deploy_path: ~/ci/
Subproject commit 57323530b0771c5575efb38d64d1bf117716ebf5
[submodule ".gitlab-ci/scripts"]
path = .gitlab-ci/scripts
url = https://github.com/torvitas/docker-scripts.git
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