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

CI: move deployment to external repo

parent 47c960c2
No related branches found
No related tags found
No related merge requests found
Pipeline #190995 passed
...@@ -44,65 +44,21 @@ publish: ...@@ -44,65 +44,21 @@ publish:
# yarn always reports "https://registry.yarnpkg.com/@dbp-topics%2fsignature - Not found", so we are using npm directly # yarn always reports "https://registry.yarnpkg.com/@dbp-topics%2fsignature - Not found", so we are using npm directly
- npm run publish - npm run publish
.deploy_defaults: &deploy_defaults deploy:
stage: deploy
except: except:
- schedules - schedules
stage: deploy
script:
# Add ssh key
- mkdir -p ~/.ssh
- echo "${DEPLOY_KEY}" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -t rsa "${DEPLOY_HOST}" >> ~/.ssh/known_hosts
# Deploy
- dep deploy --file ./.gitlab-ci/deploy.php "${CI_ENVIRONMENT_NAME}"
- echo "Deployed to ${CI_ENVIRONMENT_URL}"
# Simple health check
- curl --max-time 10 --retry 3 --output /dev/null --silent --show-error --fail --location "${CI_ENVIRONMENT_URL}"
deploy_demo:
only:
refs:
- demo
environment:
name: demo
url: https://dbp-demo.tugraz.at/apps/signature
variables:
DEPLOY_HOST: vpu01-demo.tugraz.at
DEPLOY_KEY: "$DEPLOY_SSH_KEY"
<<: *deploy_defaults
deploy_development:
only: only:
refs: refs:
- master - master
environment: - demo
name: development
url: https://dbp-dev.tugraz.at/apps/signature
variables:
DEPLOY_HOST: mw01-dev.tugraz.at
DEPLOY_KEY: "$DEPLOY_SSH_KEY"
<<: *deploy_defaults
deploy_production:
only:
refs:
- production - production
environment: inherit:
name: production variables: false
url: https://esign.tugraz.at
variables:
DEPLOY_HOST: mw01-prod.tugraz.at
DEPLOY_KEY: "$DEPLOY_SSH_KEY"
<<: *deploy_defaults
e2e_tests:
only:
refs:
- master
variables: variables:
E2E_PROJECT: signature UPSTREAM_PROJECT_PATH: ${CI_PROJECT_PATH}
stage: e2e UPSTREAM_COMMIT_BRANCH: ${CI_COMMIT_BRANCH}
UPSTREAM_COMMIT_SHA: ${CI_COMMIT_SHA}
trigger: trigger:
project: dbp/e2e-tests project: dbp/deployer
strategy: depend strategy: depend
...@@ -20,9 +20,6 @@ RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.lis ...@@ -20,9 +20,6 @@ RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.lis
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
nodejs \ nodejs \
yarn \ yarn \
composer \
php-zip \
php-curl \
rsync \ rsync \
sudo \ sudo \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
...@@ -41,13 +38,5 @@ RUN echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers ...@@ -41,13 +38,5 @@ 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}"
# https://stackoverflow.com/questions/53230823 # https://stackoverflow.com/questions/53230823
ENV NODE_OPTIONS '--max-old-space-size=4096' ENV NODE_OPTIONS '--max-old-space-size=4096'
* In case of an incompatible change increase the tag version number in build.sh
* ./build.sh
* (first time) sudo docker login registry.gitlab.tugraz.at
* sudo docker push registry.gitlab.tugraz.at/dbp/esign/signature/main:v1
\ No newline at end of file
{
"require": {
"symfony/process": " ^4.4",
"symfony/console": " ^4.4",
"symfony/yaml": " ^4.4",
"deployer/deployer": " ^6.4",
"deployer/recipes": " ^6.2"
}
}
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "fc172111fcf35d162cee207f067861c2",
"packages": [
{
"name": "deployer/deployer",
"version": "v6.7.1",
"source": {
"type": "git",
"url": "https://github.com/deployphp/deployer.git",
"reference": "6242bb8748c714dab628d67e3a0e1c57cb8d4afe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/deployphp/deployer/zipball/6242bb8748c714dab628d67e3a0e1c57cb8d4afe",
"reference": "6242bb8748c714dab628d67e3a0e1c57cb8d4afe",
"shasum": ""
},
"require": {
"deployer/phar-update": "~2.2",
"php": "~7.0",
"pimple/pimple": "~3.0",
"symfony/console": "~2.7|~3.0|~4.0|~5.0",
"symfony/process": "~2.7|~3.0|~4.0|~5.0",
"symfony/yaml": "~2.7|~3.0|~4.0|~5.0"
},
"require-dev": {
"phpunit/phpunit": "^8"
},
"bin": [
"bin/dep"
],
"type": "library",
"autoload": {
"psr-4": {
"Deployer\\": "src/"
},
"files": [
"src/Support/helpers.php",
"src/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anton Medvedev",
"email": "anton@medv.io"
}
],
"description": "Deployment Tool",
"homepage": "https://deployer.org",
"time": "2019-12-15T14:13:11+00:00"
},
{
"name": "deployer/phar-update",
"version": "v2.2.0",
"source": {
"type": "git",
"url": "https://github.com/deployphp/phar-update.git",
"reference": "9ad07422f2cd43a1382ee8e134bdcd3a374848e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/deployphp/phar-update/zipball/9ad07422f2cd43a1382ee8e134bdcd3a374848e3",
"reference": "9ad07422f2cd43a1382ee8e134bdcd3a374848e3",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/console": "~2.7|~3.0|~4.0|~5.0"
},
"require-dev": {
"mikey179/vfsstream": "1.1.0",
"phpunit/phpunit": "3.7.*",
"symfony/process": "~2.7|~3.0|~4.0|~5.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Deployer\\Component\\PharUpdate\\": "src/",
"Deployer\\Component\\PHPUnit\\": "src/PHPUnit/",
"Deployer\\Component\\Version\\": "src/Version/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kevin Herrera",
"email": "kevin@herrera.io",
"homepage": "http://kevin.herrera.io"
},
{
"name": "Anton Medvedev",
"email": "anton@medv.io",
"homepage": "https://medv.io"
}
],
"description": "Integrates Phar Update to Symfony Console.",
"homepage": "https://github.com/deployphp/phar-update",
"keywords": [
"console",
"phar",
"update"
],
"time": "2019-12-12T13:45:57+00:00"
},
{
"name": "deployer/recipes",
"version": "6.2.2",
"source": {
"type": "git",
"url": "https://github.com/deployphp/recipes.git",
"reference": "84b3229c518c094a950e1fe785b7b8f9598770fe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/deployphp/recipes/zipball/84b3229c518c094a950e1fe785b7b8f9598770fe",
"reference": "84b3229c518c094a950e1fe785b7b8f9598770fe",
"shasum": ""
},
"require": {
"php": "~7.0"
},
"replace": {
"deployer/recipes": "self.version"
},
"require-dev": {
"deployer/deployer": "^6.3"
},
"type": "library",
"autoload": {
"files": [
"autoload.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anton Medvedev",
"email": "anton@medv.io"
}
],
"description": "3rd party deployer recipes",
"homepage": "https://github.com/deployphp/recipes",
"keywords": [
"cachetool",
"cloudflare",
"deploy",
"deployer",
"deployment",
"hipchat",
"newrelic",
"rabbit",
"recipes",
"sentry",
"slack",
"yarn"
],
"time": "2019-06-27T06:47:18+00:00"
},
{
"name": "pimple/pimple",
"version": "v3.2.3",
"source": {
"type": "git",
"url": "https://github.com/silexphp/Pimple.git",
"reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/silexphp/Pimple/zipball/9e403941ef9d65d20cba7d54e29fe906db42cf32",
"reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"psr/container": "^1.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^3.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2.x-dev"
}
},
"autoload": {
"psr-0": {
"Pimple": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Pimple, a simple Dependency Injection Container",
"homepage": "http://pimple.sensiolabs.org",
"keywords": [
"container",
"dependency injection"
],
"time": "2018-01-21T07:42:36+00:00"
},
{
"name": "psr/container",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/container.git",
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Container\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common Container Interface (PHP FIG PSR-11)",
"homepage": "https://github.com/php-fig/container",
"keywords": [
"PSR-11",
"container",
"container-interface",
"container-interop",
"psr"
],
"time": "2017-02-14T16:28:37+00:00"
},
{
"name": "symfony/console",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/f0aea3df20d15635b3cb9730ca5eea1c65b7f201",
"reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php73": "^1.8",
"symfony/service-contracts": "^1.1|^2"
},
"conflict": {
"symfony/dependency-injection": "<3.4",
"symfony/event-dispatcher": "<4.3|>=5",
"symfony/lock": "<4.4",
"symfony/process": "<3.3"
},
"provide": {
"psr/log-implementation": "1.0"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "^3.4|^4.0|^5.0",
"symfony/dependency-injection": "^3.4|^4.0|^5.0",
"symfony/event-dispatcher": "^4.3",
"symfony/lock": "^4.4|^5.0",
"symfony/process": "^3.4|^4.0|^5.0",
"symfony/var-dumper": "^4.3|^5.0"
},
"suggest": {
"psr/log": "For using the console logger",
"symfony/event-dispatcher": "",
"symfony/lock": "",
"symfony/process": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Console\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2019-12-01T10:06:17+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.13.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.13-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"time": "2019-11-27T13:56:44+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.13.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f",
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.13-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"time": "2019-11-27T14:18:11+00:00"
},
{
"name": "symfony/polyfill-php73",
"version": "v1.13.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php73.git",
"reference": "4b0e2222c55a25b4541305a053013d5647d3a25f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f",
"reference": "4b0e2222c55a25b4541305a053013d5647d3a25f",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.13-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php73\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"time": "2019-11-27T16:25:15+00:00"
},
{
"name": "symfony/process",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "51c0135ef3f44c5803b33dc60e96bf4f77752726"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/51c0135ef3f44c5803b33dc60e96bf4f77752726",
"reference": "51c0135ef3f44c5803b33dc60e96bf4f77752726",
"shasum": ""
},
"require": {
"php": "^7.1.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2019-11-28T13:33:56+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v2.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "144c5e51266b281231e947b51223ba14acf1a749"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749",
"reference": "144c5e51266b281231e947b51223ba14acf1a749",
"shasum": ""
},
"require": {
"php": "^7.2.5",
"psr/container": "^1.0"
},
"suggest": {
"symfony/service-implementation": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Contracts\\Service\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Generic abstractions related to writing services",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"time": "2019-11-18T17:27:11+00:00"
},
{
"name": "symfony/yaml",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "76de473358fe802578a415d5bb43c296cf09d211"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/76de473358fe802578a415d5bb43c296cf09d211",
"reference": "76de473358fe802578a415d5bb43c296cf09d211",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"symfony/polyfill-ctype": "~1.8"
},
"conflict": {
"symfony/console": "<3.4"
},
"require-dev": {
"symfony/console": "^3.4|^4.0|^5.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2019-11-12T14:51:11+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
<?php
namespace Deployer;
require 'recipe/common.php';
require 'recipe/rsync.php';
// Global config
set('allow_anonymous_stats', false);
set('rsync',[
'exclude' => [
'.git',
'deploy.php',
],
'exclude-file' => false,
'include' => [],
'include-file' => false,
'filter' => [],
'filter-file' => false,
'filter-perdir'=> false,
'flags' => 'rz',
'options' => ['delete'],
'timeout' => 60,
]);
set('rsync_src', __DIR__ . '/../dist');
set('rsync_dest','{{release_path}}');
// Hosts
host('demo')
->stage('demo')
->hostname('mw@vpu01-demo.tugraz.at')
->set('deploy_path', '/home/mw/demo/deploy/apps/signature');
host('development')
->stage('development')
->hostname('mw@mw01-dev.tugraz.at')
->set('deploy_path', '/home/mw/dev/deploy/apps/signature');
host('production')
->stage('production')
->hostname('mw@mw01-prod.tugraz.at')
->set('deploy_path', '/home/mw/prod_esig/deploy');
task('build', function () {
$stage = get('stage');
runLocally("yarn install");
runLocally("APP_ENV=$stage yarn run build");
});
// Deploy task
task('deploy', [
'deploy:info',
'build',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'rsync',
'deploy:shared',
'deploy:symlink',
'deploy:unlock',
'cleanup',
'success',
]);
after('deploy:failed', 'deploy:unlock');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment