Both ECC and UCApp uses in-memory database (H2) with persisting db on file system. This setup can be used for some small POC projects, to verify if integration is working and similar, but for real use case scenario, some more resilient database should be used. Below you can find configuration for setting PostgreSQL.
In order to switch to PostgreSQL database, following steps are needed:
Modify docker compose file, and add 2 PostgreSQL services, one for Provider and one for Consumer:
Modify usage control property files, for ecc_resources_provider
and ecc_resources_consumer
and uc-dataapp_resources_provider
and uc-dataapp_resources_consumer
Postgres env file
2 env files needed for PostgreSQL should be created, in root of TRUE Connector directory:
postgres_provider.env with content
postgres_consumer.env with content
Script for creating multiple databases
Script create-multiple-postgresql-databases.sh should be created with content:
After saving script, please ensure that script is executable. If it is not executable, you can make it executable using the following terminal command:
#!/bin/bash
set -e
set -u
function create_database() {
local database=$1
echo " Creating database '$database'"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname="postgres" <<-EOSQL
CREATE DATABASE $database;
GRANT ALL PRIVILEGES ON DATABASE $database TO $POSTGRES_USER;
EOSQL
}
if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then
echo "Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES"
for db in $(echo $POSTGRES_MULTIPLE_DATABASES | tr ',' ' '); do
create_database $db
done
echo "Multiple databases created"
fi