M
M
mixejuxix2019-07-30 14:32:42
Software Deployment
mixejuxix, 2019-07-30 14:32:42

How to set up a deployment with gitlab CI?

Hello, please help. I can’t figure out how to deploy the application
I have a local laravel + nuxt project
I also have a vps server on which the application should be running .
When making changes to the project, I need to:
1. Upload the updated files to the vps server
2. Run yarn update && yarn on the server run build && composer update && php artisan migrate
3. Restart nuxt server
I created a repository on gitlab.com
As far as I understand now I need to set up CI But I don't quite understand how this technology works
How do I link my repository to a vps server?
Do I need to install gitlab-runner on the server?
Or in .gitlab-ci.yml somehow specify the ssh settings and the folder on the vps server with the application?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Shakhunov, 2019-08-01
@mixejuxix

It's better to set up gitlab-runner on the server in shell mode. Then it will just be running the commands one by one.
If there is no gitlab runner, then the ssh private key is usually thrown into the ENV of the repository, in order to then make the C shell gitlab-runner something like this:echo $DEPLOY_KEY >> /.ssh/id_rsa

stages:
  - build
  - deploy

deploy:
  stage: deploy
  only:
    - master
  script:
    - yarn update && yarn run build && composer update && php artisan migrate
  tags:
    - shell

D
Dmitry Shitskov, 2019-07-30
@Zarom

in .gitlab-ci.yml somehow specify the ssh settings and the folder on the vps server with the application
https://ealebed.github.io/tags/gitlab-ci/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question