Continuous Integration/Deployment

TLDR - Automate early

Everytime a developer changes some code, he commits it and pushes it upstream to the repository. From there, they can create a PR for other developers to review the code. After the PR is approved, the code can be merged into develop or master branches. Without continous integration and deployment, the new code has to be manually verified for integration and manually deployed. This is generally a tedious, repeated task.

Once CI/CD is configured properly, a PR can go through the process of integration and deployment automatically with notifications sent out via Slack/PagerDuty/your tool of choice in case there is a failure.

When I worked on my projects in the past, I generally used Docker to keep the environments the same on my computer as they would be in production. I’d manually integrate the services locally on my computer. Push the code upstream. SSH into the production servers, pull the code, build the docker images and run the docker-compose files.

This was unoptimal for more reasons than just wasted developer time. Building the images locally on production could endanger the stability of the system due to unprojected CPU load. Sure you could counteract this by using a container registry and pulling from it but you ran the risk of a bad image being pulled and blocking the system until a healthly image is built (yes, I’m ignoring image versioning for the time being).

With CICD from Gitlab and Travis CI in GitHub, you no longer need to worry. The CICD pipelines integrate services automatically, push to the registry, and push the new images through commands or through Kubernetes to your production servers. No developer interaction needed for this tedious task. Best of all, you can get notified in realtime as it happens.

So why should you automate early? Well for starters, we’re only human. Impending tedious tasks like buying groceries makes us look less forward to the task and less likely to do it if we don’t have to. If you set up the pipeline right away, you will see results sooner and be more productive. So what are you waiting for!