Ajout guide de deploiement

This commit is contained in:
2025-12-23 20:11:36 +01:00
parent de02fb28ca
commit 4320251b3c

91
DEPLOYMENT.md Normal file
View File

@ -0,0 +1,91 @@
# Guide de deploiement
## Premiere fois : Creer le depot sur Gitea
1. Se connecter a Gitea : http://git.syoul.fr
2. Creer un nouveau depot :
- Nom : `infrastructure`
- Visibilite : Prive (recommandee)
- Ne pas initialiser avec README, .gitignore, etc.
## Pousser le code sur Gitea
```bash
cd /home/syoul/git.syoul.fr
# Verifier le remote
git remote -v
# Pousser sur Gitea
git push -u origin main
```
## Sur le serveur : Cloner le depot
```bash
# Se connecter au serveur
ssh portainer2
# Cloner dans /opt
cd /opt
git clone git@git.syoul.fr:syoul/infrastructure.git
# Ou si vous preferez un autre nom
git clone git@git.syoul.fr:syoul/infrastructure.git infrastructure
# Creer les fichiers secrets
cd infrastructure
cp consul/env.template consul/.env
cp registrator/env.template registrator/.env
cp gitea/gitea.env.template gitea/gitea.env # Si vous creez un template
# Editer ces fichiers avec les vraies valeurs
nano consul/.env
nano registrator/.env
nano gitea/gitea.env
```
## Mise a jour sur le serveur
```bash
cd /opt/infrastructure
git pull
# Redemarrer les services modifies si necessaire
cd consul && docker compose up -d
cd ../registrator && docker compose up -d
# etc.
```
## Structure sur le serveur
```
/opt/
infrastructure/ # Clone du repo git
consul/
docs/
gitea/
postgres/
registrator/
woodpecker/
```
Ou avec des symlinks :
```bash
# Creer des symlinks depuis /opt/[service] vers /opt/infrastructure/[service]
cd /opt
ln -s infrastructure/consul consul
ln -s infrastructure/gitea gitea
ln -s infrastructure/postgres postgres
ln -s infrastructure/registrator registrator
ln -s infrastructure/woodpecker woodpecker
```
## Workflow de travail
1. **Modifier localement** : Faire les changements sur votre machine
2. **Commit** : `git add . && git commit -m "Description"`
3. **Push** : `git push origin main`
4. **Sur le serveur** : `cd /opt/infrastructure && git pull`