Symfony – Gitlab CI/CD with Deployer

I’m trying to set up Gitlab CI/CD on my Symfony project using Deployer but i’m not able to do it.
When deployment is executed on my pipeline, i have an Operation timed out error which mean that my config is wrong.

My gitlab-ci.yml :

image: php:7.4-cli-alpine

  - deploy

  - apk add --update git openssh-client
  - mkdir -p ~/.ssh && echo -e "Host *ntStrictHostKeyChecking nonn" > ~/.ssh/config
  - eval $(ssh-agent -s)
  - echo "$SSH_PRIVATE_KEY" | ssh-add -

  stage: deploy
    - curl --show-error --silent | php
    - php composer.phar install -d app/
    - app/vendor/bin/dep deploy dev -vvv
    name: prod

My hosts.yml inventory :
  stage: dev
  hostname: XX.XXX.XX.X
  user: deployer
  branch: develop
  identityFile: ~/.ssh/gitlab
  deploy_path: /var/www/recruitment_back
  keep_releases: 1

My Gitlab pipeline error:

$ app/vendor/bin/dep deploy dev -vvv
✈︎ Deploying develop on XX.XXX.XX.X
• done on []
➤ Executing task deploy:prepare
[] > export APP_ENV='prod'; echo $0
[] < ssh multiplexing initialization
[] < ssh: connect to host XX.XXX.XX.X port 22: Operation timed out
➤ Executing task deploy:failed
• done on []
✔ Ok [0ms]

I’ve also added variable SSH_PRIVATE_KEY in Gitlab CI/CD settings and also added my public ssh key in authorized_keys on my server.
The deployment working good when executed on my local machine.

What’s wrong with my config ?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *