Using an External Database
This topic illustrates how to use an external database instead of the one that is provided with the operator itself.
This document describes how to change configuration on the existing Deploy installation. If you are doing initial installation, check the document Using an Existing PostgreSQL Database
Steps to Move to an External Database after Installation
-
Migrate current Deploy data from the current database to external, for example:
a. Backup current Deploy database, for details check Using an Existing PostgreSQL Database
b. Restore the Deploy database to the target external database.
-
Prepare the external database configuration, for example, like the following patch file:
spec:
external:
db:
enabled: true
main:
url: jdbc:postgresql://psql-test1-postgresql.default.svc.cluster.local:5432/main
username: postgres
password: admin123
report:
url: jdbc:postgresql://psql-test2-postgresql.default.svc.cluster.local:5432/report
username: postgres
password: admin123
postgresql:
install: false
- Remove the configuration files from the central configuration pod so that the configuration can be replaced.
Note: This step is only necessary if you have
/opt/xebialabs/central-configuration-server/centralConfiguration
folder mounted as a persistent volume. Starting from version 24.1, this is no longer the default option.
kubectl exec -it sts/dai-xld-digitalai-deploy-cc-server -n digitalai \
-- rm /opt/xebialabs/central-configuration-server/centralConfiguration/deploy-repository.yaml
kubectl exec -it sts/dai-xld-digitalai-deploy-cc-server -n digitalai \
-- rm /opt/xebialabs/central-configuration-server/centralConfiguration/deploy-cluster.yaml
kubectl exec -it sts/dai-xld-digitalai-deploy-cc-server -n digitalai \
-- rm /opt/xebialabs/central-configuration-server/centralConfiguration/deploy-reporting.yaml
- Update the database configuration in Deploy CR.
kubectl patch -n digitalai digitalaideploys.xld.digital.ai dai-xld \
--type=merge --patch-file external-db-patch.yaml
- Restart the Deploy pods.
kubectl delete sts dai-xld-digitalai-deploy-master -n digitalai
kubectl delete sts dai-xld-digitalai-deploy-worker -n digitalai
- The CR yaml file will now have a new
external.db
section.
kubectl get Digitalaideploys dai-xld -n digitalai -o yaml | yq '.spec.external.db'
- The restarted pod process will now use the new configuration. Check it with the following commands:
central configuration pod
kubectl exec -it sts/dai-xld-digitalai-deploy-cc-server -n digitalai \
-- cat /opt/xebialabs/central-configuration-server/centralConfiguration/deploy-repository.yaml
kubectl exec -it sts/dai-xld-digitalai-deploy-cc-server -n digitalai \
-- cat /opt/xebialabs/central-configuration-server/centralConfiguration/deploy-cluster.yaml
kubectl exec -it sts/dai-xld-digitalai-deploy-cc-server -n digitalai \
-- cat /opt/xebialabs/central-configuration-server/centralConfiguration/deploy-reporting.yaml