Skip to content

History ​

How the infrastructure reached its current state. Each step quotes the commit that introduced it.

The steps ​

DateChangeCommitWhy
28 Oct.First API Dockerfile.dev and Dockerfile.prodci:added the dockerfile.dev filestart containerising
2 Nov.api/, web/, infra/, docs/ tree and root .gitignorechore: add base project structure and root .gitignoreset up the monorepo
2 Nov.mobile/ folder removedchore: remove mobile directorymobile comes in part 801
2 Nov.Products API + api/.gitlab-ci.ymlfeat(api): add product API and CI pipelinethe first tested sample
9 Nov.gitlab-runner rolefeat(ansible): add GitLab Runner roleinstall runners reproducibly
9 Nov.Datadog and the base role removedchore(infra): remove Datadog and base rolefocus on deployment
9 Nov.Next.js web sample, Dockerfiles, web:* jobsfeat(web): add Next.js sample, Dockerfiles and CI jobsthe second sample
10 Nov.One VM per environment, one Traefik per machinechore(ansible): split servers into dev and prod machinesisolate prod from dev
10 Nov.Runner tokens in Ansible Vaultchore(ansible): add encrypted Vault with the runner tokenno secret in plain text
13 Nov.Root .gitlab-ci.yml with includeci: add root pipeline with runner check and API and web jobsGitLab only reads the root file: the api:* and web:* jobs did not run before
14 Nov.Swarm in prod, Compose in devfeat(infra): deploy with Docker Swarm in prod and Compose in devzero downtime without scripted blue/green
14 Nov.A shell deploy runner on each serverfeat(ansible): enable Swarm and add a deploy runner on each serverdeploy without an SSH key
14 Nov.deploy-dev and deploy-prod jobsci: deploy dev and prod automaticallydeployment without intervention
14-15 Nov.api:build and web:build on every push to develop and mainci(api): build the API image on every develop and main merge, ci(web): …see below
15 Nov.chown appuser /app in the API prod imagefix(api): let appuser write the static files in the prod imagethe prod API crashed at startup
16 Nov.Add form, delete, new web stylefeat(web): restyle the page and manage products from ita more representative sample

Building every time ​

At first, api:build and web:build only ran if their folder had changed. But deploy-prod runs both images with the commit SHA. A commit that only touched the web would therefore have had no api:<sha> image, and the deployment would have failed with manifest unknown.

The fix: build both images on every push to develop and main. It takes a bit longer, but every main commit always has its two images.

What was planned and changed ​

Planned in the task splitDone in the endPage
A single VPS for dev and prodtwo VMsEnvironments
Blue/green behind TraefikSwarm start-first + rollbackZero-downtime deployment
Deployment over SSH from the pipelinea shell runner on each serverRunners
SSH hardening and fail2ban in AnsibleUFW firewall onlyLimits
gitleaks jobnot yetLimits
Datadog monitoringremovedTechnical choices