Help Me Understand Containerisation (Docker) – Part 2

This is part 2, I'd recommend checking out Part 1 of Help Me Understand Containerisation (Docker)

We have gone over the development workflow - in a django context - and it was quite a hefty chunk. Now let us look at continuous integration with gitlab and containers.

The Container CI Workflow

We are going to use gitlab for Continuous Integration. Gitlab is closely aligned with a container based development workflow.

jenkins-analog-player-in-containerised-world

A: I use gitlab for my ci .. so that part will depend on gitlab ..

A: but containers do make that easy .. cause you just need to build the container .. and then you can do everything inside the container

gitlab-ci-containerisation

Let's dive into container based CI with gitlab:

continuous-integration-discussion-docker

For Gitlab pipelines you should read the docs on How Gitlab CI/CD works? and basic ci/cd workflow.

The New Trend in Continuous Integration

  1. Create an application image.
  2. Run tests against the created image.
  3. Push image to a remote registry.
  4. Deploy to a server from the pushed image.

 

Importantly you will need to enable the container registry if you have a private gitlab instance, you can do that with the following admin documentation for enabling the container registry.

Step 1 is to make a .gitlab-ci.yml file.

 

The Container Deployment

Where should you DB and session storage live?

What is the backup strategy?

Lets do some autoscaling.

Docker Compose docs for production gives some good tips on deploying to production.