- .credentials : fichier local centralisé pour les accès (Gitea, ISPConfig, AlpID) - .gitignore : ajout de l'entrée .credentials - README : section Credentials locaux Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
153 lines
4.6 KiB
Markdown
153 lines
4.6 KiB
Markdown
# org.alpinux.owni
|
|
|
|
Accueil des projets de l'association **Alpinux** (le LUG de Savoie).
|
|
|
|
Chaque sous-dossier est un dépôt git indépendant avec son propre remote sur Gitea.
|
|
Ce dossier racine est un espace de travail local — il n'a pas de remote git.
|
|
|
|
---
|
|
|
|
## Projets
|
|
|
|
| Dossier | Domaine | Technologie | Dépôt Gitea |
|
|
|---------|---------|-------------|-------------|
|
|
| `admin/` | admin.alpinux.org | Flask + AlpID | [alpinux-admin](https://gitea.alpinux.org/alpinux.cedrica5l/alpinux-admin) |
|
|
| `dynamic/` | dynamic.alpinux.org | Flask + AlpID | [alpinux-dynamic](https://gitea.alpinux.org/alpinux.cedrica5l/alpinux-dynamic) |
|
|
| `feedback/` | feedback.alpinux.org | à construire | [alpinux-feedback](https://gitea.alpinux.org/alpinux.cedrica5l/alpinux-feedback) |
|
|
| `home/` | alpinux.org | HTML statique | [alpinux-home](https://gitea.alpinux.org/alpinux.cedrica5l/alpinux-home) |
|
|
| `portail/` | portail.alpinux.org | en construction | [alpinux-portail](https://gitea.alpinux.org/alpinux.cedrica5l/alpinux-portail) |
|
|
| `static/` | static.alpinux.org | Flask + AlpID + CDN | [alpinux-static](https://gitea.alpinux.org/alpinux.cedrica5l/alpinux-static) |
|
|
| `wiki/` | wiki.alpinux.org | MkDocs Material | [alpinux-wiki](https://gitea.alpinux.org/alpinux.cedrica5l/alpinux-wiki) |
|
|
| `infra/` | — | Configs Apache + systemd | dépôt git local séparé |
|
|
|
|
Gitea : **https://gitea.alpinux.org/alpinux.cedrica5l**
|
|
ISPConfig : **https://owni.alpinux.org:8080**
|
|
AlpID (SSO) : **https://alpid.alpinux.org** — realm `master`
|
|
|
|
---
|
|
|
|
## Procédure de déploiement
|
|
|
|
### Principe
|
|
|
|
```
|
|
poste local → git push → Gitea → serveur (git pull + restart)
|
|
```
|
|
|
|
Les mises à jour passent exclusivement par git.
|
|
La configuration d'environnement (`.env`) est la seule opération manuelle tolérée sur le serveur.
|
|
|
|
### Flask (admin, dynamic, static)
|
|
|
|
```bash
|
|
# Poste local
|
|
git push origin main
|
|
|
|
# Serveur (via SSH ponctuel)
|
|
ssh alpinux.org
|
|
cd /opt/<service>
|
|
git pull
|
|
source venv/bin/activate && pip install -r requirements.txt
|
|
sudo systemctl restart <service>
|
|
```
|
|
|
|
### Wiki
|
|
|
|
```bash
|
|
cd wiki
|
|
mkdocs build --strict
|
|
rsync -rlcz --delete site/ alpinux.org:/var/www/wiki.alpinux.org/web/
|
|
```
|
|
|
|
### Assets CDN (static.alpinux.org)
|
|
|
|
```bash
|
|
cd static
|
|
scripts/push-assets.sh # rsync vers /var/www/clients/.../web/
|
|
```
|
|
|
|
---
|
|
|
|
## Développement local
|
|
|
|
| Projet | Commande | URL |
|
|
|--------|----------|-----|
|
|
| `wiki` | `mkdocs serve` | http://localhost:8000 |
|
|
| `dynamic` | `flask run --port 5000` | http://localhost:5000 |
|
|
| `admin` | `flask run --port 5001` | http://localhost:5001 |
|
|
| `static` | `python app/app.py` | http://localhost:5003 |
|
|
|
|
```bash
|
|
cd <projet>
|
|
python3 -m venv venv && source venv/bin/activate
|
|
pip install -r requirements.txt
|
|
cp .env.example .env && nano .env
|
|
flask run --port <port>
|
|
```
|
|
|
|
---
|
|
|
|
## Authentification AlpID
|
|
|
|
Tous les projets Flask utilisent **AlpID** (SSO Keycloak).
|
|
|
|
- Chaque projet a son propre client Keycloak (`admin`, `dynamic`, `static-cdn`, …)
|
|
- Scopes : `openid profile email`
|
|
- Autorisation : claim `groups` → sinon `ADMIN_EMAILS` → sinon tout utilisateur AlpID
|
|
- Discovery URL : `https://alpid.alpinux.org/realms/master/.well-known/openid-configuration`
|
|
|
|
---
|
|
|
|
## Credentials locaux
|
|
|
|
Le fichier **`.credentials`** (ignoré par git) centralise les accès à renseigner localement :
|
|
|
|
```
|
|
.credentials ← à compléter manuellement, jamais commité
|
|
```
|
|
|
|
Il contient : token Gitea API, accès ISPConfig, accès AlpID admin, secrets clients Keycloak.
|
|
Utiliser `source .credentials` dans un script pour charger les variables.
|
|
|
|
---
|
|
|
|
## Règle Claude Code
|
|
|
|
Lancer Claude depuis le sous-dossier du projet pour limiter le contexte :
|
|
|
|
```bash
|
|
cd ~/Projects/org.alpinux.owni/static && claude
|
|
cd ~/Projects/org.alpinux.owni/admin && claude
|
|
cd ~/Projects/org.alpinux.owni/dynamic && claude
|
|
cd ~/Projects/org.alpinux.owni/wiki && claude
|
|
```
|
|
|
|
---
|
|
|
|
## Accès SSH et rôle d'abonnelc
|
|
|
|
Alias SSH : `alpinux.org` → compte `abonnelc`.
|
|
|
|
`abonnelc` est un **compte d'administration ponctuelle**, pas un compte de service.
|
|
Son rôle se limite à :
|
|
|
|
- créer ou modifier les fichiers `.env` sur le serveur
|
|
- redémarrer un service après un `git pull`
|
|
- effectuer des opérations admin exceptionnelles
|
|
|
|
Les services tournent sous leurs propres utilisateurs système.
|
|
Les scripts ne doivent pas être couplés à `abonnelc`.
|
|
|
|
---
|
|
|
|
## Infra
|
|
|
|
`infra/` est un dépôt git local indépendant (pas de remote Gitea).
|
|
Il contient les configurations de référence pour audit et reconstruction :
|
|
|
|
```
|
|
infra/
|
|
├── conf/ → VirtualHost Apache par service
|
|
├── services/ → Units systemd
|
|
└── docs/ → Documentation déploiement par service
|
|
```
|