Aller au contenu

Helloworld stack prod : Sandbox for a pseudo production stack

The idea of this repo is to :

  • try, train on new softwares,
  • practice on Docker/k8s,
  • apply best practices.

The final goal is to be the closest possible of what would be a complete production stack, meaning that you'll have :

  • A REST api with an HTTP server,
  • A monitored SQL database,
  • A reverse proxy handling HTTPS,
  • Some api monitoring,
  • An authentication service.

Obviously you should have proper testing and deployment on a VPS via CI/CD.

Right now the four first points are implemented in an early stage. We have selected :

Roadmap

  1. Test Caddy as reverse proxy.
  2. Rework of the api backend and use the Web-Queue-Worker architecture.
  3. Implement IAM with Fief or Keycloak (try both).
  4. ELK Stack for monitoring, or Jaeger.
  5. Prometheus + Grafana ?

Requirements :

Whether you work locally in "dev mode", or that this stack is deployed on a VPS, you'll need Docker and docker compose.

Docker

Docker-compose

VPS

If you want to deploy this stack on a vps, you'll need to rent it, you can rent one for example on DigitalOcean, for around 5 euros/month.

Remark

If you have an old laptop, why not turn it into you own little Ubuntu Server and try deployement on it rtather than a vps ?

Environement variables needed to be set

Traefik Dashboard :

  • USERNAME
  • HASHED_PASSWORD

PostgreSQl + FastaPI connection to DB :

  • DB_USERNAME
  • DB_PASSWORD

PgAdmin db monitoring :

  • PGADMIN_DEFAULT_EMAIL
  • HASHED_PGADMIN_DEFAULT_EMAIL

Sources

Here are some sources that might be useful.

Control startup and shutdown order in Compose

  • https://docs.docker.com/compose/startup-order/
  • https://github.com/jasonsychau/RelayAndContainers
  • https://github.com/vishnubob/wait-for-it
  • https://github.com/Eficode/wait-for