Database setup
Krenalis uses PostgreSQL 14 or later as its internal database. PostgreSQL database stores only Krenalis's operational and system data, never contains any customer information. You can configure the data warehouse where customer data are stored when creating a workspace.
If you are running Krenalis via Docker Compose, it includes a PostgreSQL image, and the setup is handled automatically. This page instead documents the case where you are installing Krenalis from source code and want to use your own PostgreSQL instance.
1. Create a database
Create a PostgreSQL database that will be used by Krenalis. In this example, we'll name the database krenalis:
psql postgres -c "CREATE DATABASE <POSTGRES_DATABASE>"
Replace <POSTGRES_DATABASE> with a database name, you can choose any name you like for the database.
2. Configure environment variables
Generate a KMS master key for Krenalis and keep it in a safe place:
Linux and macOS
head -c 32 /dev/urandom | base64
Windows
$bytes = New-Object byte[] 32
[System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
[Convert]::ToBase64String($bytes)
Then prepare a .env file in the same directory as the Krenalis executable, and add the generated value together with the PostgreSQL settings:
KRENALIS_KMS=key:<BASE64_KMS_KEY>
KRENALIS_DB_HOST=<POSTGRES_HOST>
KRENALIS_DB_PORT=5432
KRENALIS_DB_USERNAME=<POSTGRES_USERNAME>
KRENALIS_DB_PASSWORD=<POSTGRES_PASSWORD>
KRENALIS_DB_DATABASE=<POSTGRES_DATABASE>
KRENALIS_DB_SCHEMA=public
Replace <BASE64_KMS_KEY> with the generated KMS key.
Replace the placeholder values (<POSTGRES_HOST>, <POSTGRES_USERNAME>, <POSTGRES_PASSWORD>, and <POSTGRES_DATABASE>) with the PostgreSQL connection details for the database you created in step 1.
The values for KRENALIS_DB_PORT and KRENALIS_DB_SCHEMA are set to PostgreSQL's defaults. You only need to change them if your installation uses a custom port or schema. Do not change KRENALIS_KMS for an installation that is already in use.
The database tables will be created on the first startup of Krenalis, as described later.
Next steps
- Event streaming setup. Configure NATS which Krenalis uses as its primary database to store metadata, configuration, and operational state.