From 9f633222fd1e044a90122268a786fa41e65f4865 Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle <patrizio@bekerle.com> Date: Mon, 12 Jul 2021 10:23:38 +0200 Subject: [PATCH] Add deployment to dev server --- .gitlab-ci.yml | 33 +- .gitlab-ci/Dockerfile | 8 + .gitlab-ci/README.md | 2 +- .gitlab-ci/build.sh | 2 +- .gitlab-ci/composer.json | 9 + .gitlab-ci/composer.lock | 1259 ++++++++++++++++++++++++++++++ .gitlab-ci/php-ini-overrides.ini | 3 +- composer.json | 2 + composer.lock | 247 +++++- deploy.php | 112 +++ src/Kernel.php | 6 +- symfony.lock | 12 + 12 files changed, 1688 insertions(+), 7 deletions(-) create mode 100644 .gitlab-ci/composer.json create mode 100644 .gitlab-ci/composer.lock create mode 100644 deploy.php diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ff5f060..c535552 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: registry.gitlab.tugraz.at/dbp/dbp-api/api-server-template/main:v1 +image: registry.gitlab.tugraz.at/dbp/dbp-api/api-server-template/main:v2 before_script: - 'git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.tugraz.at/".insteadOf "git@gitlab.tugraz.at:"' @@ -14,6 +14,7 @@ cache: stages: - test + - deploy .test_defaults: &test_defaults script: @@ -62,3 +63,33 @@ cs-fixer: - sudo update-alternatives --set php /usr/bin/php7.4 - composer install - composer run cs + +.deploy_defaults: &deploy_defaults + needs: ["test-php7.3", "test-php7.4"] + except: + - schedules + stage: deploy + script: + - sudo update-alternatives --set php /usr/bin/php7.3 + # 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 "${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_development: + only: + refs: + - main + environment: + name: development + url: https://mw-dev.tugraz.at + variables: + DEPLOY_HOST: mw01-dev.tugraz.at + DEPLOY_KEY: "$DEPLOY_SSH_KEY" + <<: *deploy_defaults diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile index 83bd83a..7c7f310 100644 --- a/.gitlab-ci/Dockerfile +++ b/.gitlab-ci/Dockerfile @@ -71,6 +71,14 @@ RUN useradd -u 1000 -ms /bin/bash user RUN echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers USER 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}" + # Install a newer composer RUN mkdir -p /home/user/.local/bin WORKDIR /home/user/.local/bin diff --git a/.gitlab-ci/README.md b/.gitlab-ci/README.md index fa39e34..c987dfe 100644 --- a/.gitlab-ci/README.md +++ b/.gitlab-ci/README.md @@ -1,4 +1,4 @@ * 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/dbp-api/api-server-template/main:v1 \ No newline at end of file +* sudo docker push registry.gitlab.tugraz.at/dbp/dbp-api/api-server-template/main:v2 \ No newline at end of file diff --git a/.gitlab-ci/build.sh b/.gitlab-ci/build.sh index e1cf566..917ff6e 100755 --- a/.gitlab-ci/build.sh +++ b/.gitlab-ci/build.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -TAG="registry.gitlab.tugraz.at/dbp/dbp-api/api-server-template/main:v1" +TAG="registry.gitlab.tugraz.at/dbp/dbp-api/api-server-template/main:v2" sudo docker build --tag "${TAG}" --file "Dockerfile" . sudo docker run --rm --security-opt label=disable \ --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \ diff --git a/.gitlab-ci/composer.json b/.gitlab-ci/composer.json new file mode 100644 index 0000000..849f45e --- /dev/null +++ b/.gitlab-ci/composer.json @@ -0,0 +1,9 @@ +{ + "require": { + "symfony/process": " ^5.0", + "symfony/console": " ^5.0", + "symfony/yaml": " ^5.0", + "deployer/deployer": " ^6.4", + "deployer/recipes": " ^6.2" + } +} diff --git a/.gitlab-ci/composer.lock b/.gitlab-ci/composer.lock new file mode 100644 index 0000000..99f5915 --- /dev/null +++ b/.gitlab-ci/composer.lock @@ -0,0 +1,1259 @@ +{ + "_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": "d437ac982bece41bb2b7cbfd03511766", + "packages": [ + { + "name": "deployer/deployer", + "version": "v6.8.0", + "source": { + "type": "git", + "url": "https://github.com/deployphp/deployer.git", + "reference": "4e243a64ed61e779fbb31c5a74e258a8e52fdaff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/deployphp/deployer/zipball/4e243a64ed61e779fbb31c5a74e258a8e52fdaff", + "reference": "4e243a64ed61e779fbb31c5a74e258a8e52fdaff", + "shasum": "" + }, + "require": { + "deployer/phar-update": "~2.2", + "php": "^7.2", + "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", + "support": { + "docs": "https://deployer.org/docs", + "issues": "https://github.com/deployphp/deployer/issues", + "source": "https://github.com/deployphp/deployer" + }, + "funding": [ + { + "url": "https://github.com/antonmedv", + "type": "github" + }, + { + "url": "https://www.patreon.com/deployer", + "type": "patreon" + } + ], + "time": "2020-04-25T16:05:31+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" + ], + "support": { + "issues": "https://github.com/deployphp/phar-update/issues", + "source": "https://github.com/deployphp/phar-update/tree/v2.2.0" + }, + "abandoned": true, + "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" + ], + "support": { + "issues": "https://github.com/deployphp/recipes/issues", + "source": "https://github.com/deployphp/recipes" + }, + "abandoned": true, + "time": "2019-06-27T06:47:18+00:00" + }, + { + "name": "pimple/pimple", + "version": "v3.4.0", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "86406047271859ffc13424a048541f4531f53601" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/86406047271859ffc13424a048541f4531f53601", + "reference": "86406047271859ffc13424a048541f4531f53601", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1" + }, + "require-dev": { + "symfony/phpunit-bridge": "^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4.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": "https://pimple.symfony.com", + "keywords": [ + "container", + "dependency injection" + ], + "support": { + "source": "https://github.com/silexphp/Pimple/tree/v3.4.0" + }, + "time": "2021-03-06T08:28:00+00:00" + }, + { + "name": "psr/container", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", + "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://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" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.1" + }, + "time": "2021-03-05T17:36:06+00:00" + }, + { + "name": "symfony/console", + "version": "v5.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "864568fdc0208b3eba3638b6000b69d2386e6768" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/864568fdc0208b3eba3638b6000b69d2386e6768", + "reference": "864568fdc0208b3eba3638b6000b69d2386e6768", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/polyfill-php80": "^1.15", + "symfony/service-contracts": "^1.1|^2", + "symfony/string": "^5.1" + }, + "conflict": { + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "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": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v5.2.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-05-11T15:45:21+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.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": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-03-23T23:28:01+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.23.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-19T12:13:01+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.23.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "24b72c6baa32c746a4d0840147c9715e42bb68ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/24b72c6baa32c746a4d0840147c9715e42bb68ab", + "reference": "24b72c6baa32c746a4d0840147c9715e42bb68ab", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + }, + "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 intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-05-27T09:17:38+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.23.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "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 for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-19T12:13:01+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.23.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2df51500adbaebdc4c38dea4c89a2e131c45c8a1", + "reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-05-27T09:27:20+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.23.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", + "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-19T12:13:01+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.23.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/eca0bf41ed421bed1b57c4958bab16aa86b757d0", + "reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-19T12:13:01+00:00" + }, + { + "name": "symfony/process", + "version": "v5.2.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "98cb8eeb72e55d4196dd1e36f1f16e7b3a9a088e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/98cb8eeb72e55d4196dd1e36f1f16e7b3a9a088e", + "reference": "98cb8eeb72e55d4196dd1e36f1f16e7b3a9a088e", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.15" + }, + "type": "library", + "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": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v5.3.0-BETA1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-04-08T10:27:02+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", + "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-04-01T10:43:52+00:00" + }, + { + "name": "symfony/string", + "version": "v5.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "01b35eb64cac8467c3f94cd0ce2d0d376bb7d1db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/01b35eb64cac8467c3f94cd0ce2d0d376bb7d1db", + "reference": "01b35eb64cac8467c3f94cd0ce2d0d376bb7d1db", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" + }, + "require-dev": { + "symfony/error-handler": "^4.4|^5.0", + "symfony/http-client": "^4.4|^5.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "files": [ + "Resources/functions.php" + ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "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": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v5.2.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-05-10T14:56:10+00:00" + }, + { + "name": "symfony/yaml", + "version": "v5.2.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "d23115e4a3d50520abddccdbec9514baab1084c8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/d23115e4a3d50520abddccdbec9514baab1084c8", + "reference": "d23115e4a3d50520abddccdbec9514baab1084c8", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<4.4" + }, + "require-dev": { + "symfony/console": "^4.4|^5.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "bin": [ + "Resources/bin/yaml-lint" + ], + "type": "library", + "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": "Loads and dumps YAML files", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/yaml/tree/v5.2.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-05-16T13:07:46+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.0.0" +} diff --git a/.gitlab-ci/php-ini-overrides.ini b/.gitlab-ci/php-ini-overrides.ini index 83a1116..fe804da 100644 --- a/.gitlab-ci/php-ini-overrides.ini +++ b/.gitlab-ci/php-ini-overrides.ini @@ -1 +1,2 @@ -zend.assertions = 1 \ No newline at end of file +zend.assertions = 1 +date.timezone = "Europe/Vienna" diff --git a/composer.json b/composer.json index 17121c4..01c60e1 100644 --- a/composer.json +++ b/composer.json @@ -99,6 +99,8 @@ } }, "require-dev": { + "deployer/deployer": "^6.4", + "deployer/recipes": "^6.2", "friendsofphp/php-cs-fixer": "^3.0", "phpstan/phpstan": "^0.12.7", "phpstan/phpstan-phpunit": "^0.12.6", diff --git a/composer.lock b/composer.lock index a4f2b8e..845d5f3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "476cd1928ae3abc56e6d385dad2a6879", + "content-hash": "2955f60ebbab9e69237b65101d513a5f", "packages": [ { "name": "api-platform/core", @@ -6935,6 +6935,196 @@ ], "time": "2021-05-05T19:37:51+00:00" }, + { + "name": "deployer/deployer", + "version": "v6.8.0", + "source": { + "type": "git", + "url": "https://github.com/deployphp/deployer.git", + "reference": "4e243a64ed61e779fbb31c5a74e258a8e52fdaff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/deployphp/deployer/zipball/4e243a64ed61e779fbb31c5a74e258a8e52fdaff", + "reference": "4e243a64ed61e779fbb31c5a74e258a8e52fdaff", + "shasum": "" + }, + "require": { + "deployer/phar-update": "~2.2", + "php": "^7.2", + "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", + "support": { + "docs": "https://deployer.org/docs", + "issues": "https://github.com/deployphp/deployer/issues", + "source": "https://github.com/deployphp/deployer" + }, + "funding": [ + { + "url": "https://github.com/antonmedv", + "type": "github" + }, + { + "url": "https://www.patreon.com/deployer", + "type": "patreon" + } + ], + "time": "2020-04-25T16:05:31+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" + ], + "support": { + "issues": "https://github.com/deployphp/phar-update/issues", + "source": "https://github.com/deployphp/phar-update/tree/v2.2.0" + }, + "abandoned": true, + "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" + ], + "support": { + "issues": "https://github.com/deployphp/recipes/issues", + "source": "https://github.com/deployphp/recipes" + }, + "abandoned": true, + "time": "2019-06-27T06:47:18+00:00" + }, { "name": "dnoegel/php-xdg-base-dir", "version": "v0.1.1", @@ -7491,6 +7681,59 @@ }, "time": "2021-06-17T08:28:30+00:00" }, + { + "name": "pimple/pimple", + "version": "v3.4.0", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "86406047271859ffc13424a048541f4531f53601" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/86406047271859ffc13424a048541f4531f53601", + "reference": "86406047271859ffc13424a048541f4531f53601", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1" + }, + "require-dev": { + "symfony/phpunit-bridge": "^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4.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": "https://pimple.symfony.com", + "keywords": [ + "container", + "dependency injection" + ], + "support": { + "source": "https://github.com/silexphp/Pimple/tree/v3.4.0" + }, + "time": "2021-03-06T08:28:00+00:00" + }, { "name": "sebastian/diff", "version": "4.0.4", @@ -8511,5 +8754,5 @@ "platform-overrides": { "php": "7.3" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.0.0" } diff --git a/deploy.php b/deploy.php new file mode 100644 index 0000000..e29d9f1 --- /dev/null +++ b/deploy.php @@ -0,0 +1,112 @@ +<?php + +declare(strict_types=1); + +namespace Deployer; + +require 'recipe/common.php'; +require 'recipe/rsync.php'; +require 'recipe/cachetool.php'; + +// Global config +set('allow_anonymous_stats', false); + +$rsync_config = [ + 'exclude' => [ + '.git', + 'deploy.php', + ], + 'exclude-file' => false, + 'include' => [], + 'include-file' => false, + 'filter' => [], + 'filter-file' => false, + 'filter-perdir' => false, + 'flags' => 'rz', + 'options' => ['delete', 'links'], + 'timeout' => 60, +]; + +// Hosts +host('development') + ->stage('development') + ->hostname('mw@mw01-dev.tugraz.at') + ->set('deploy_path', '/home/mw/dev01/deploy/api-server-template') + ->set('shared_dirs', ['var/log', 'var/sessions']) + ->set('APP_ENV', 'prod') + ->set('APP_DEBUG', '0') + ->set('APP_DEPLOYMENT_ENV', 'development') + ->set('KEYCLOAK_SERVER_URL', 'https://auth-dev.tugraz.at/auth') + ->set('KEYCLOAK_CLIENT_ID', 'auth-dev-mw-dev') + ->set('KEYCLOAK_FRONTEND_CLIENT_ID', 'auth-dev-mw-frontend') + ->set('rsync', $rsync_config) + ->set('rsync_src', __DIR__) + ->set('rsync_dest', '{{release_path}}') + ->set('cachetool', '127.0.0.1:9001'); + +// Build task +task('build-custom', function () { + $APP_ENV = get('APP_ENV'); + + $vars = [ + 'KEYCLOAK_CLIENT_SECRET' => getenv('KEYCLOAK_CLIENT_SECRET'), + 'APP_ENV' => $APP_ENV, + 'APP_DEBUG' => get('APP_DEBUG'), + 'APP_DEPLOYMENT_ENV' => get('APP_DEPLOYMENT_ENV'), + 'KEYCLOAK_SERVER_URL' => get('KEYCLOAK_SERVER_URL'), + 'KEYCLOAK_CLIENT_ID' => get('KEYCLOAK_CLIENT_ID'), + 'KEYCLOAK_FRONTEND_CLIENT_ID' => get('KEYCLOAK_FRONTEND_CLIENT_ID'), + ]; + + // build .env.local file + runLocally('rm -f .env.local'); + foreach ($vars as $key => $value) { + if (!isset($value) || $value === '') { + throw new \Exception("'${key}' is not set"); + } + runLocally("echo '${key}=${value}' >> .env.local"); + } + + // Add build commit + $commit = runLocally('git rev-parse --short HEAD'); + runLocally("echo \"APP_BUILDINFO=${commit}\" >> .env.local"); + + // Add commit url to gitlab + $remote = runLocally('git config --get remote.origin.url'); + $parts = parse_url($remote); + $parts['path'] = substr($parts['path'], 0, (strrpos($parts['path'], '.'))); + $base_url = $parts['scheme'].'://'.$parts['host'].$parts['path']; + $build_url = $base_url.'/'.rawurlencode('commit').'/'.rawurlencode($commit); + runLocally("echo \"APP_BUILDINFO_URL=${build_url}\" >> .env.local"); + + // composer install and optimize + runLocally('composer install --no-dev --classmap-authoritative'); + + // build .env.local.php file + runLocally('rm -f .env.local.php'); + runLocally("composer dump-env '$APP_ENV'"); + runLocally('rm -f .env.local'); + + // Cache warmup + runLocally('php bin/console cache:clear'); + runLocally('php bin/console cache:warmup'); +}); + +// Deploy task +task('deploy', [ + 'deploy:info', + 'build-custom', + 'deploy:prepare', + 'deploy:lock', + 'deploy:release', + 'rsync', + 'deploy:shared', + 'deploy:symlink', + 'deploy:unlock', + 'cleanup', + 'success', +]); +after('deploy:failed', 'deploy:unlock'); + +// Clear opcache +after('deploy:symlink', 'cachetool:clear:opcache'); diff --git a/src/Kernel.php b/src/Kernel.php index e63175f..1213710 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -15,7 +15,11 @@ class Kernel extends BaseKernel protected function configureContainer(ContainerConfigurator $container): void { - $container->import('../config/{packages}/*.yaml'); + // Ignore all errors in case we are not local/development. We disable some + // bundles in demo/prod which leads to unused config, which symfony fails over. + $ignoreErrors = !in_array($_ENV['APP_DEPLOYMENT_ENV'], ['local', 'development'], true); + + $container->import('../config/{packages}/*.yaml', null, $ignoreErrors); $container->import('../config/{packages}/'.$this->environment.'/*.yaml'); if (is_file(\dirname(__DIR__).'/config/services.yaml')) { diff --git a/symfony.lock b/symfony.lock index 04c03fd..1b5f6db 100644 --- a/symfony.lock +++ b/symfony.lock @@ -40,6 +40,15 @@ "dbp/api-starter-bundle": { "version": "dev-main" }, + "deployer/deployer": { + "version": "v6.8.0" + }, + "deployer/phar-update": { + "version": "v2.2.0" + }, + "deployer/recipes": { + "version": "6.2.2" + }, "dnoegel/php-xdg-base-dir": { "version": "v0.1.1" }, @@ -169,6 +178,9 @@ "phpstan/phpstan-phpunit": { "version": "0.12.16" }, + "pimple/pimple": { + "version": "v3.4.0" + }, "psr/cache": { "version": "1.0.1" }, -- GitLab