Gitlab CI/CD, deploy "Hello World" in Nginx on ec2 instances

Viewed 21

I have created my first file gitlab-ci.yml and I have also installed my first runner, I am very happy, but I have a problem.

Here my first yml:

stages:
  - init
  - deploy

hello:
  stage: init
  script:
    - echo "Hello World"

deploy:
  stage: deploy
  script:
    - cd /var/www/html
    - git pull http://$GIT_USER:$GIT_PASS@source.server/ema/ci-cd-test.git
  tags:
    - shell-test-ema

I have to perform an SSH connection to an ec2 instances (target) using username and password to test the deployment of a "hello world" but I don’t know how to do it.

Is there a safer and easier way to implement this?

My idea is to understand the deploy procedure.

Regards,

0 Answers
Related