Initial standalone Docker release
This commit is contained in:
43
k8s/README.md
Normal file
43
k8s/README.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# Kubernetes deployment (legacy)
|
||||
|
||||
SchadenPM soll als eigenständige Docker-Standalone-Anwendung betrieben werden
|
||||
und ist kein MoM-Modul. Dieses Verzeichnis ist Altbestand für einen optionalen
|
||||
Kubernetes-Betrieb. Für Neuinstallationen bevorzugt `docker-compose.yml` im
|
||||
Projektroot verwenden.
|
||||
|
||||
Das Manifest legt nur Namespace, Datenbank, Service und Deployment an. Routing
|
||||
über Ingress, Gateway oder Reverse Proxy muss projektspezifisch ergänzt werden.
|
||||
|
||||
Create or rotate the runtime secrets before applying the manifest:
|
||||
|
||||
```bash
|
||||
kubectl create namespace schadenpm --dry-run=client -o yaml | kubectl apply -f -
|
||||
kubectl label namespace schadenpm istio-injection=enabled --overwrite
|
||||
kubectl -n schadenpm create secret generic schadenpm-secrets \
|
||||
--from-literal=db-password="$(openssl rand -base64 24)" \
|
||||
--from-literal=admin-password="Admin" \
|
||||
--dry-run=client -o yaml | kubectl apply -f -
|
||||
kubectl apply -f k8s/schadenpm.yaml
|
||||
```
|
||||
|
||||
The initial login is `admin` / `Admin`. The password is also stored in the
|
||||
Kubernetes secret:
|
||||
|
||||
```bash
|
||||
kubectl -n schadenpm get secret schadenpm-secrets \
|
||||
-o jsonpath='{.data.admin-password}' | base64 -d; echo
|
||||
```
|
||||
|
||||
The app only creates the initial admin when the username does not exist yet, so
|
||||
rotating `ADMIN_PASSWORD` later does not change an existing database user.
|
||||
|
||||
## Current feature notes
|
||||
|
||||
- Admin users can create and edit users in the `Benutzer` navigation item.
|
||||
- Projects can be assigned to one user. Admins see all projects; normal users
|
||||
only see assigned projects.
|
||||
- Customer addresses can be global for all customer projects or scoped to one
|
||||
project.
|
||||
- `E-Mail OCR` stores IMAP/IMAPS settings and imports unseen attachments when
|
||||
the mailbox check is triggered. Put `#<Schadennummer>` in the subject or body
|
||||
so the import can assign the attachment to the right project.
|
||||
202
k8s/schadenpm.yaml
Normal file
202
k8s/schadenpm.yaml
Normal file
@@ -0,0 +1,202 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: schadenpm
|
||||
labels:
|
||||
istio-injection: enabled
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: schadenpm-config
|
||||
namespace: schadenpm
|
||||
data:
|
||||
PORT: "8080"
|
||||
DB_URL: jdbc:postgresql://schadenpm-postgres:5432/schadenpm
|
||||
DB_USER: schadenpm
|
||||
ADMIN_USER: admin
|
||||
ADMIN_NAME: Administrator
|
||||
DOCUMENT_DIR: /app/data/documents
|
||||
OCR_LANG: deu+eng
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: schadenpm-documents
|
||||
namespace: schadenpm
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: schadenpm-postgres
|
||||
namespace: schadenpm
|
||||
labels:
|
||||
app: schadenpm-postgres
|
||||
spec:
|
||||
ports:
|
||||
- name: postgres
|
||||
port: 5432
|
||||
targetPort: postgres
|
||||
selector:
|
||||
app: schadenpm-postgres
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: schadenpm-postgres
|
||||
namespace: schadenpm
|
||||
labels:
|
||||
app: schadenpm-postgres
|
||||
spec:
|
||||
serviceName: schadenpm-postgres
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: schadenpm-postgres
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: schadenpm-postgres
|
||||
spec:
|
||||
containers:
|
||||
- name: postgres
|
||||
image: postgres:17
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: postgres
|
||||
containerPort: 5432
|
||||
env:
|
||||
- name: POSTGRES_DB
|
||||
value: schadenpm
|
||||
- name: POSTGRES_USER
|
||||
value: schadenpm
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: schadenpm-secrets
|
||||
key: db-password
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- pg_isready
|
||||
- -U
|
||||
- schadenpm
|
||||
- -d
|
||||
- schadenpm
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- pg_isready
|
||||
- -U
|
||||
- schadenpm
|
||||
- -d
|
||||
- schadenpm
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 20
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/postgresql/data
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: 1Gi
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: schadenpm
|
||||
namespace: schadenpm
|
||||
labels:
|
||||
app: schadenpm
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
port: 8080
|
||||
targetPort: http
|
||||
selector:
|
||||
app: schadenpm
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: schadenpm
|
||||
namespace: schadenpm
|
||||
labels:
|
||||
app: schadenpm
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: schadenpm
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: schadenpm
|
||||
spec:
|
||||
containers:
|
||||
- name: schadenpm
|
||||
image: registry.example.local/schadenpm:1.1.35-budget-documents
|
||||
imagePullPolicy: Never
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: schadenpm-config
|
||||
env:
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: schadenpm-secrets
|
||||
key: db-password
|
||||
- name: ADMIN_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: schadenpm-secrets
|
||||
key: admin-password
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /api/health
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /api/health
|
||||
port: http
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 20
|
||||
volumeMounts:
|
||||
- name: documents
|
||||
mountPath: /app/data/documents
|
||||
resources:
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 512Mi
|
||||
limits:
|
||||
cpu: "2"
|
||||
memory: 2Gi
|
||||
volumes:
|
||||
- name: documents
|
||||
persistentVolumeClaim:
|
||||
claimName: schadenpm-documents
|
||||
Reference in New Issue
Block a user