Skip to the content.

Installing PostgreSQL Server

Below there are two options to install PostgreSQL Server v15 on OCP cluster. Both options shouldn't be used in production.

Using Bitnami helm chart

Follow these steps to deploy a sample PostgreSQL instance in the sonataflow-infra namespace, with minimal requirements to deploy the Orchestrator.

Note: replace the password of the sonataflow-psql-postgresql secret below in the following command with the desired one.

oc new-project sonataflow-infra
oc create secret generic sonataflow-psql-postgresql --from-literal=postgres-username=postgres --from-literal=postgres-password=postgres

git clone git@github.com:rhdhorchestrator/orchestrator-helm-chart.git
cd orchestrator-helm-chart/postgresql
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install sonataflow-psql bitnami/postgresql --version 12.x.x -f ./values.yaml

Note: the default settings provided in PostgreSQL values match the defaults provided in the Orchestrator values. Any changes to the first configuration must also be reported in the latter.

For OpenShift-related configuration in the chart visit here.

In this installation, the image is docker.io/bitnami/postgresql.

Using PostgreSQL image from RH Catalog

To install PostgreSQL based on RH image follow these steps:

git clone https://github.com/sclorg/postgresql-container.git
cd postgresql-container/

oc process -f examples/postgresql-persistent-template.json \
   -p POSTGRESQL_VERSION=15 \
   -p POSTGRESQL_USER=postgres -p POSTGRESQL_PASSWORD=postgres \
   -p POSTGRESQL_DATABASE=sonataflow \
   -p VOLUME_CAPACITY=2Gi \
   -p DATABASE_SERVICE_NAME=sonataflow-psql-postgresql | oc create -n sonataflow-infra -f -

oc set image deployment/sonataflow-psql-postgresql -n sonataflow-infra postgresql=registry.redhat.io/rhel9/postgresql-15

oc wait -n sonataflow-infra deploy/sonataflow-psql-postgresql --for=condition=Available --timeout=5m

# Create the database
# Replace with the actual pod name
oc exec -i sonataflow-psql-postgresql-xyz -- psql -U postgres -d postgres <<EOF
CREATE DATABASE sonataflow;
GRANT ALL PRIVILEGES ON DATABASE sonataflow TO postgres;
EOF

The Orchestrator's CR spec's fields for postgres should use the following values:

postgres: # redhat deployment requires a different userKey and passwordKey, since it is generated by the template.
serviceName: "sonataflow-psql-postgresql" # The name of the Postgres DB service to be used by platform services. Cannot be empty.
serviceNamespace: "sonataflow-infra" # The namespace of the Postgres DB service to be used by platform services.
authSecret:
   name: "sonataflow-psql-postgresql" # name of existing secret to use for PostgreSQL credentials.
   userKey: database-user # name of key in existing secret to use for PostgreSQL credentials.
   passwordKey: database-password # name of key in existing secret to use for PostgreSQL credentials.
database: sonataflow # existing database instance used by data index and job service

These values contain the updated secret keys according to the examples/postgresql-persistent-template.json template used to create the database server.

Note: there should have been a use of imagestream, but the referenced repository doesn't include instructions for using it, In this installation, the image is registry.redhat.io/rhel9/postgresql-15 which requires the global pull-secret to include access to registry.redhat.io.