Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/examples/control_plane/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
x-pgdog: &pgdog
image: ghcr.io/pgdogdev/pgdog-enterprise:v2026-07-09
image: ghcr.io/pgdogdev/pgdog-enterprise:v2026-09-03-2023
command:
[
"pgdog",
Expand Down Expand Up @@ -43,7 +43,7 @@ services:
image: redis:7

control:
image: ghcr.io/pgdogdev/pgdog-enterprise/control:v2026-07-09
image: ghcr.io/pgdogdev/pgdog-enterprise/control:v2026-09-03-2023
ports:
- "8099:8080"
environment:
Expand Down
209 changes: 209 additions & 0 deletions docs/examples/docker-compose-sharded.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
services:
# Databases
shard_0:
image: postgres:17
# entrypoint: ["/bin/sh", "-c", "exec docker-entrypoint.sh postgres >/dev/null 2>&1"]
configs:
- source: postgres_setup
target: /docker-entrypoint-initdb.d/setup.sql
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
shard_1:
image: postgres:17
# entrypoint: ["/bin/sh", "-c", "exec docker-entrypoint.sh postgres >/dev/null 2>&1"]
configs:
- source: postgres_setup
target: /docker-entrypoint-initdb.d/setup.sql
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
shard_2:
image: postgres:17
# entrypoint: ["/bin/sh", "-c", "exec docker-entrypoint.sh postgres >/dev/null 2>&1"]
configs:
- source: postgres_setup
target: /docker-entrypoint-initdb.d/setup.sql
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5

# Redis
redis:
image: redis:7

# Control plane with Raft
control:
image: ghcr.io/pgdogdev/pgdog-enterprise/control:9b3698eb
ports:
- "8099:8080"
environment:
RUST_LOG: warn
RAFT_NODE_ID: "pgdog-control-1"
CONTROL_CONFIG: /etc/pgdog-control/control.toml
configs:
- source: control_config
target: /etc/pgdog-control/control.toml
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:8080/healthz || exit 1"]
interval: 5s
timeout: 5s
retries: 5
depends_on:
redis:
condition: service_started

# The dog!
pgdog:
image: ghcr.io/pgdogdev/pgdog-enterprise:9b3698eb
command:
[
"pgdog",
"--config",
"/etc/pgdog/pgdog.toml",
"--users",
"/etc/secrets/pgdog/users.toml",
]
mem_limit: 1g
environment:
PGPASSWORD: postgres
healthcheck:
test:
[
"CMD-SHELL",
"psql -h 127.0.0.1 -p 6432 -U postgres -d postgres -tAc 'SELECT 1' || exit 1",
]
interval: 5s
timeout: 5s
retries: 5
depends_on:
shard_0:
condition: service_healthy
shard_1:
condition: service_healthy
shard_2:
condition: service_healthy
control:
condition: service_healthy
ports:
- "6432:6432"
configs:
- source: pgdog_config
target: /etc/pgdog/pgdog.toml
- source: pgdog_users
target: /etc/secrets/pgdog/users.toml

configs:
# Shared SQL for all shards; runs only when initializing an empty data directory.
postgres_setup:
content: |
-- sharded table
CREATE TABLE users (
id BIGINT PRIMARY KEY,
email VARCHAR NOT NULL,
tenant_id BIGINT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

-- omnisharded table
CREATE TABLE settings (
id BIGINT PRIMARY KEY,
name VARCHAR NOT NULL,
value VARCHAR NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

-- sharded table with reference to omnisharded table
CREATE TABLE user_settings (
id BIGINT PRIMARY KEY,
user_id BIGINT NOT NULL REFERENCES users(id),
tenant_id BIGINT NOT NULL,
setting_id BIGINT NOT NULL REFERENCES settings(id),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

control_config:
content: |
[redis]
url = "redis://redis:6379"

[raft]
cluster_name = "pgdog"
storage_path = "/tmp/raft.redb"
token = "raft-auth-token"

[[raft.members]]
id = 1
address = "127.0.0.1:8080"

pgdog_config:
content: |
[general]
port = 6432
load_schema = "on"

[[databases]]
name = "postgres"
host = "shard_0"
shard = 0
port = 5432

[[databases]]
name = "postgres"
host = "shard_1"
shard = 1
port = 5432

[[databases]]
name = "postgres"
host = "shard_2"
shard = 2
port = 5432

[[sharded_tables]]
database = "postgres"
column = "tenant_id"

[rewrite]
primary_key = "rewrite_omni_global"
split_inserts = "rewrite"

[control]
endpoint = "http://control:8080"
token = "pgdog"

[admin]
user = "pgdog"
password = "pgdog"

[query_stats]
enabled = true

[qos]
enabled = true

pgdog_users:
content: |
[[users]]
name = "postgres"
password = "postgres"
database = "postgres"
schema_admin = true
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Latest released tag for the Enterprise Docker images. Update this in one
# place; reference it in docs with {{ enterprise_tag }}. Can be overridden at
# build time with the ENTERPRISE_TAG environment variable.
ENTERPRISE_TAG = os.environ.get("ENTERPRISE_TAG", "v2026-07-25")
ENTERPRISE_TAG = os.environ.get("ENTERPRISE_TAG", "v2026-09-03-2023")


def define_env(env):
Expand Down
Loading