summaryrefslogtreecommitdiff
path: root/SCHEMA_CENTRAL.md
blob: 49e546368cb6f26ba55c6212e99c86e00ff39a08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# Schema Central - Infrastructure Araucaria

> Derniere mise a jour : 2026-02-23
> Domaine : arauco.online | Reseau : 192.168.99.0/24

## Vue d'ensemble

```mermaid
flowchart TB
    subgraph external ["Acces Externe"]
        ddns["DDNS Namecheap<br/>arauco.online"]
        router["Routeur Swisscom<br/>Gateway 192.168.99.1"]
    end

    subgraph lan ["Reseau LAN 192.168.99.0/24"]

        subgraph araucaria ["araucaria - Hote KVM<br/>eth0/br0: .50 | eth1: .51"]
            dnsmasq["dnsmasq :53<br/>DNS local"]
            kvm["KVM / virsh<br/>libvirt"]
            ssh_host["SSH :1220"]
            lvm["LVM vgarauco0<br/>5.31 TB total"]
        end

        subgraph chillka ["chillka - .55<br/>2 vCPU | 2 GB RAM | 500 GB"]
            gitea["Gitea :3000<br/>git.arauco.online"]
            samba["Samba :139/445"]
            http_chillka["HTTP :80"]
        end

        subgraph npagnun ["npagnun - .35<br/>2 vCPU | 8 GB RAM | 200 GB"]
            keycloak["Keycloak :8080/8443<br/>keycloak.arauco.local"]
            kc_mgmt["KC Management :9000"]
            pg_kc["PostgreSQL 15<br/>:5432 interne"]
        end

        subgraph huitral ["huitral - .22<br/>2 vCPU | 8 GB RAM | 300 GB"]
            ha_h["Home Assistant<br/>reseau host"]
            medusa_be["Medusa Backend :9000"]
            medusa_sf["Medusa Storefront :8000"]
            redis_h["Redis :6379"]
            vikunja_h["Vikunja :3456"]
            pg_vik["PostgreSQL 16<br/>:5432 interne"]
            dertopogo["der-topogo :3000"]
            nginx_test["nginx test :8080"]
        end

        subgraph huinca_srv ["huinca - .66<br/>2 vCPU | 4 GB RAM | 70 GB"]
            postfix_h["Postfix :25/:465/:587"]
            dovecot_h["Dovecot :993"]
            dkim_h["OpenDKIM + SpamAssassin"]
        end

        subgraph lautaro ["lautaro - .108 - Raspberry Pi<br/>Non accessible"]
            ha_l["Home Assistant :8123"]
        end

        subgraph dormant ["Volumes LVM dormants"]
            lemolemo["lemolemo .33<br/>10 GB"]
            toki["toki .44<br/>10 GB"]
            copihue["copihue .11"]
            kura["kura<br/>5 GB"]
        end
    end

    ddns -->|"arauco.online"| router
    router -->|"NAT 2222 -> :1220"| ssh_host
    router --- lan

    kvm -->|"virsh / br0"| chillka
    kvm -->|"virsh / br0"| npagnun
    kvm -->|"virsh / br0"| huitral
    kvm -->|"virsh / br0"| huinca_srv
    lvm -.->|"vgarauco0-*"| dormant

    dnsmasq -.->|"DNS"| chillka
    dnsmasq -.->|"DNS"| npagnun
    dnsmasq -.->|"DNS"| huitral
    dnsmasq -.->|"DNS"| huinca_srv
    dnsmasq -.->|"DNS"| lautaro

    keycloak -->|"JDBC"| pg_kc
    medusa_be --> redis_h
    vikunja_h --> pg_vik
```

---

## Index des schemas detailles

### Reseau

| Schema | Fichier | Description |
|--------|---------|-------------|
| Topologie reseau | [topologie_reseau.mmd](micro/reseau/topologie_reseau.mmd) | IPs, interfaces, DNS, routage, acces externe |
| Caddy Reverse Proxy | [caddy_reverse_proxy.mmd](micro/reseau/caddy_reverse_proxy.mmd) | Reverse proxy Caddy, TLS Let's Encrypt, routes sous-domaines |

### Machines virtuelles

| Schema | Fichier | Description |
|--------|---------|-------------|
| araucaria (host) | [araucaria_host.mmd](micro/vms/araucaria_host.mmd) | Hote KVM, interfaces, LVM, services, VMs gerees |
| npagnun | [npagnun.mmd](micro/vms/npagnun.mmd) | Ubuntu 24.04, Keycloak + PostgreSQL (Docker) |
| huitral | [huitral.mmd](micro/vms/huitral.mmd) | Debian 12, Docker: Medusa, Vikunja, HA, der-topogo, nginx |
| huinca | [huinca.mmd](micro/vms/huinca.mmd) | Ubuntu 24.04, serveur mail natif: Postfix, Dovecot, OpenDKIM, SpamAssassin |
| chillka | [chillka.mmd](micro/vms/chillka.mmd) | Gitea, Samba, HTTP, SSH |
| lautaro | [lautaro.mmd](micro/vms/lautaro.mmd) | Raspberry Pi, Home Assistant (non accessible) |

### IAM / Identite

| Schema | Fichier | Description |
|--------|---------|-------------|
| Keycloak IAM | [keycloak_iam.mmd](micro/iam/keycloak_iam.mmd) | OIDC, realms, clients, RBAC, flux d'authentification |
| Auth Chiruca | [chiruca_auth.mmd](micro/iam/chiruca_auth.mmd) | Flux auth realm chiruca, Google IdP, clients OIDC (HA, Vikunja, der-topogo) |

### Applications

| Schema | Fichier | Description |
|--------|---------|-------------|
| Korradi.dev | [korradi_stack.mmd](micro/applications/korradi_stack.mmd) | Stack applicatif: Next.js, Fastify, Widget SDK, Traefik |
| Home Assistant | [homeassistant.mmd](micro/applications/homeassistant.mmd) | Domotique, OIDC Keycloak, cameras, integrations HACS |
| Vikunja | [vikunja.mmd](micro/applications/vikunja.mmd) | Gestion taches, OIDC Keycloak, CalDAV, integration HA |
| Lucien-sens-bon | [lucien_sens_bon.mmd](micro/applications/lucien_sens_bon.mmd) | E-commerce MedusaJS, auth JWT/Cookie native |
| Der-topogo | [der_topogo.mmd](micro/applications/der_topogo.mmd) | Site consulting, Payload CMS, OIDC Keycloak planifie |

### Flux AuthN/AuthZ (diagrammes de sequence)

| Schema | Fichier | Description |
|--------|---------|-------------|
| Auth Lucien-sens-bon | [lsb_auth_seq.mmd](micro/flux/lsb_auth_seq.mmd) | Flux JWT client + cookie admin, auth native MedusaJS |
| Auth Der-topogo | [dt_auth_seq.mmd](micro/flux/dt_auth_seq.mmd) | Flux Payload CMS natif + OIDC Keycloak planifie |
| Auth Home Assistant | [ha_auth_seq.mmd](micro/flux/ha_auth_seq.mmd) | Flux OIDC Keycloak via HACS, Google IdP, code unique |
| Auth Vikunja | [vk_auth_seq.mmd](micro/flux/vk_auth_seq.mmd) | Flux OIDC Keycloak natif, auto-creation compte, CalDAV |

---

## Visualisation web

Le serveur local permet de naviguer et visualiser tous les schemas dans le navigateur :

```bash
cd schemas/server
npm install
npm start
# -> http://localhost:3030
```

---

## Ajouter un nouveau schema

1. Creer un fichier `.mmd` dans le sous-dossier appropriate (`micro/vms/`, `micro/iam/`, etc.)
2. Le serveur web le detectera automatiquement (hot-reload)
3. Mettre a jour ce fichier `SCHEMA_CENTRAL.md` pour ajouter une entree dans l'index

### Convention de nommage

- `micro/vms/<nom_vm>.mmd` pour une machine virtuelle
- `micro/reseau/<sujet>.mmd` pour le reseau
- `micro/iam/<sujet>.mmd` pour l'identite / acces
- `micro/applications/<nom_app>.mmd` pour une application
- `micro/flux/<app>_auth_seq.mmd` pour un diagramme de sequence auth

---

## Workflow Git

Le depot est heberge sur Gitea (`git.arauco.online`) avec une branche principale `main`.

### Recuperer les changements du serveur

| Commande | Telecharge | Integre dans la branche locale |
|----------|------------|-------------------------------|
| `git fetch origin` | Oui | Non |
| `git pull origin main` | Oui | Oui |

- **`git fetch`** : recupere les commits distants sans modifier la branche locale. Permet d'inspecter avant d'integrer.
- **`git pull`** : equivalent a `git fetch` + `git merge`. Integre directement.

### Verifier l'etat de synchronisation

```bash
git fetch origin && git status
```

Messages possibles :

| Message | Signification |
|---------|--------------|
| `up to date with 'origin/main'` | Tout est synchronise |
| `ahead of 'origin/main' by X commits` | Commits locaux non pousses |
| `behind 'origin/main' by X commits` | Le serveur a des commits a recuperer |
| `have diverged` | Les deux cotes ont des commits differents |

> `git fetch` avant `git status` est necessaire pour avoir l'info a jour du serveur.

### Comparer apres un fetch

```bash
git log HEAD..origin/main              # commits en avance sur le serveur
git diff HEAD..origin/main             # diff complet
git diff --name-only HEAD..origin/main # fichiers modifies uniquement
git diff --stat HEAD..origin/main      # resume insertions/suppressions
git diff HEAD..origin/main -- <fichier> # diff sur un fichier specifique
```

### Integrer les changements

| Commande | Effet |
|----------|-------|
| `git merge origin/main` | Cree un commit de fusion, historique fidele avec branches visibles |
| `git rebase origin/main` | Rejoue les commits locaux par-dessus origin/main, historique lineaire |

**Regle** : `rebase` pour mettre a jour une branche locale non poussee, `merge` pour integrer du travail deja partage/publie. Ne jamais rebase des commits deja pousses.

---

## Donnees de reference

| Machine | IP | RAM | Stockage LVM | Etat |
|---------|-----|-----|-------------|------|
| araucaria (host) | .50 (br0), .51 (eth1) | - | vgarauco0 5.31 TB | actif |
| chillka | .55 | 2 GB | 500 GB | running |
| npagnun | .35 | 8 GB | 200 GB (vol nudo) | running |
| huitral | .22 | 8 GB | 300 GB | running |
| lautaro | .108 | - | - | non accessible |
| lemolemo | .33 | - | 10 GB | dormant |
| toki | .44 | - | 10 GB | dormant |
| copihue | .11 | - | - | dormant |
| huinca | .66 | 4 GB | 70 GB | running |
| kura | - | - | 5 GB | dormant |