Commit 02a6c52e authored by Thomas Löffler's avatar Thomas Löffler

[TASK] Switched to TYPO3 Surf, first simulating

parent b8883a54
Pipeline #165 failed with stages
in 13 seconds
variables: variables:
SSH_HOST: proserver@vpro0100.proserver.punkt.de GIT_STRATEGY: "none"
SSH_PATH: /var/www/deploy GIT_SSL_NO_VERIFY: "true"
cache: before_script:
key: "$CI_BUILD_NAME/$CI_BUILD_REF_NAME" - apk add bash --update
untracked: true
paths:
- .composer/
stages: stages:
- test - build
- build - layout
- deploy - deploy
test:
stage: test
script: echo "Running tests..."
build: build:
image: montoias/docker-nodejs-bower-grunt-compass:v2 stage: build
stage: build variables:
before_script: GIT_STRATEGY: "clone"
- cd data/typo3/html/typo3conf/ext/t3olayout/Resources/Private GIT_SUBMODULE_STRATEGY: "recursive"
script: script:
- npm install - ./.gitlab-ci/scripts/composer.sh config store-auths false
- grunt - ./.gitlab-ci/scripts/composer.sh config http-basic.git-t3o.typo3.org gitlab-ci-token ${CI_BUILD_TOKEN}
artifacts: - ./.gitlab-ci/scripts/composer.sh install
paths: artifacts:
- data/typo3/html/typo3conf/ext/t3olayout/Resources/Public/Css/ paths:
- data/typo3/html/typo3conf/ext/t3olayout/Resources/Public/JavaScript/ - ./
expire_in: '1h'
environment: ${CI_BUILD_REF_NAME}
layout:
stage: layout
image: montoias/docker-nodejs-bower-grunt-compass:v2
before_script:
- cd html/typo3conf/ext/t3olayout/Resources/Private
script:
- npm install
- grunt
artifacts:
paths:
- ./
expire_in: '7d'
environment: ${CI_BUILD_REF_NAME}
dependencies:
- build
.deploy-template: &deploy_template
stage: deploy
script:
- apk add openssh-client
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | ssh-add -
- php surf.phar simulate Development
when: manual
dependencies:
- layout
deploy-master:
<<: *deploy_template
environment:
name: master
url: https://extensions.typo3.org/
only:
- master
deploy_staging: deploy-develop:
image: webdevops/php:debian-9 <<: *deploy_template
stage: deploy environment:
environment: name: develop
name: staging url: https://extensions-dev.typo3.org/
url: https://vpro0100.proserver.punkt.de only:
only: - develop
- master
- 9-add-deployment-on-staging-server
before_script:
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install ssh-agent if not already installed, it is required by Docker.
# (change apt-get to yum if you use a CentOS-based image)
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# For Docker builds disable host key checking. Be aware that by adding that
# you are suspectible to man-in-the-middle attacks.
# WARNING: Use this only with the Docker executor, if you use it with shell
# you will overwrite your user's SSH config.
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- export COMPOSER_CACHE_DIR=.composer
- cd data/typo3/
script:
- composer install --no-dev
- rsync -az -e "ssh" --delete --exclude=fileadmin --exclude=typo3conf/l10n --exclude=.git --exclude=node_modules --exclude=bower_components --exclude=typo3temp --exclude=.ssh --exclude=.sass-cache --exclude=/uploads ./ $SSH_HOST:$SSH_PATH/
- ssh $SSH_HOST $SSH_PATH/ci/follow_up.sh
#!/usr/bin/env bash
cd /var/www/deploy/
# Generate PackageState file including all core extensions
bin/typo3cms install:generatepackagestates 0 1
bin/typo3cms backend:lock;
bin/typo3cms language:update;
bin/typo3cms database:updateschema;
bin/typo3cms install:fixfolderstructure;
bin/typo3cms cache:flush;
bin/typo3cms backend:unlock;
<?php
/** @var $deployment TYPO3\Surf\Domain\Model\Deployment "injected" into this script from Surf */
$baseUrl = 'https://vpro0100.proserver.punkt.de/';
$deploymentPath = '/var/www/surf';
$node = new TYPO3\Surf\Domain\Model\Node('development');
$node
->setHostname('vpro0100.proserver.punkt.de')
->setOption('username', 'proserver');
$application = new TYPO3\Surf\Application\TYPO3\CMS('typo3.org');
$application
->setOption('applicationWebDirectory', 'html')
->setOption('TYPO3\\Surf\\Task\\TYPO3\\CMS\\SymlinkDataTask[webDirectory]', 'html')
->setOption('TYPO3\\Surf\\Task\\TYPO3\\CMS\\SetUpExtensionsTask[scriptFileName]', 'bin/typo3cms')
->setOption('TYPO3\\Surf\\Task\\TYPO3\\CMS\\FlushCachesTask[scriptFileName]', 'bin/typo3cms')
->setOption('keepReleases', 3)
->setOption('composerCommandPath', 'composer')
->setOption('updateMethod', null)
->setOption('packageMethod', null)
->setOption('baseUrl', $baseUrl)
->setContext('Development')
->setDeploymentPath($deploymentPath)
->addNode($node);
$deployment->addApplication($application);
$deployment->onInitialize(function () use ($deployment) {
$deployment->getWorkflow()
->setTaskOptions('TYPO3\\Surf\\Task\\Generic\\CreateSymlinksTask', ['symlinks' => ['html/sql' => '../../../shared/Sql']])
->removeTask('TYPO3\\Surf\\Task\\TYPO3\\CMS\\CreatePackageStatesTask')
->defineTask('pt:DeleteDirectoriesTask', 'TYPO3\\Surf\\Task\\ShellTask', [
'command' => 'rm -rf {releasePath}/html/fileadmin {releasePath}/html/uploads'
])
->beforeTask('TYPO3\\Surf\\Task\\TYPO3\\CMS\\SymlinkDataTask', 'pt:DeleteDirectoriesTask')
->defineTask('pt:RestartPhpFpmTask', 'TYPO3\\Surf\\Task\\ShellTask', [
'command' => 'sudo /usr/local/etc/rc.d/php-fpm restart'
])
->forStage('cleanup', 'TYPO3\\Surf\\Task\\Generic\\CreateSymlinksTask')
->forStage('cleanup', 'pt:RestartPhpFpmTask');
});
File added
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