Initial commit: Infrastructure Git CI/CD avec Gitea, Woodpecker, PostgreSQL, Consul et Registrator
This commit is contained in:
142
docs/README.md
Normal file
142
docs/README.md
Normal file
@ -0,0 +1,142 @@
|
||||
# Documentation Infrastructure Git CI/CD
|
||||
|
||||
Cette documentation couvre l'installation, la configuration et la maintenance de l'infrastructure Git et CI/CD.
|
||||
|
||||
## Index
|
||||
|
||||
### Architecture et Installation
|
||||
|
||||
1. [Architecture](01-architecture.md) - Vue d'ensemble de l'infrastructure
|
||||
2. [Installation](02-installation.md) - Guide d'installation complet
|
||||
|
||||
### Configuration des services
|
||||
|
||||
3. [Gitea](03-configuration-gitea.md) - Serveur Git auto-heberge
|
||||
4. [Woodpecker](04-configuration-woodpecker.md) - CI/CD
|
||||
5. [PostgreSQL](05-configuration-postgresql.md) - Base de donnees
|
||||
|
||||
### Service Discovery (optionnel, mode production)
|
||||
|
||||
6. [Consul](06-configuration-consul.md) - Service discovery avec ACL
|
||||
7. [Registrator](07-configuration-registrator.md) - Auto-registration Docker avec token
|
||||
8. [Deploiement Consul](08-deploiement-consul-registrator.md) - Guide de deploiement securise
|
||||
|
||||
## Stack technique
|
||||
|
||||
| Composant | Version | Description |
|
||||
|-----------|---------|-------------|
|
||||
| Gitea | latest | Serveur Git |
|
||||
| Woodpecker | latest | CI/CD |
|
||||
| PostgreSQL | 14 | Base de donnees |
|
||||
| Consul | latest | Service discovery avec ACL |
|
||||
| Registrator | latest | Auto-registration avec token |
|
||||
|
||||
## Mode production
|
||||
|
||||
Cette infrastructure est configuree pour la production avec :
|
||||
|
||||
- **ACL Consul** : Controle d'acces active (`default_policy: deny`)
|
||||
- **Tokens separes** : Token admin et token Registrator
|
||||
- **Secrets non versionnes** : Fichiers `.env` a creer sur le serveur
|
||||
|
||||
### Fichiers de secrets (non versionnes)
|
||||
|
||||
| Fichier | Contenu |
|
||||
|---------|---------|
|
||||
| `/opt/consul/.env` | Token administrateur Consul |
|
||||
| `/opt/registrator/.env` | Token Registrator |
|
||||
|
||||
## URLs d'acces
|
||||
|
||||
| Service | URL |
|
||||
|---------|-----|
|
||||
| Gitea | http://git.syoul.fr |
|
||||
| Woodpecker | https://ci.syoul.fr |
|
||||
| Consul UI | http://[serveur]:8500 (local, token requis) |
|
||||
|
||||
## Structure des dossiers
|
||||
|
||||
```
|
||||
/opt/
|
||||
consul/
|
||||
docker-compose.yml
|
||||
env.template # Template pour .env
|
||||
.env # Token admin (a creer, non versionne)
|
||||
gitea/
|
||||
docker-compose.yml
|
||||
gitea.env
|
||||
postgres/
|
||||
docker-compose.yml
|
||||
registrator/
|
||||
docker-compose.yml
|
||||
env.template # Template pour .env
|
||||
.env # Token Registrator (a creer, non versionne)
|
||||
woodpecker/
|
||||
docker-compose.yml
|
||||
```
|
||||
|
||||
## Reseau Docker
|
||||
|
||||
Tous les services utilisent le reseau : `gitgit_syoul_fr_gitea_net`
|
||||
|
||||
## Commandes rapides
|
||||
|
||||
### Etat des services
|
||||
|
||||
```bash
|
||||
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
|
||||
```
|
||||
|
||||
### Logs d'un service
|
||||
|
||||
```bash
|
||||
docker logs -f [nom-conteneur]
|
||||
```
|
||||
|
||||
### Redemarrer un service
|
||||
|
||||
```bash
|
||||
cd /opt/[service]
|
||||
docker compose restart
|
||||
```
|
||||
|
||||
### Sauvegarder la base de donnees
|
||||
|
||||
```bash
|
||||
docker exec gitea_db pg_dump -U gitea gitea > backup_$(date +%Y%m%d).sql
|
||||
```
|
||||
|
||||
### Sauvegarder Consul
|
||||
|
||||
```bash
|
||||
export CONSUL_TOKEN="votre-token-admin"
|
||||
docker exec consul consul snapshot save /consul/data/backup.snap -token "$CONSUL_TOKEN"
|
||||
docker cp consul:/consul/data/backup.snap ./consul_backup_$(date +%Y%m%d).snap
|
||||
```
|
||||
|
||||
### Lister les services Consul
|
||||
|
||||
```bash
|
||||
export CONSUL_TOKEN="votre-token-admin"
|
||||
curl -s -H "X-Consul-Token: $CONSUL_TOKEN" http://localhost:8500/v1/catalog/services
|
||||
```
|
||||
|
||||
## Securite
|
||||
|
||||
### Bonnes pratiques appliquees
|
||||
|
||||
1. **ACL Consul** : Tout est interdit par defaut
|
||||
2. **Tokens separes** : Chaque service a son propre token
|
||||
3. **Secrets non versionnes** : Les fichiers `.env` ne sont pas dans git
|
||||
4. **Permissions fichiers** : `chmod 600` sur les fichiers `.env`
|
||||
|
||||
### A faire sur le serveur
|
||||
|
||||
- Ne pas exposer le port 8500 sur Internet
|
||||
- Configurer un firewall
|
||||
- Rotation periodique des tokens
|
||||
|
||||
## Contacts et support
|
||||
|
||||
- **Administrateur** : syoul
|
||||
- **Email** : contact@anuanua.fr
|
||||
Reference in New Issue
Block a user