Skip to content
/ spe-clo5 Public

School - Ansible, gitlab, monitoring and CI/CD. Production-like infrastructure with CI/CD, metrics and automated deployments

Notifications You must be signed in to change notification settings

tbobm/spe-clo5

Repository files navigation

SPE-CLO5

A special note to ETNA's students is available at the bottom of the README.

Goal

Setup a CI/CD infrastructure with the following components:

  • Gitlab
  • Gitlab-runner
  • Docker in swarm mode
  • A monitoring stack (supposedly a TICK stack, but prometheus/grafana/node_exporter will be our go-to)
  • Traefik

The code itself will be hosted on the private gitlab server and will trigger unit test and fonctionnal tests upon push. If the code is validated, it will trigger a blue/green deployment in "production"

Ansible roles

Docker-related

Gitlab-related

The registration token is located in gitlab.yml. In order to use it in the gitlab_runner role, provide the flag -e @vars/gitlab.yml and decrypt it using the ansible-vault secret while executing the playbook.

  • install_gitlab In order to configure the users, you will need to provide a gitlab_token and a list of users. ansible-playbook -i inventory.yml -e @vars/users.yml gitlab.yml
  • gitlab_runner

Utility roles

Graphs

Target technical infrastructure graph

Traefik routing (shortened)

source:

graph LR
  A[Client]-->|HTTP request| C{traefik}
  C -->|user-manager.beta.clo5.local/| D{staging user-manager}
  subgraph staging D -->|connect to corresponding database|DB[staging db user-manager]
    D -->|contact other service|SE[staging establishment manager]
  end
  C -->|user-manager.clo5.local/| E[production user-manager]
  subgraph prod
    E -->|connect to corresponding database|DP[production db user-manager]
    E -->|contact other service|PE[production establishment manager]
  end
  C -->|user-manager.clo5.local/blue| F[blue production user-manager]
  subgraph prod-blue
    F -->|connect to corresponding database|DBB[blue production db user-manager]
    F -->|contact other service|BE[blue production establishment manager]
  end
  C -->|grafana.clo5.local| G[grafana]
  subgraph monitoring
    G -->|connect to prometheus|P[prometheus]
    P -->|scrape node_exporters|NEA[node_exporter A]
    P -->|scrape node_exporters|NEB[node_exporter B]
    P -->|scrape node_exporters|NEC[node_exporter C]
    P -->|scrape cadvisors|CA[cadvisor A]
    P -->|scrape cadvisors|CB[cadvisor B]
    P -->|scrape cadvisors|CC[cadvisor C]
  end

Current technical infrastructure graph

Traefik routing

source:

graph LR
  A[Client]-->|HTTP request| C{traefik}
  C -->|user-manager.beta.clo5.local/| D{staging user-manager}
  subgraph staging
    D -->|connect to shared database|DB[staging db]
  end
  C -->|grafana.clo5.local| G[grafana]
  subgraph monitoring
    G -->|connect to prometheus|P[prometheus]
    P -->|scrape node_exporters|NEA[node_exporter A]
    P -->|scrape node_exporters|NEB[node_exporter B]
    P -->|scrape node_exporters|NEC[node_exporter C]
    P -->|scrape cadvisors|CA[cadvisor A]
    P -->|scrape cadvisors|CB[cadvisor B]
    P -->|scrape cadvisors|CC[cadvisor C]
    P -->|scrape gitlab-runners|GA[gitlab-runner A]
    P -->|scrape gitlab-runners|GB[gitlab-runner B]
    P -->|scrape gitlab-runners|GC[gitlab-runner C]
  end

Special note

If you ended up finding this public project, congrats and welcome !

First of all, feel free to leave a ⭐ if you liked my implementation.

One tiny point to keep in mind if you're currently doing the SPE-CLO5 module: I am still a teacher at ETNA's and I might end up reviewing your project. The School's staff is aware of this repository and I don't want any of you to get into trouble because you were a bit curious ! Think twice before "getting inspired" by the implementation made by someone that might end up grading your work. 😉

About

School - Ansible, gitlab, monitoring and CI/CD. Production-like infrastructure with CI/CD, metrics and automated deployments

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published