1.9 KiB
1.9 KiB
Guide de deploiement
Premiere fois : Creer le depot sur Gitea
- Se connecter a Gitea : http://git.syoul.fr
- Creer un nouveau depot :
- Nom :
infrastructure - Visibilite : Prive (recommandee)
- Ne pas initialiser avec README, .gitignore, etc.
- Nom :
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
- Modifier localement : Faire les changements sur votre machine
- Commit :
git add . && git commit -m "Description" - Push :
git push origin main - Sur le serveur :
cd /opt/infrastructure && git pull