2. Tools used
GitLab:- To manage code and versioning
Docker:- To build ship and run containers
Gitlab Runner:- For ci
Ansible:- For cicd provisioning instance
4. Workflow
Gitlab ⇒ Gitlab-Runner => build docker image => Ansible
Developers pushes their code to repo.
Gitlab-Runner build job then triggers via webhook and by that application is
packaged into docker image and pushed to registry.
And Gitlab-Runner build job runs Ansible playbook which will provision server
according to Dev/stage/production environment with its dependencies and
requirements.
And after successful/unsuccessful build notification is send to team.
5. Gitlab-Runner build jobs examples
Running shell commands
Taking pull from git
Like installing dependencies via composer install
Cleaning Drupal caches via drush cr
Updating database via drush updb
Importing configs via drush cim and again clearing caches via drush cr
6. Running Ansible playbook via Gitlab-Runner
Benefits of running Ansible playbook is everything can be managed
from one place i.e playbook
Means one can clone code from repo
Installing dependencies and package app into containers and deploy it
on server.
When compared to Gitlab-runner shell commands, In playbook the shell
commands will also be executed by the playbook itself so all the things
like installing dependencies, clearing caches, updating database and
importing configs can be done easily.