Setup Databases
Initialize databases using ORISO-Database repository with centralized schema management
Setup Databases
Initialize all databases using the centralized ORISO-Database repository. Liquibase is DISABLED in all services - schemas are managed separately.
All database schemas are managed in the ORISO-Database repository, not by individual services. This provides centralized control and versioning of database schemas.
Ensure database pods are operational before proceeding. Databases are deployed via Helm.
# Check database pods
kubectl get pods -n caritas | grep -E "mariadb|mongodb|postgres"
# Should see:
# oriso-platform-mariadb-xxx 1/1 Running
# oriso-platform-mongodb-xxx 1/1 Running
# oriso-platform-postgresql-xxx 1/1 Running (for Matrix)All database pods should show status Running and 1/1 ready. If not, check Deploy Infrastructure.
Use the master setup script to initialize all databases at once.
cd ~/online-beratung/caritas-workspace/ORISO-Database
# Make script executable
chmod +x scripts/setup/00-master-setup.sh
# Run master setup
./scripts/setup/00-master-setup.shThe master setup script will:
- Create all MariaDB databases (7 databases)
- Import all MariaDB schemas from
mariadb/*/schema.sql - Initialize MongoDB collections
- Create system users
- Verify all databases are accessible
The script should complete without errors. Verify by checking databases:
kubectl exec -n caritas deployment/oriso-platform-mariadb -- \
mysql -u root -p${MYSQL_ROOT_PASSWORD} -e "SHOW DATABASES;"Create system users required for Matrix and other services.
cd ~/online-beratung/caritas-workspace/ORISO-Database/scripts
# Apply system users job
kubectl apply -f system-users-job.yaml
# Wait for job to complete
kubectl wait --for=condition=complete job/system-users -n caritas --timeout=300s
# Check job logs
kubectl logs job/system-users -n caritasSystem users created:
caritas_admin- Admin user for Caritas operationsoriso_call_admin- Admin for call managementgroup-chat-system- System user for group chats
Job should complete successfully. Check logs to verify all users were created.
Verify all databases and schemas are properly initialized.
# Check MariaDB databases
kubectl exec -n caritas deployment/oriso-platform-mariadb -- \
mysql -u root -p${MYSQL_ROOT_PASSWORD} -e "SHOW DATABASES;"
# Check MariaDB tables (example: userservice)
kubectl exec -n caritas deployment/oriso-platform-mariadb -- \
mysql -u root -p${MYSQL_ROOT_PASSWORD} userservice -e "SHOW TABLES;"
# Check MongoDB databases
kubectl exec -n caritas deployment/oriso-platform-mongodb -- \
mongosh --eval "show dbs"
# Check MongoDB collections
kubectl exec -n caritas deployment/oriso-platform-mongodb -- \
mongosh consulting_types --eval "show collections"Expected MariaDB databases:
tenantserviceuserserviceconsultingtypeserviceagencyservicekeycloakcaritas_master- Additional service databases
Expected MongoDB:
consulting_typesdatabase withconsultingTypescollection
Database Schema Management
Schema Location
All schemas are in ORISO-Database:
caritas-workspace/ORISO-Database/
├── mariadb/
│ ├── tenantservice/
│ │ └── schema.sql
│ ├── userservice/
│ │ └── schema.sql
│ ├── consultingtypeservice/
│ │ └── schema.sql
│ └── agencyservice/
│ └── schema.sql
├── mongodb/
│ └── consulting_types/
│ └── schema.json
└── scripts/
└── setup/
└── 00-master-setup.shLiquibase Status
Liquibase is DISABLED in all backend services. This means:
- Services do NOT auto-migrate on startup
- All schema changes must be done manually via ORISO-Database scripts
- Schema versions are tracked in ORISO-Database repository
Updating Schemas
- Update schema files in
ORISO-Database/mariadb/<service>/schema.sql - Run migration scripts manually
- Services will use updated schemas on next connection
Backup and Restore
Backup Scripts
Location: caritas-workspace/ORISO-Database/scripts/backup/
# Backup all databases
cd ~/online-beratung/caritas-workspace/ORISO-Database/scripts/backup
./backup-all.sh
# Backup MariaDB only
./backup-mariadb.sh
# Backup MongoDB only
./backup-mongodb.shRestore Scripts
Location: caritas-workspace/ORISO-Database/scripts/restore/
# Restore MariaDB
./restore-mariadb.sh <backup-file>
# Restore MongoDB
./restore-mongodb.sh <backup-file>Troubleshooting
Master Setup Script Fails
# Check script logs
cd ~/online-beratung/caritas-workspace/ORISO-Database
./scripts/setup/00-master-setup.sh 2>&1 | tee setup.log
# Verify database pods are running
kubectl get pods -n caritas | grep -E "mariadb|mongodb"
# Check database connectivity
kubectl exec -n caritas deployment/oriso-platform-mariadb -- \
mysql -u root -p${MYSQL_ROOT_PASSWORD} -e "SELECT 1;"Schema Import Errors
# Check schema file exists
ls -la ~/online-beratung/caritas-workspace/ORISO-Database/mariadb/*/schema.sql
# Test schema import manually
kubectl exec -i -n caritas deployment/oriso-platform-mariadb -- \
mysql -u root -p${MYSQL_ROOT_PASSWORD} userservice < \
~/online-beratung/caritas-workspace/ORISO-Database/mariadb/userservice/schema.sqlSystem Users Not Created
# Check job status
kubectl get job system-users -n caritas
# Check job logs
kubectl logs job/system-users -n caritas
# Re-run job if needed
kubectl delete job system-users -n caritas
kubectl apply -f ~/online-beratung/caritas-workspace/ORISO-Database/scripts/system-users-job.yamlNext Steps
- Deploy Infrastructure - If databases not yet deployed
- Configure Keycloak - Import Keycloak realm
- Post-Deployment - Complete post-deployment steps