docs(minio): add bucket naming convention
This commit is contained in:
74
stabify-wiki/09-storage-minio.md
Normal file
74
stabify-wiki/09-storage-minio.md
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
# MinIO (S3 Object Storage) Setup
|
||||||
|
|
||||||
|
MinIO wird als lokaler S3-kompatibler Object Storage in Kubernetes betrieben. Es dient als Speicherziel für Anwendungen wie Outline, Backups und Medien-Uploads.
|
||||||
|
|
||||||
|
## 1. Architektur & Storage
|
||||||
|
MinIO läuft als einzelner Pod (`Deployment` mit Replicas=1) und nutzt einen Kubernetes `PersistentVolumeClaim` (PVC).
|
||||||
|
|
||||||
|
- **PVC Größe:** 50Gi (Initial)
|
||||||
|
- **Storage Class:** `local-path` (Standard K3s)
|
||||||
|
- **Physischer Speicher:** Die Daten landen auf der VM (`vm-k3s-master-400`) im Verzeichnis `/var/lib/rancher/k3s/storage/`.
|
||||||
|
|
||||||
|
### Erweiterung (Proxmox)
|
||||||
|
Wenn der Speicherplatz der VM zur Neige geht:
|
||||||
|
1. In Proxmox die VM-Disk vergrößern (oder eine zweite Disk hinzufügen).
|
||||||
|
2. Im Linux-Gast (`vm-k3s-master-400`) das Dateisystem erweitern (`resize2fs`).
|
||||||
|
3. Die Daten für MinIO wachsen automatisch mit dem verfügbaren Platz auf der Partition.
|
||||||
|
|
||||||
|
## 2. Vault Secrets
|
||||||
|
MinIO benötigt einen Root User und ein Passwort. Diese werden in Vault gespeichert.
|
||||||
|
|
||||||
|
**Pfad:** `secret/apps/minio`
|
||||||
|
|
||||||
|
| Key | Value | Beschreibung |
|
||||||
|
| :--- | :--- | :--- |
|
||||||
|
| `root_user` | `admin` | Der Benutzername für den Admin-Login. |
|
||||||
|
| `root_password` | `...` | Ein starkes, generiertes Passwort. |
|
||||||
|
|
||||||
|
### Vault Setup Befehle
|
||||||
|
```bash
|
||||||
|
# 1. Passwort generieren
|
||||||
|
MINIO_PW=$(openssl rand -base64 24)
|
||||||
|
|
||||||
|
# 2. In Vault schreiben
|
||||||
|
vault kv put secret/apps/minio root_user="admin" root_password="$MINIO_PW"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 3. Zugriff
|
||||||
|
Das System stellt zwei Domains bereit:
|
||||||
|
|
||||||
|
1. **Console (Web UI):** `https://minio.apps.k3s.stabify.de`
|
||||||
|
- Hier loggst du dich ein, erstellst Buckets, User und Access Keys.
|
||||||
|
2. **S3 API:** `https://s3.apps.k3s.stabify.de`
|
||||||
|
- Diesen Endpunkt tragen Applikationen (wie Outline) als "S3 Endpoint" ein.
|
||||||
|
|
||||||
|
## 4. Bucket Naming Convention 🪣
|
||||||
|
Damit wir im Chaos nicht untergehen, nutzen wir folgende Struktur für Bucket-Namen:
|
||||||
|
|
||||||
|
`[app-name]-[environment]-[purpose]`
|
||||||
|
|
||||||
|
- **app-name:** Name der Anwendung (z.B. `outline`, `authentik`, `gitlab`).
|
||||||
|
- **environment:** `prod` (Produktion) oder `dev` (Entwicklung).
|
||||||
|
- **purpose:** Optional, was drin ist (z.B. `media`, `backups`, `logs`).
|
||||||
|
|
||||||
|
### Beispiele
|
||||||
|
| Bucket Name | Verwendung |
|
||||||
|
| :--- | :--- |
|
||||||
|
| `outline-prod-media` | Bilder und Uploads für das Wiki (Outline). |
|
||||||
|
| `authentik-prod-static` | Statische Assets oder Uploads für Authentik. |
|
||||||
|
| `postgres-prod-backups` | Datenbank-Dumps (z.B. via Wal-G oder Scripts). |
|
||||||
|
| `loki-prod-logs` | Log-Speicher für Loki (falls verwendet). |
|
||||||
|
|
||||||
|
## 5. Verwendung in Apps (z.B. Outline)
|
||||||
|
Um MinIO in einer App zu nutzen:
|
||||||
|
1. Logge dich in die MinIO Console ein.
|
||||||
|
2. Erstelle einen **Bucket** (z.B. `outline-storage`).
|
||||||
|
3. Setze den Bucket auf **Public** (wenn nötig) oder konfiguriere eine Policy.
|
||||||
|
- *Empfehlung für Outline:* Bucket Access Policy auf `custom` und `ReadOnly` für `*` (Anonymous), damit Bilder im Wiki öffentlich sichtbar sind (wenn gewünscht), oder besser: Nutze Presigned URLs.
|
||||||
|
4. Erstelle einen **Service Account** (Access Key & Secret Key).
|
||||||
|
5. Konfiguriere die App mit:
|
||||||
|
- **Endpoint:** `https://s3.apps.k3s.stabify.de`
|
||||||
|
- **Region:** `eu-central-1` (oder was du eingestellt hast, MinIO ist das meist egal, Standard ist oft `us-east-1`).
|
||||||
|
- **Access Key:** (aus Service Account)
|
||||||
|
- **Secret Key:** (aus Service Account)
|
||||||
|
- **Bucket:** `outline-storage`
|
||||||
Reference in New Issue
Block a user