Skip to content
Snippets Groups Projects
Commit 52bf9dbc authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

CI: Port to deployer v7

The behaviour should be the same, except the deployer command
is now independent of the CWD.

We also no longer ship deployer in the docker image, but install
it via composer, so it's easier to update.
parent d4784629
No related branches found
No related tags found
No related merge requests found
Pipeline #113296 failed
image: registry.gitlab.tugraz.at/dbp/web-components/toolkit/main:v1 image: registry.gitlab.tugraz.at/dbp/web-components/toolkit/main:v2
cache: cache:
key: ${CI_PROJECT_PATH} key: ${CI_PROJECT_PATH}
...@@ -51,8 +51,10 @@ publish: ...@@ -51,8 +51,10 @@ publish:
- chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa - chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -t rsa "${DEPLOY_HOST}" >> ~/.ssh/known_hosts - ssh-keyscan -t rsa "${DEPLOY_HOST}" >> ~/.ssh/known_hosts
# Deploy # Deploy
- cd toolkit-showcase - cd .gitlab-ci
- dep deploy --file ./../.gitlab-ci/deploy.php "${CI_ENVIRONMENT_NAME}" - export DO_NOT_TRACK=1
- composer install
- composer exec -- deployer.phar deploy "stage=${CI_ENVIRONMENT_NAME}"
- echo "Deployed to ${CI_ENVIRONMENT_URL}" - echo "Deployed to ${CI_ENVIRONMENT_URL}"
# Simple health check # Simple health check
- curl --max-time 10 --retry 3 --output /dev/null --silent --show-error --fail --location "${CI_ENVIRONMENT_URL}" - curl --max-time 10 --retry 3 --output /dev/null --silent --show-error --fail --location "${CI_ENVIRONMENT_URL}"
......
vendor/
\ No newline at end of file
FROM debian:buster FROM debian:bullseye
ENV LANG C.UTF-8 ENV LANG C.UTF-8
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
...@@ -34,11 +34,3 @@ RUN useradd -u 1000 -ms /bin/bash user ...@@ -34,11 +34,3 @@ RUN useradd -u 1000 -ms /bin/bash user
RUN echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers RUN echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER user USER user
WORKDIR /home/user WORKDIR /home/user
# Install deployer globally and add it to PATH
ENV COMPOSER_HOME="/home/user/.composer"
RUN mkdir -p "${COMPOSER_HOME}"
ADD composer.lock "${COMPOSER_HOME}"
ADD composer.json "${COMPOSER_HOME}"
RUN composer global install
ENV PATH "${COMPOSER_HOME}/vendor/bin:${PATH}"
\ No newline at end of file
#!/bin/bash #!/bin/bash
set -e set -e
TAG="registry.gitlab.tugraz.at/dbp/web-components/toolkit/main:v1" TAG="registry.gitlab.tugraz.at/dbp/web-components/toolkit/main:v2"
sudo docker build --tag "${TAG}" --file "Dockerfile" . sudo docker build --tag "${TAG}" --file "Dockerfile" .
echo "Now run: sudo docker push '$TAG'" echo "Now run: sudo docker push '$TAG'"
{ {
"require": { "require": {
"symfony/process": " ^4.4", "symfony/process": " ^5.0",
"symfony/console": " ^4.4", "symfony/console": " ^5.0",
"symfony/yaml": " ^4.4", "symfony/yaml": " ^5.0",
"deployer/deployer": " ^6.4", "deployer/deployer": "^7.0.0-rc.3"
"deployer/recipes": " ^6.2" },
"config": {
"platform": {
"php": "7.3"
}
} }
} }
This diff is collapsed.
<?php <?php
declare(strict_types=1);
namespace Deployer; namespace Deployer;
require 'recipe/common.php'; import('recipe/common.php');
require 'recipe/rsync.php'; import('contrib/rsync.php');
// Global config $PROJECT_ROOT = dirname(__DIR__).'/toolkit-showcase';
set('allow_anonymous_stats', false);
set('rsync',[ $RSYNC_CONFIG = [
'exclude' => [ 'exclude' => [],
'.git',
'deploy.php',
],
'exclude-file' => false, 'exclude-file' => false,
'include' => [], 'include' => [],
'include-file' => false, 'include-file' => false,
'filter' => [], 'filter' => [],
'filter-file' => false, 'filter-file' => false,
'filter-perdir'=> false, 'filter-perdir' => false,
'flags' => 'rz', 'flags' => 'rz',
'options' => ['delete'], 'options' => ['delete', 'links'],
'timeout' => 60, 'timeout' => 60,
]); ];
set('rsync_src', __DIR__ . '/../toolkit-showcase/dist');
set('rsync_dest','{{release_path}}');
// Hosts // Hosts
host('demo') host('demo')
->stage('demo') ->set('labels', ['stage' => 'demo'])
->hostname('mw@vpu01-demo.tugraz.at') ->setHostname('mw@vpu01-demo.tugraz.at')
->set('rsync', $RSYNC_CONFIG)
->set('rsync_src', $PROJECT_ROOT.'/dist')
->set('deploy_path', '/home/mw/demo/deploy/apps/demo'); ->set('deploy_path', '/home/mw/demo/deploy/apps/demo');
host('development') host('development')
->stage('development') ->set('labels', ['stage' => 'development'])
->hostname('mw@mw01-dev.tugraz.at') ->setHostname('mw@mw01-dev.tugraz.at')
->set('rsync', $RSYNC_CONFIG)
->set('rsync_src', $PROJECT_ROOT.'/dist')
->set('deploy_path', '/home/mw/dev/deploy/apps/demo'); ->set('deploy_path', '/home/mw/dev/deploy/apps/demo');
task('build', function () { task('build', function () use ($PROJECT_ROOT) {
$stage = get('stage'); $options = ['cwd' => $PROJECT_ROOT];
runLocally("yarn install --frozen-lockfile"); $stage = get('labels')['stage'];
runLocally("APP_ENV=$stage yarn run build"); runLocally("yarn install --frozen-lockfile", $options);
runLocally("APP_ENV=$stage yarn run build", $options);
}); });
// Deploy task // Deploy task
task('deploy', [ task('deploy', [
'deploy:info', 'deploy:info',
'build', 'build',
'deploy:prepare', 'deploy:setup',
'deploy:lock', 'deploy:lock',
'deploy:release', 'deploy:release',
'rsync', 'rsync',
'deploy:shared', 'deploy:shared',
'deploy:symlink', 'deploy:symlink',
'deploy:unlock', 'deploy:unlock',
'cleanup', 'deploy:cleanup',
'success', 'deploy:success',
]); ]);
after('deploy:failed', 'deploy:unlock'); after('deploy:failed', 'deploy:unlock');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment