Compare commits
12 Commits
improvemen
...
fd729b3019
| Author | SHA1 | Date | |
|---|---|---|---|
| fd729b3019 | |||
| e1c1eafb39 | |||
| 1b016c49f2 | |||
| 4376069b11 | |||
| c285ae81af | |||
| 5bfe4866a4 | |||
| f7799675d5 | |||
| c125427b8d | |||
| a14a80f7bd | |||
| 477143b3ff | |||
| fc404f6755 | |||
| bb01174bd2 |
241
Documentation/ArgoCD.md
Normal file
241
Documentation/ArgoCD.md
Normal file
@@ -0,0 +1,241 @@
|
||||
# ArgoCD Configuration Documentation
|
||||
|
||||
## Overview
|
||||
This directory contains the ArgoCD application manifests for deploying the VorgabenUI application and its dependencies to Kubernetes.
|
||||
|
||||
## Files
|
||||
|
||||
### Application Manifests
|
||||
|
||||
#### `001_pvc.yaml`
|
||||
- **Purpose**: PersistentVolumeClaim for Django application data
|
||||
- **Storage**: 2Gi storage with ReadWriteMany access mode
|
||||
- **Storage Class**: Uses NFS storage class for shared storage across multiple pods
|
||||
- **Namespace**: vorgabenui
|
||||
|
||||
#### `deployment.yaml`
|
||||
- **Purpose**: Main application deployment configuration
|
||||
- **Contains**: Django application container, environment variables, resource limits
|
||||
- **Replicas**: Configurable replica count for high availability
|
||||
|
||||
#### `ingress.yaml`
|
||||
- **Purpose**: External access configuration
|
||||
- **Host**: Configurable hostname for the application
|
||||
- **TLS**: SSL/TLS termination configuration
|
||||
- **Backend**: Routes traffic to the Django application service
|
||||
|
||||
#### `nfs-pv.yaml`
|
||||
- **Purpose**: PersistentVolume definition for NFS storage
|
||||
- **Server**: 192.168.17.199
|
||||
- **Path**: /mnt/user/vorgabenui
|
||||
- **Access**: ReadWriteMany for multi-pod access
|
||||
- **Reclaim Policy**: Retain (data preserved after PVC deletion)
|
||||
|
||||
#### `nfs-storageclass.yaml`
|
||||
- **Purpose**: StorageClass definition for NFS volumes
|
||||
- **Provisioner**: kubernetes.io/no-provisioner (static provisioning)
|
||||
- **Volume Expansion**: Enabled for growing storage capacity
|
||||
- **Binding Mode**: Immediate (binds PV to PVC as soon as possible)
|
||||
|
||||
#### `diagrammer.yaml`
|
||||
- **Purpose**: Deployment configuration for the diagram generation service
|
||||
- **Function**: Handles diagram creation and caching for the application
|
||||
|
||||
## NFS Storage Configuration
|
||||
|
||||
### Prerequisites
|
||||
1. NFS server must be running at 192.168.17.199
|
||||
2. The directory `/mnt/user/vorgabenui` must exist and be exported
|
||||
3. Kubernetes nodes must have NFS client utilities installed
|
||||
4. For MicroK8s: `microk8s enable nfs`
|
||||
|
||||
## MicroK8s Addons Required
|
||||
|
||||
### Required Addons
|
||||
Enable the following MicroK8s addons before deployment:
|
||||
|
||||
```bash
|
||||
# Enable storage and NFS support
|
||||
sudo microk8s enable storage
|
||||
sudo microk8s enable nfs
|
||||
|
||||
# Enable ingress for external access
|
||||
sudo microk8s enable ingress
|
||||
|
||||
# Enable DNS for service discovery
|
||||
sudo microk8s enable dns
|
||||
|
||||
# Optional: Enable metrics for monitoring
|
||||
sudo microk8s enable metrics-server
|
||||
```
|
||||
|
||||
### Addon Descriptions
|
||||
|
||||
#### `storage`
|
||||
- **Purpose**: Provides default storage class for persistent volumes
|
||||
- **Required for**: Basic PVC functionality
|
||||
- **Note**: Works alongside our custom NFS storage class
|
||||
|
||||
#### `nfs`
|
||||
- **Purpose**: Installs NFS client utilities on all MicroK8s nodes
|
||||
- **Required for**: Mounting NFS volumes in pods
|
||||
- **Components**: Installs `nfs-common` package with mount helpers
|
||||
|
||||
#### `ingress`
|
||||
- **Purpose**: Provides Ingress controller for external HTTP/HTTPS access
|
||||
- **Required for**: `ingress.yaml` to function properly
|
||||
- **Implementation**: Uses NGINX Ingress Controller
|
||||
|
||||
#### `dns`
|
||||
- **Purpose**: Provides DNS service for service discovery within cluster
|
||||
- **Required for**: Inter-service communication
|
||||
- **Note**: Usually enabled by default in MicroK8s
|
||||
|
||||
#### `metrics-server` (Optional)
|
||||
- **Purpose**: Enables resource usage monitoring
|
||||
- **Required for**: `kubectl top` commands and HPA (Horizontal Pod Autoscaling)
|
||||
- **Recommended for**: Production monitoring
|
||||
|
||||
### Addon Verification
|
||||
After enabling addons, verify they are running:
|
||||
|
||||
```bash
|
||||
# Check addon status
|
||||
microk8s status
|
||||
|
||||
# Check pods in kube-system namespace
|
||||
microk8s kubectl get pods -n kube-system
|
||||
|
||||
# Check storage classes
|
||||
microk8s kubectl get storageclass
|
||||
|
||||
# Check ingress controller
|
||||
microk8s kubectl get pods -n ingress
|
||||
```
|
||||
|
||||
### Troubleshooting Addons
|
||||
|
||||
#### NFS Addon Issues
|
||||
```bash
|
||||
# Check if NFS utilities are installed
|
||||
which mount.nfs
|
||||
|
||||
# Manually install if addon fails
|
||||
sudo apt update && sudo apt install nfs-common
|
||||
|
||||
# Restart MicroK8s after manual installation
|
||||
sudo microk8s restart
|
||||
```
|
||||
|
||||
#### Ingress Issues
|
||||
```bash
|
||||
# Check ingress controller pods
|
||||
microk8s kubectl get pods -n ingress
|
||||
|
||||
# Check ingress services
|
||||
microk8s kubectl get svc -n ingress
|
||||
|
||||
# Test ingress connectivity
|
||||
curl -k https://your-domain.com
|
||||
```
|
||||
|
||||
#### Storage Issues
|
||||
```bash
|
||||
# List available storage classes
|
||||
microk8s kubectl get storageclass
|
||||
|
||||
# Check default storage class
|
||||
microk8s kubectl get storageclass -o yaml
|
||||
```
|
||||
|
||||
### Storage Architecture
|
||||
- **Storage Class**: `nfs` - Static provisioning for NFS shares
|
||||
- **Persistent Volume**: Pre-provisioned PV pointing to NFS server
|
||||
- **Persistent Volume Claim**: Claims the NFS storage for application use
|
||||
- **Access Mode**: ReadWriteMany allows multiple pods to access the same data
|
||||
|
||||
### NFS Server Setup
|
||||
On the NFS server (192.168.17.199), ensure the following:
|
||||
|
||||
```bash
|
||||
# Create the shared directory
|
||||
sudo mkdir -p /mnt/user/vorgabenui
|
||||
sudo chmod 755 /mnt/user/vorgabenui
|
||||
|
||||
# Add to /etc/exports
|
||||
echo "/mnt/user/vorgabenui *(rw,sync,no_subtree_check,no_root_squash)" | sudo tee -a /etc/exports
|
||||
|
||||
# Export the directory
|
||||
sudo exportfs -a
|
||||
sudo systemctl restart nfs-kernel-server
|
||||
```
|
||||
|
||||
## Deployment Order
|
||||
|
||||
1. **StorageClass** (`nfs-storageclass.yaml`) - Defines NFS storage class
|
||||
2. **PersistentVolume** (`nfs-pv.yaml`) - Creates the NFS volume
|
||||
3. **PersistentVolumeClaim** (`001_pvc.yaml`) - Claims storage for application
|
||||
4. **Application Deployments** (`deployment.yaml`, `diagrammer.yaml`) - Deploy application services
|
||||
5. **Ingress** (`ingress.yaml`) - Configure external access
|
||||
|
||||
## Configuration Notes
|
||||
|
||||
### Namespace
|
||||
All resources are deployed to the `vorgabenui` namespace.
|
||||
|
||||
### Storage Sizing
|
||||
- Current allocation: 2Gi
|
||||
- Volume expansion is enabled through the StorageClass
|
||||
- Monitor usage and adjust PVC size as needed
|
||||
|
||||
### Access Control
|
||||
- NFS export uses `no_root_squash` for container root access
|
||||
- Ensure proper network security between Kubernetes nodes and NFS server
|
||||
- Consider implementing network policies for additional security
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
#### Mount Failures
|
||||
- **Error**: "bad option; for several filesystems you might need a /sbin/mount.<type> helper program"
|
||||
- **Solution**: Install NFS client utilities or enable NFS addon in MicroK8s
|
||||
|
||||
#### Permission Issues
|
||||
- **Error**: Permission denied when accessing mounted volume
|
||||
- **Solution**: Check NFS export permissions and ensure `no_root_squash` is set
|
||||
|
||||
#### Network Connectivity
|
||||
- **Error**: Connection timeout to NFS server
|
||||
- **Solution**: Verify network connectivity and firewall rules between nodes and NFS server
|
||||
|
||||
### Debug Commands
|
||||
```bash
|
||||
# Check PVC status
|
||||
kubectl get pvc -n vorgabenui
|
||||
|
||||
# Check PV status
|
||||
kubectl get pv
|
||||
|
||||
# Describe PVC for detailed information
|
||||
kubectl describe pvc django-data-pvc -n vorgabenui
|
||||
|
||||
# Check pod mount status
|
||||
kubectl describe pod <pod-name> -n vorgabenui
|
||||
```
|
||||
|
||||
## Maintenance
|
||||
|
||||
### Backup Strategy
|
||||
- The NFS server should have regular backups of `/mnt/user/vorgabenui`
|
||||
- Consider snapshot capabilities if using enterprise NFS solutions
|
||||
|
||||
### Monitoring
|
||||
- Monitor NFS server performance and connectivity
|
||||
- Track storage usage and plan capacity upgrades
|
||||
- Monitor pod restarts related to storage issues
|
||||
|
||||
### Updates
|
||||
- When updating storage configuration, update PV first, then PVC
|
||||
- Test changes in non-production environment first
|
||||
- Ensure backward compatibility when modifying NFS exports
|
||||
92
Documentation/modelle_dokumente.md
Normal file
92
Documentation/modelle_dokumente.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# Modelle (App: dokumente)
|
||||
|
||||
Kurzbeschreibungen der Modelle in dokumente/models.py.
|
||||
|
||||
## Dokumententyp
|
||||
- Zweck: Kategorisierung von Dokumenten (z. B. Richtlinie, Verfahren).
|
||||
- Wichtige Felder: `name` (CharField, PK), `verantwortliche_ve` (CharField).
|
||||
- Besonderheiten: `__str__()` gibt `name` zurück.
|
||||
- Meta: `verbose_name` und `verbose_name_plural` gesetzt.
|
||||
|
||||
## Person
|
||||
- Zweck: Repräsentiert Personen (Autoren, Prüfer).
|
||||
- Wichtige Felder: `name` (CharField, PK), `funktion` (CharField).
|
||||
- Beziehungen: Many-to-many mit Dokument über `autoren` und `pruefende`.
|
||||
- Besonderheiten: `__str__()` gibt `name` zurück; `ordering = ['name']`.
|
||||
- Meta: `verbose_name_plural = "Personen"`.
|
||||
|
||||
## Thema
|
||||
- Zweck: Thematische Einordnung von Vorgaben.
|
||||
- Wichtige Felder: `name` (CharField, PK), `erklaerung` (TextField, optional).
|
||||
- Besonderheiten: `__str__()` gibt `name` zurück.
|
||||
|
||||
## Dokument
|
||||
- Zweck: Hauptobjekt; ein einzelnes Dokument mit Metadaten.
|
||||
- Wichtige Felder:
|
||||
- `nummer` (CharField, PK)
|
||||
- `dokumententyp` (FK → Dokumententyp, on_delete=PROTECT)
|
||||
- `name` (CharField)
|
||||
- `autoren`, `pruefende` (ManyToManyField → Person)
|
||||
- `gueltigkeit_von`, `gueltigkeit_bis` (DateField, optional)
|
||||
- `aktiv` (BooleanField)
|
||||
- `signatur_cso`, `anhaenge` (Metadaten)
|
||||
- Besonderheiten: `__str__()` formatiert als "nummer – name".
|
||||
- Meta: `verbose_name` / `verbose_name_plural`.
|
||||
|
||||
## Vorgabe
|
||||
- Zweck: Einzelne Vorgabe / Anforderung innerhalb eines Dokuments.
|
||||
- Wichtige Felder:
|
||||
- `order` (IntegerField) — Sortierreihenfolge
|
||||
- `nummer` (IntegerField) — Nummer innerhalb Thema/Dokument
|
||||
- `dokument` (FK → Dokument, CASCADE, related_name='vorgaben')
|
||||
- `thema` (FK → Thema, PROTECT)
|
||||
- `titel` (CharField)
|
||||
- `referenzen` (M2M → Referenz, optional)
|
||||
- `stichworte` (M2M → Stichwort, optional)
|
||||
- `relevanz` (M2M → Rolle, optional)
|
||||
- `gueltigkeit_von`, `gueltigkeit_bis` (Datum/Felder)
|
||||
- Beziehungen: zu Dokument, Thema, Referenzen, Stichworte, Rollen.
|
||||
- Wichtige Methoden:
|
||||
- `Vorgabennummer()` — generiert eine lesbare Kennung (z. B. "DOK. T. N").
|
||||
- `get_status(check_date, verbose)` — liefert "future", "active" oder "expired" oder eine deutsche Statusbeschreibung, abhängig von Gültigkeitsdaten.
|
||||
- `sanity_check_vorgaben()` (static) — findet Konflikte zwischen Vorgaben mit gleicher Nummer/Thema/Dokument, deren Zeiträume sich überschneiden.
|
||||
- `clean()` — ruft `find_conflicts()` auf und wirft ValidationError bei Konflikten.
|
||||
- `find_conflicts()` — prüft Konflikte mit bestehenden Vorgaben (ohne sich selbst).
|
||||
- `_date_ranges_intersect(...)` (static) — prüft, ob sich zwei Datumsbereiche überschneiden (None = offen).
|
||||
- Besonderheiten: `__str__()` gibt "Vorgabennummer: titel" zurück.
|
||||
- Meta: `ordering = ['order']`, `verbose_name_plural = "Vorgaben"`.
|
||||
|
||||
## VorgabeLangtext, VorgabeKurztext
|
||||
- Zweck: Textabschnitts-Modelle, erben von `Textabschnitt` (aus abschnitte.models).
|
||||
- Wichtige Felder: je ein FK `abschnitt` → Vorgabe.
|
||||
- Besonderheit: konkrete Untertypen für Lang- und Kurztexte; Meta-`verbose_name` gesetzt.
|
||||
|
||||
## Geltungsbereich, Einleitung
|
||||
- Zweck: Dokumentbezogene Textabschnitte (erben von `Textabschnitt`).
|
||||
- Wichtige Felder: FK zum `Dokument` (`geltungsbereich` bzw. `einleitung`).
|
||||
- Meta: `verbose_name`/`verbose_name_plural` gesetzt.
|
||||
|
||||
## Checklistenfrage
|
||||
- Zweck: Einzelne Frage für Checklisten zu einer Vorgabe.
|
||||
- Wichtige Felder: `vorgabe` (FK → Vorgabe, related_name="checklistenfragen"), `frage` (CharField).
|
||||
- Besonderheiten: `__str__()` gibt `frage` zurück.
|
||||
|
||||
## VorgabenTable
|
||||
- Zweck: Proxy-Modell für Vorgabe zur Darstellung (Tabellenansicht).
|
||||
- Besonderheiten: kein eigenes Schema; nur Meta-Attribute (`proxy = True`, `verbose_name`).
|
||||
|
||||
## Changelog
|
||||
- Zweck: Änderungsverzeichnis-Eintrag für ein Dokument.
|
||||
- Wichtige Felder:
|
||||
- `dokument` (FK → Dokument, related_name='changelog')
|
||||
- `autoren` (M2M → Person)
|
||||
- `datum` (DateField)
|
||||
- `aenderung` (TextField)
|
||||
- Besonderheiten: `__str__()` formatiert als "datum – dokumentnummer".
|
||||
- Meta: `verbose_name` / `verbose_name_plural`.
|
||||
|
||||
Hinweise zur Pflege
|
||||
- Wichtige Relationen nutzen häufig on_delete=PROTECT, um versehentliche Löschungen zu vermeiden.
|
||||
- Viele Modelle haben CharField-Primärschlüssel (z. B. `nummer`, `name`).
|
||||
- Validierungslogik für zeitliche Konflikte ist in Vorgabe implementiert (clean / find_conflicts).
|
||||
- Textabschnitt-Modelle erben Verhalten aus `abschnitte.models.Textabschnitt` — dort sind Anzeige- und Inhaltsregeln definiert.
|
||||
@@ -5,7 +5,8 @@ metadata:
|
||||
namespace: vorgabenui
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
- ReadWriteMany
|
||||
storageClassName: nfs
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
|
||||
@@ -25,7 +25,7 @@ spec:
|
||||
mountPath: /data
|
||||
containers:
|
||||
- name: web
|
||||
image: git.baumann.gr/adebaumann/vui:0.953-ingressfixed
|
||||
image: git.baumann.gr/adebaumann/vui:0.957
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
@@ -63,6 +63,8 @@ spec:
|
||||
selector:
|
||||
app: django
|
||||
ports:
|
||||
- port: 8000
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 8000
|
||||
targetPort: 8000
|
||||
|
||||
|
||||
@@ -3,7 +3,10 @@ kind: Ingress
|
||||
metadata:
|
||||
name: django
|
||||
namespace: vorgabenui
|
||||
annotations:
|
||||
argocd.argoproj.io/ignore-healthcheck: "true"
|
||||
spec:
|
||||
ingressClassName: traefik
|
||||
rules:
|
||||
- host: vorgabenportal.knowyoursecurity.com
|
||||
http:
|
||||
|
||||
15
argocd/nfs-pv.yaml
Normal file
15
argocd/nfs-pv.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: django-data-pv
|
||||
namespace: vorgabenui
|
||||
spec:
|
||||
capacity:
|
||||
storage: 2Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: nfs
|
||||
nfs:
|
||||
server: 192.168.17.199
|
||||
path: /mnt/user/vorgabenui
|
||||
8
argocd/nfs-storageclass.yaml
Normal file
8
argocd/nfs-storageclass.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: nfs
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
allowVolumeExpansion: true
|
||||
reclaimPolicy: Retain
|
||||
volumeBindingMode: Immediate
|
||||
BIN
data/db.sqlite3
BIN
data/db.sqlite3
Binary file not shown.
@@ -25,7 +25,7 @@
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2 class="h4 mb-0">Einleitung</h2>
|
||||
<h2>Einleitung</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% for typ, html in standard.einleitung_html %}
|
||||
@@ -43,7 +43,7 @@
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2 class="h4 mb-0">Geltungsbereich</h2>
|
||||
<h2>Geltungsbereich</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% for typ, html in standard.geltungsbereich_html %}
|
||||
@@ -73,7 +73,7 @@
|
||||
<a id="{{ vorgabe.Vorgabennummer }}"></a>
|
||||
<div class="card mb-4">
|
||||
<div class="card-header" style="display: flex; justify-content: space-between; align-items: center;">
|
||||
<h3 class="h5 mb-0">
|
||||
<h3>
|
||||
{{ vorgabe.Vorgabennummer }} – {{ vorgabe.titel }}
|
||||
{% if vorgabe.long_status != "active" and standard.history == True %}
|
||||
<span class="badge badge-danger">{{ vorgabe.long_status }}</span>
|
||||
@@ -123,7 +123,7 @@
|
||||
{% endif %}
|
||||
|
||||
<!-- Stichworte und Referenzen -->
|
||||
<div class="mt-4 p-3" style="background-color: #f8f9fa; border-left: 3px solid #dee2e6;">
|
||||
<div class="mt-4 p-3" style="background-color: #f8f9fa; border-left: 3px solid #dee2e6; padding-left: 0.5en;">
|
||||
<p class="mb-2">
|
||||
<strong>Stichworte:</strong>
|
||||
{% if vorgabe.stichworte.all %}
|
||||
|
||||
15
k8s/nfs-pv.yaml
Normal file
15
k8s/nfs-pv.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: django-data-pv
|
||||
namespace: vorgabenui
|
||||
spec:
|
||||
capacity:
|
||||
storage: 2Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: nfs
|
||||
nfs:
|
||||
server: 192.168.17.199
|
||||
path: /mnt/user/vorgabenui
|
||||
8
k8s/nfs-storageclass.yaml
Normal file
8
k8s/nfs-storageclass.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: nfs
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
allowVolumeExpansion: true
|
||||
reclaimPolicy: Retain
|
||||
volumeBindingMode: Immediate
|
||||
@@ -5,7 +5,8 @@ metadata:
|
||||
namespace: vorgabenui
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
- ReadWriteMany
|
||||
storageClassName: nfs
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-sm-6 text-right">
|
||||
<p class="text-muted">Version {{ version|default:"0.953" }}</p>
|
||||
<p class="text-muted">Version {{ version|default:"0.957" }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user