🐘
PostgreSQL
When using the PostgreSQL app driver, first configure your PostgreSQL connection credentials using environment variables:
Name
Default
Possible values
Description
SOKETI_DB_POSTGRES_HOST
127.0.0.1
Any string
The PostgreSQL host.
SOKETI_DB_POSTGRES_PORT
3306
Any integer
The PostgreSQL port.
SOKETI_DB_POSTGRES_USERNAME
root
Any string
The PostgreSQL username.
SOKETI_DB_POSTGRES_PASSWORD
password
Any string
The PostgreSQL password.
SOKETI_DB_POSTGRES_DATABASE
main
Any string
The PostgreSQL database.
This database supports database connection pooling.
Once you have configured your PostgreSQL database credentials, you should create a table with the following structure:
1
CREATE TABLE IF NOT EXISTS apps (
2
id varchar(255) PRIMARY KEY,
3
"key" varchar(255) NOT NULL,
4
secret varchar(255) NOT NULL,
5
max_connections integer NOT NULL,
6
enable_client_messages smallint NOT NULL,
7
"enabled" smallint NOT NULL,
8
max_backend_events_per_sec integer NOT NULL,
9
max_client_events_per_sec integer NOT NULL,
10
max_read_req_per_sec integer NOT NULL,
11
max_presence_members_per_channel integer DEFAULT NULL,
12
max_presence_member_size_in_kb integer DEFAULT NULL,
13
max_channel_name_length integer DEFAULT NULL,
14
max_event_channels_at_once integer DEFAULT NULL,
15
max_event_name_length integer DEFAULT NULL,
16
max_event_payload_in_kb integer DEFAULT NULL,
17
max_event_batch_size integer DEFAULT NULL,
18
webhooks json
19
);
Copied!

Environment Variables

The following environment variables are used to define the behavior of the PostgreSQL app driver:
Name
Default
Possible values
Description
SOKETI_APP_MANAGER_POSTGRES_TABLE
apps
Any string
The table to pull the app data from.
SOKETI_APP_MANAGER_POSTGRES_VERSION
13.3
Any string
The PostgreSQL version (utilized by the underlying Knex database abstraction layer).

Limits on an app-by-app basis

To enforce app-level limits in PostgreSQL, there are multiple fields:
1
max_presence_members_per_channel integer DEFAULT NULL,
2
max_presence_member_size_in_kb integer DEFAULT NULL,
3
max_channel_name_length integer DEFAULT NULL,
4
max_event_channels_at_once integer DEFAULT NULL,
5
max_event_name_length integer DEFAULT NULL,
6
max_event_payload_in_kb integer DEFAULT NULL,
7
max_event_batch_size integer DEFAULT NULL
Copied!
Setting any of them to null or '' will ignore the setting, and use the limits associated with the server-level declared defaults.