Automated rapid deployment of applications to your host with Docker and GitLab
As you may already know, you can use Gitlab CI to prepare artifacts and actually deploy code to some hosting, Cloud provider or your private server.
However, usually, to do this you need to keep authentication information in GitLab.com and provide a way to deploy from outside.
But thanks to GitLab CI private runners you can do it from inside.
Here is the example of config for private GitLab CI runner:
https://gitlab.com/wizecore/gitlab-deployer
After setup you will have 2 docker containers:
- GitLab CI runner (deployer), which listens to pipeline on GitLab
- Application container(s) if you deploy locally
Create gitlab-runner container
Install docker on your host. Clone https://gitlab.com/wizecore/gitlab-deployer and follow instruction in README.
Register GitLab runner container
Assign this runner yo your project so it will be used to build your project. Disable using shared runners.
Create .gitlab-ci.yml script
Create CI configuration using https://docs.gitlab.com/ee/ci/yaml/ documentation.
Launch and redeploy on every change
Where is a lot of benefits of using private runners:
- You can use advanced CI/CD commands (docker containers)
- You can actually deploy during runner build
- You can use security sensitive environment variables
- You are not limited by free hours of GitLab Community Edition limitation