Backup Configuration
Configure automated backups for databases and Kubernetes configurations. Backups are managed via ORISO-Database repository scripts and Kubernetes CronJobs.
Backup scripts are located in ORISO-Database/scripts/backup/. Matrix backups are automated via Kubernetes CronJobs.
Use ORISO-Database Backup Scripts
Use the centralized backup scripts from ORISO-Database repository.cd ~/online-beratung/caritas-workspace/ORISO-Database/scripts/backup
# Make scripts executable
chmod +x *.sh
# Backup all databases
./backup-all.sh
# Or backup individually
./backup-mariadb.sh
./backup-mongodb.sh
Backup scripts:
backup-all.sh - Backup all databases
backup-mariadb.sh - Backup MariaDB only
backup-mongodb.sh - Backup MongoDB only
- Backups stored in:
ORISO-Database/backups/
Verify backups are created:ls -lh ~/online-beratung/caritas-workspace/ORISO-Database/backups/
Matrix Automated Backups
Matrix PostgreSQL backups are automated via Kubernetes CronJob.# Check CronJob
kubectl get cronjobs -n caritas | grep matrix
# Check backup job history
kubectl get jobs -n caritas | grep matrix-backup
# View CronJob configuration
kubectl get cronjob matrix-postgres-backup -n caritas -o yaml
Matrix backup CronJob:
- Schedule: Daily at 2:00 AM
- Location:
ORISO-Matrix/matrix-cronjobs.yaml
- Backup: PostgreSQL database dump
Backup Kubernetes Configurations
Export and backup all Kubernetes resources.# Create backup directory
mkdir -p ~/backups/k8s-configs
# Export Helm release
helm get manifest oriso-platform -n caritas > ~/backups/k8s-configs/helm-manifest.yaml
helm get values oriso-platform -n caritas > ~/backups/k8s-configs/helm-values.yaml
# Export all resources
kubectl get all -n caritas -o yaml > ~/backups/k8s-configs/all-resources.yaml
kubectl get configmaps -n caritas -o yaml > ~/backups/k8s-configs/configmaps.yaml
kubectl get secrets -n caritas -o yaml > ~/backups/k8s-configs/secrets.yaml
kubectl get pvc -n caritas -o yaml > ~/backups/k8s-configs/pvcs.yaml
kubectl get ingress -n caritas -o yaml > ~/backups/k8s-configs/ingress.yaml
# Create archive
cd ~/backups
tar -czf k8s-configs-$(date +%Y%m%d).tar.gz k8s-configs/
echo "Kubernetes configs backed up"
Archive should be created in ~/backups/ directory.
Setup Automated Backups (Optional)
Configure automated backups using cron or Kubernetes CronJobs.Option A: System Cron# Add to crontab
crontab -e
# Add daily backup at 2 AM
0 2 * * * cd ~/online-beratung/caritas-workspace/ORISO-Database/scripts/backup && ./backup-all.sh >> ~/backups/backup.log 2>&1
Option B: Kubernetes CronJob# Create backup-cronjob.yaml
apiVersion: batch/v1
kind: CronJob
metadata:
name: database-backup
namespace: caritas
spec:
schedule: "0 2 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: backup
image: mysql:8.0
command:
- /bin/bash
- -c
- |
mysqldump -h oriso-platform-mariadb.caritas.svc.cluster.local \
-u root -p${MYSQL_ROOT_PASSWORD} \
--all-databases > /backup/mariadb-$(date +%Y%m%d).sql
volumeMounts:
- name: backup-storage
mountPath: /backup
volumes:
- name: backup-storage
persistentVolumeClaim:
claimName: backup-pvc
restartPolicy: OnFailure
Restore Procedures
Restore MariaDB
cd ~/online-beratung/caritas-workspace/ORISO-Database/scripts/restore
./restore-mariadb.sh <backup-file>
Restore MongoDB
cd ~/online-beratung/caritas-workspace/ORISO-Database/scripts/restore
./restore-mongodb.sh <backup-file>
Restore Matrix
# Get Matrix PostgreSQL pod
MATRIX_PG_POD=$(kubectl get pods -n caritas -l app=matrix-postgres -o jsonpath="{.items[0].metadata.name}")
# Restore from backup
kubectl exec -i -n caritas $MATRIX_PG_POD -- \
psql -U synapse_user synapse < matrix-backup.sql
Backup Locations
- Database Backups:
ORISO-Database/backups/
- Matrix Backups: Automated via CronJob (check job logs for location)
- Kubernetes Configs:
~/backups/k8s-configs/
- SignOZ Data: Retained in ClickHouse PVC (30 days metrics, 7 days traces)
Data Retention
- MariaDB Backups: Keep last 30 days
- MongoDB Backups: Keep last 30 days
- Matrix Backups: Keep last 30 days
- Kubernetes Configs: Keep last 7 days
- SignOZ: Metrics 30 days, Traces 7 days (configured in Helm values)
Troubleshooting
Backup Script Fails
# Check script permissions
ls -la ~/online-beratung/caritas-workspace/ORISO-Database/scripts/backup/*.sh
# Run script with verbose output
bash -x ~/online-beratung/caritas-workspace/ORISO-Database/scripts/backup/backup-all.sh
# Check database connectivity
kubectl exec -n caritas deployment/oriso-platform-mariadb -- \
mysql -u root -p${MYSQL_ROOT_PASSWORD} -e "SELECT 1;"
CronJob Not Running
# Check CronJob
kubectl get cronjobs -n caritas
# Check job history
kubectl get jobs -n caritas
# Check job logs
kubectl logs -n caritas job/<job-name>
Next Steps