-
Notifications
You must be signed in to change notification settings - Fork 1
/
3-deploy-postgres.sh
executable file
·47 lines (40 loc) · 1.38 KB
/
3-deploy-postgres.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
#####################################################################################
# Deploy a basic Postgres instance without any persistent volumes
# The Curity Identity Server will connect to it via this JDBC URL inside the cluster:
# - jdbc:postgresql://postgres-svc/idsvr
#####################################################################################
#
# Ensure that we are in the folder containing this script
#
cd "$(dirname "${BASH_SOURCE[0]}")"
#
# Point to our minikube profile
#
eval $(minikube docker-env --profile curity)
minikube profile curity
if [ $? -ne 0 ]; then
echo "Minikube problem encountered - please ensure that the service is started"
exit 1
fi
#
# Tear down the instance and lose all data, which will be reapplied from the backup
#
kubectl delete -f postgres/service.yaml 2>/dev/null
#
# Copy in the init script to restore data, which includes our test user account
#
kubectl delete configmap init-script-configmap 2>/dev/null
kubectl create configmap init-script-configmap --from-file='./postgres/idsvr-data-backup.sql'
#
# Deploy a postgres instance
#
kubectl apply -f postgres/service.yaml
if [ $? -ne 0 ]; then
echo "Problem encountered deploying the PostgreSQL service"
exit 1
fi
#
# From Postgres containers inside the cluster we can connect via the following command:
# - export PGPASSWORD=Password1 && psql -p 5432 -d idsvr -U postgres
#