Files
infrastructure/DEPLOYMENT.md
2025-12-23 20:11:36 +01:00

1.9 KiB

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

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

# 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

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 :

# 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