Gitlab CI/CD - user and permissions best practices

Viewed 384

I am trying to find some guide or documentation that discusses best practices for setting up gitlab CI/CD to auto deploy a web server (nginx) / Centos or any Linux. Setting up the CI/CD as user root is easy, but i don't like the idea of having a root key in gitlab.

If i create a 'gitlab' user and assign it to the same group as NGINX, I am stuck because i can't CHOWN -R nginx to the folder and files once all the files deploy. So what are my options here? I suppose i could add the ssh key as user NGINX, but seems odd.

Are there any decent ways to do this?

1 Answers

Ideally, you would:

That way, no chown to do, and the keys are managed in Ansible, which knows how to connect to the target machines.

Related