Skip to main content

Configure PostgreSQL DB service (sample)

Scope here: How to configure PostgreSQL DB service for hosting KOBIL Shift services databases

Make use of an PostgreSQL database service to define additional databases inside. You need to define one database per KOBIL Shift service (if required) and configure this in the KOBIL Shift metaconfiguration. Here in the sample creating a database named db-name-shift and a related schema. Use this template to then create required DBs per KOBIL Shift service (i.e. find sample db-names in the metaconfig per service under section database.name - i.e. idp_core, smartdashboard, ast_ca or ast_login).

CREATE DATABASE <db-name-shift>;
REVOKE connect ON DATABASE <db-name-shift> FROM PUBLIC;
CREATE USER <db-username-shift> WITH PASSWORD '<db-username-password>';
GRANT CONNECT ON DATABASE <db-name-shift> TO <db-username-shift>;
GRANT ALL PRIVILEGES ON DATABASE <db-name-shift> TO <db-username-shift>;

\c <db-name-shift>;
GRANT ALL ON SCHEMA public TO <db-name-shift>;

Once the database is created the configuration within the KOBIL Shift metaconfig is required to match to this setup (here sample for IDP-Core service):

# -- Configuration for idp-core -- here as sample
# -- select for DB-type under common.datastores.database.type: postgres
idpCore:
enabled: true
replicaCount: 1

database:
host: postgres-db-host # Postgres DB serivce hostname
port: 5432 # Postgres DB service port (number)
name: "idp_core" # database-name -- should match to db-username-shift
auth: # DB-access credentials could be also configured via secret: common.existingSecretDatastoreCredentials
username: user # db-username-shift
password: "password" # password