Gitlab deploy
Services and application must be automatically deployed on production via CI/CD.
Give access at Gitlab to both pmp-production & pmp-dev users on server
You can follow the user guide here.
Give access at the server to the CI/CD pipeline
You have to add the private/public keys from the pmp-production user to the CI/CD variable at the group level. For example for pmp-apps : https://gitlab.com/groups/pmp-apps/-/settings/ci_cd.
- Add variable for private key:
SSH_<servername>_<env: PRODUCTION or STAGING>_PRIVATE_KEYas not protected - Add variable for known hosts:
SSH_<servername>_KNOWN_HOSTas not protected
The known host can be found into the .ssh/known_hosts file when connecting from the server or via this command:
docker run -it --rm alpine sh -c "apk add openssh && ssh-keyscan -H -p 3232 -t ecdsa pmp-dev.pmplab.io"
Clone the repository to deploy
You have to clone the project to deploy into the specific folder for pmp'user.
- login as pmp user:
sudo -i -u pmp-production bash - prepare directory:
mkdir -p <gitlab-group> && cd <gitlab-group> - clone the project:
git clone git@gitlab.com:<gitlab-group>/<gitlab-project>.git