112 lines
4.7 KiB
Markdown
112 lines
4.7 KiB
Markdown
# Xpeditis 2.0 — Déploiement Production sur Hetzner Cloud
|
||
|
||
> Documentation complète de bout en bout : du choix des serveurs au déploiement production
|
||
> Stack : k3s (Kubernetes léger) + Hetzner Object Storage (S3) + PostgreSQL + Redis
|
||
|
||
---
|
||
|
||
## Pourquoi ce guide
|
||
|
||
Ce guide couvre le déploiement de Xpeditis sur **Hetzner Cloud** avec **k3s** (Kubernetes léger), de la création du compte Hetzner jusqu'à la surveillance en production. C'est l'option la plus économique (€65-450/mois vs $270-5000 sur AWS) tout en restant production-grade.
|
||
|
||
**Ce que vous obtiendrez en suivant ce guide :**
|
||
- Cluster Kubernetes k3s sur Hetzner avec autoscaling
|
||
- Backend NestJS et Frontend Next.js déployés en HA
|
||
- PostgreSQL managé (Neon.tech) ou self-hosted selon le budget
|
||
- Redis (Upstash) ou self-hosted
|
||
- Hetzner Object Storage en remplacement de MinIO (zéro changement de code)
|
||
- TLS automatique via Let's Encrypt + Cloudflare
|
||
- CI/CD avec GitHub Actions
|
||
- Monitoring avec Prometheus + Grafana
|
||
- Backups automatisés vers Object Storage
|
||
- Runbooks d'opérations et de troubleshooting
|
||
|
||
---
|
||
|
||
## Vue d'ensemble des fichiers
|
||
|
||
| # | Fichier | Contenu | Temps estimé |
|
||
|---|---|---|---|
|
||
| — | **README.md** | Ce fichier — index et quickstart | — |
|
||
| 01 | [Architecture](./01-architecture.md) | Diagrammes, composants, flux réseau | 15 min lecture |
|
||
| 02 | [Prérequis](./02-prerequisites.md) | Outils, comptes, SSH, DNS | 30-60 min setup |
|
||
| 03 | [Setup Hetzner](./03-hetzner-setup.md) | Compte, API token, réseau, firewall | 20 min |
|
||
| 04 | [Choix des serveurs](./04-server-selection.md) | Sizing par palier, ARM vs x86 | 10 min lecture |
|
||
| 05 | [Cluster k3s](./05-k3s-cluster.md) | **Installation complète du cluster** | 30-45 min |
|
||
| 06 | [Stockage S3](./06-storage-s3.md) | Hetzner Object Storage, migration MinIO | 15 min |
|
||
| 07 | [Base de données](./07-database-postgresql.md) | PostgreSQL (Neon ou self-hosted) | 20-60 min |
|
||
| 08 | [Redis](./08-redis-setup.md) | Redis (Upstash ou self-hosted) | 15-30 min |
|
||
| 09 | [Manifests Kubernetes](./09-kubernetes-manifests.md) | **Tous les YAMLs complets** | 30 min |
|
||
| 10 | [Ingress + TLS](./10-ingress-tls-cloudflare.md) | Traefik, cert-manager, Cloudflare | 30 min |
|
||
| 11 | [CI/CD GitHub Actions](./11-cicd-github-actions.md) | Pipeline build + deploy complet | 30 min |
|
||
| 12 | [Monitoring](./12-monitoring-alerting.md) | Prometheus, Grafana, Loki, alertes | 45 min |
|
||
| 13 | [Backups](./13-backup-disaster-recovery.md) | Stratégie backup + runbook DR | 20 min |
|
||
| 14 | [Sécurité](./14-security-hardening.md) | Hardening, network policies, WAF | 30 min |
|
||
| 15 | [Opérations](./15-operations-scaling.md) | Scaling, upgrades, troubleshooting | Référence |
|
||
|
||
**Temps total de déploiement (première fois) : 4-6 heures**
|
||
|
||
---
|
||
|
||
## Quickstart — Du zéro à la production
|
||
|
||
Si vous avez déjà tous les prérequis, voici le chemin minimum :
|
||
|
||
```bash
|
||
# 1. Installer hetzner-k3s
|
||
brew install vitobotta/tap/hetzner-k3s
|
||
|
||
# 2. Configurer (voir 03-hetzner-setup.md)
|
||
export HCLOUD_TOKEN=<votre_token>
|
||
|
||
# 3. Créer le cluster (voir 05-k3s-cluster.md)
|
||
hetzner-k3s create --config cluster.yaml
|
||
|
||
# 4. Configurer kubectl
|
||
export KUBECONFIG=~/.kube/kubeconfig-xpeditis-prod
|
||
|
||
# 5. Créer les namespaces et secrets
|
||
kubectl apply -f k8s/namespaces.yaml
|
||
kubectl apply -f k8s/secrets.yaml # après avoir rempli les valeurs
|
||
|
||
# 6. Déployer l'application
|
||
kubectl apply -f k8s/
|
||
|
||
# 7. Vérifier
|
||
kubectl get pods -n xpeditis-prod
|
||
```
|
||
|
||
---
|
||
|
||
## Coûts récapitulatifs
|
||
|
||
| Palier | Config Hetzner | Coût/mois (post 1er avril 2026) |
|
||
|---|---|---|
|
||
| **MVP (100 users)** | 1×CX22 + 2×CX32 | **€36** (+ €19 Neon.tech + €0 Upstash free) = **~€55** |
|
||
| **Croissance (1 000 users)** | 1×CX22 + 3×CX42 | **€91** (+ DB self-hosted) = **~€110** |
|
||
| **Scale (10 000 users)** | 3×CX22 + 6×CX52 | **€340** (+ DB self-hosted HA) = **~€390** |
|
||
|
||
---
|
||
|
||
## Architecture résumée
|
||
|
||
```
|
||
Internet → Cloudflare (WAF + CDN) → Hetzner LB → k3s Ingress (Traefik)
|
||
├── api.xpeditis.com → NestJS pods
|
||
└── app.xpeditis.com → Next.js pods
|
||
↓
|
||
PostgreSQL (Neon / self-hosted)
|
||
Redis (Upstash / self-hosted)
|
||
Hetzner Object Storage (S3-compatible)
|
||
```
|
||
|
||
---
|
||
|
||
## Conventions utilisées dans ce guide
|
||
|
||
- `<VALEUR>` — à remplacer par votre valeur
|
||
- `xpeditis-prod` — namespace Kubernetes de production
|
||
- `fsn1` — région Hetzner par défaut (Falkenstein, Allemagne)
|
||
- Les commandes `kubectl` supposent `KUBECONFIG` déjà configuré
|
||
- Les prix sont en EUR, basés sur les tarifs Hetzner post 1er avril 2026
|