# 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) | | `infra/` | — | Configs Apache + systemd | dépôt git local séparé | Le wiki (`wiki.alpinux.org`, dépôt [alpinux-wiki](https://gitea.alpinux.org/alpinux.cedrica5l/alpinux-wiki)) a sa propre place : **`~/Projects/alpinux.wiki`**. Il se déploie tout seul et n'a rien à partager avec les applications Flask ci-dessus. 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 ### Vue d'ensemble | Projet | Méthode | Commande | |--------|---------|----------| | `home` | git pull sur serveur | `ssh alpinux.org "cd && git pull"` | | `admin` | rsync local + restart | `cd admin && ./scripts/deploy.sh` | | `dynamic` | rsync local + restart | `cd dynamic && ./scripts/deploy.sh` | | `static` (app) | rsync local + restart | `cd static && scripts/deploy-app.sh` | | `static` (assets) | rsync local | `cd static && scripts/push-assets.sh` | | `wiki` | automatique | `git push` depuis `~/Projects/alpinux.wiki` | Dans tous les cas : versionner avec `git push` **avant** de déployer. ### Flask — admin et dynamic ```bash # 1. Poste local git push origin main # 2. Déployer (rsync depuis le dépôt local + restart service) cd admin # ou dynamic ./scripts/deploy.sh ``` ### static.alpinux.org — app Flask ```bash # 1. Poste local git push origin main # 2. Déployer (rsync depuis le dépôt local + restart service) cd static scripts/deploy-app.sh ``` ### static.alpinux.org — assets CDN ```bash cd static scripts/push-assets.sh # rsync logo/, wiki/, stats/, error/ → web root ISPConfig ``` ### Wiki Rien à faire : un webhook Gitea construit et met en ligne à chaque push sur `main`. Voir https://wiki.alpinux.org/technique/deploiement-wiki/ --- ## Développement local | Projet | Commande | URL | |--------|----------|-----| | `dynamic` | `flask run --port 5001` | http://localhost:5001 | | `admin` | `flask run --port 5002` | http://localhost:5002 | | `static` | `python app/app.py` | http://localhost:5003 | ```bash cd python3 -m venv venv && source venv/bin/activate pip install -r requirements.txt cp .env.example .env && nano .env flask run --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/alpinux.wiki && claude ``` --- ## Comptes personnels vs comptes de service Alias SSH : `alpinux.org` → compte `abonnelc`. ### Règle absolue Un compte personnel (`abonnelc` ou tout autre) ne doit jouer **aucun rôle dans le fonctionnement à long terme** des services : - pas `User=` dans un unit systemd - pas propriétaire des fichiers de l'app ou des logs - pas dans la liste des groupes dont dépend un service en production - pas référencé dans un `chown`, `setfacl`, ou cron de production Si un service dépend d'un compte personnel, sa disparition (départ, suppression du compte, changement de login) fait tomber le service en production. ### Rôle d'abonnelc `abonnelc` est un **compte d'administration ponctuelle**, limité à : - créer ou modifier les fichiers `.env` sur le serveur - redémarrer un service après un déploiement - effectuer des opérations admin exceptionnelles ### Comptes de service Chaque service tourne sous son propre utilisateur système dédié (ex. `static-cdn` pour `static-cdn.service`). C'est ce compte qui possède les fichiers, les logs, et les droits nécessaires — pas `abonnelc`. --- ## Serveur | | | |---|---| | **Hostname** | `owni.alpinux.org` | | **OS** | Debian 12 (bookworm) | | **IPv4** | `51.91.79.148` | | **IPv6** | `2001:41d0:404:200::3f85/128` | | **Passerelle IPv6** | `2001:41d0:404:200::1` | | **SSH** | `ssh alpinux.org` (alias → `abonnelc@owni.alpinux.org`) | Config IPv6 persistante : `/etc/network/interfaces.d/60-ipv6.cfg` Cloud-init réseau désactivé : `/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg` --- ## 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 ``` ne pas mentionner "sonnet" ou "claude"