Deployment mit Deployer und Git
Ich stoße beim Deployment mit Deployer und Git an meine Grenzen und muss gestehen, dass meine php Kenntnisse nicht ausreichen. Wie im Contao Handbuch beschrieben, habe ich Deployer lokal installiert. Der Webserver Zugriff (All-Inkl) auf das Git-Repository ist mit einem SSH-Schlüssel realisiert (public Key > Git Einstellungen / private Key > Git Projekt CI/CD Variable "SSH_PRIVATE_KEY").
.hosts.yml
Code:
hosts:
production:
hostname: 'ssh-host'
remote_user: 'ssh-user'
port: 22
deploy_path: 'path-to-production'
deploy.php
PHP-Code:
<?php
namespace Deployer;
import('recipe/contao.php');
set('repository', 'git@gitlab.com:Pad-zum-Repository.git');
// Include hosts
import('.hosts.yml');
// Set maximum number of releases
set('keep_releases', 3);
// Unlock on failed deployment
after('deploy:failed', 'deploy:unlock');
.gitlab-ci.yml
Code:
stages:
- deploy
deploy:
stage: deploy
image:
name: minkbear/php-deployer
# name: pipelinecomponents/deployer
entrypoint: [""]
before_script:
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- ssh-deactivate-key-checking
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
# Fix permissions
- find /builds/`echo $CI_PROJECT_PATH` -type d -print0 | xargs -0 chmod 0755
- find /builds/`echo $CI_PROJECT_PATH` -type f -print0 | xargs -0 chmod 0664
- composer install --no-dev --no-ansi --no-interaction --no-scripts --prefer-dist
- dep deploy production -vvv
resource_group: production
only:
- main
Die Zeilen in der .gitlab-ci.yml habe ich aus einer Anleitung übernommen, die mit dem Image "minkbear/php-deployer" arbeitet.
Die Pipeline stoppt mit dem Fehler:
Zitat:
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- ausi/slug-generator is locked to version v1.1.1 and an update of this package was not requested.
- ausi/slug-generator v1.1.1 requires ext-intl * -> it is missing from your system. Install or enable PHP's intl extension.
Problem 2
- contao/core-bundle is locked to version 4.13.30 and an update of this package was not requested.
- contao/core-bundle 4.13.30 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension.
Problem 3
- contao/image is locked to version 1.2.0 and an update of this package was not requested.
- contao/image 1.2.0 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension.
Problem 4
- contao/core-bundle 4.13.30 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension.
- terminal42/notification_center 1.7.2 requires contao/core-bundle ^4.13 -> satisfiable by contao/core-bundle[4.13.30].
- terminal42/notification_center is locked to version 1.7.2 and an update of this package was not requested.
To enable extensions, verify that they are enabled in your .ini files:
-
- /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
Ich vermutete, dass es am verwendeten Image liegt und habe es stattessen mit "pipelinecomponents/deployer" ausprobiert. Dieses scheint auch aktiver weiterentwickelt zu werden.
Aber hier stoße ich beim deployen auf den Fehler
Zitat:
"/bin/bash: line 137: composer: command not found".