Last active
November 3, 2020 20:30
-
-
Save EmilyM1/04545450ecd1f947127bf06feaecda4c to your computer and use it in GitHub Desktop.
Postgres-init.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instructions to use: | |
Make namespace | |
Go to console, spin up Postgres (non-ephemeral) enter un, pw, db name | |
After it installs, this script will create secret, expose the service and echo the service url to copy to put into the CR | |
Then just install Metering | |
Note 1: I have the line to install Postgres without console in this script, just not sure if it works. | |
Note 2: I have an attempt at setting the clusterIP as an env var and injecting that into CR, it does not work so that's in and commented out also. | |
Feel free to improve this, even with the steps it does now, its quicker. | |
Note 3: Change the un and password to match what you entered before running this init script. | |
#!/bin/bash | |
# create namespace first because is needed to make Postgres in | |
# set env var for $METERING_NAMESPACE. ex: export METERING_NAMESPACE=emily | |
#export METERING_NAMESPACE=emily | |
#oc create namespace $METERING_NAMESPACE | |
#oc -n $METERING_NAMESPACE new-app --image-stream=openshift/postgresql:10-el8 POSTGRES_USER= < your username here> POSTGRES_PASSWORD=< your password here > POSTGRES_DATABASE=sampledb | |
oc project $METERING_NAMESPACE | |
oc -n $METERING_NAMESPACE create secret generic secret --from-literal=username=< put username here> --from-literal=password=< put your password here> | |
oc -n $METERING_NAMESPACE expose service postgresql | |
oc -n $METERING_NAMESPACE get services | |
CLUSTERIP=$(kubectl -n $METERING_NAMESPACE get service postgresql -o jsonpath={.spec.clusterIP}) | |
# need to put new route into CR before install | |
#echo $CLUSTERIP | |
#export EXCLUSTERIP=$CLUSTERIP | |
#echo $EXCLUSTERIP | |
#./bin/deploy-metering install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment