Recipes

Timescale

Self-hosted TimescaleDB — same POSTGRES_* contract as Postgres, hypertables included, driver stays postgres.

TimescaleDB is Postgres plus hypertables and time-series tooling. Pin a timescale/timescaledb image as store.sql and oke docker uses the Timescale recipe — same POSTGRES_* contract as plain Postgres. Driver id stays postgres.

The one rule

The driver id stays postgres — vendor choice lives in images["store.sql"]. Create the timescaledb extension in SQL when you need hypertables; the image ships it.

Quick start

Pin the image

oke.config.ts
images: {
  "store.sql": "timescale/timescaledb:latest-pg17", // pin a real tag
},

Bring the stack up

oke dev

Same credential contract as Postgres: POSTGRES_USER / POSTGRES_PASSWORD / POSTGRES_DB from OKE_STORE_SQL_*.

Enable the extension when you need it

CREATE EXTENSION IF NOT EXISTS timescaledb;

Then create hypertables with Timescale's usual DDL — Flows still talk through fx.store / Drizzle like any other Postgres.

Required env

VariableWho sets itMeaning
OKE_STORE_SQL_USERoke docker → composePOSTGRES_USER
OKE_STORE_SQL_PASSWORDoke docker → composePOSTGRES_PASSWORD
OKE_STORE_SQL_DBoke docker → composePOSTGRES_DB
DATABASE_URLstack env for the apppostgres://…:5432/…
PGDATAstack default/var/lib/postgresql/data/pgdata

Data and backup

PathWhat lives there
$PGDATACluster data, including Timescale catalogs
Image VOLUME /var/lib/postgresql/dataPersistence mount

Same backup story as plain Postgres: pg_dump / volume backup of /var/lib/postgresql/data. Losing that volume loses tables and extension state.

Production note

Pin a concrete tag (image + Postgres major). For multi-replica apps, keep one shared SQL backend — see Postgres · Production note.

Managed time-series hosts still use DATABASE_URL and drivers.store.sql: "postgres".

What the recipe configures

FieldValue
Matchtimescale ahead of generic postgres
Container port5432
Healthcheckpg_isready -U $POSTGRES_USER
Connection URLpostgres://user:pass@host:5432/db
Preloadtimescaledb,pg_stat_statements — Timescale first

Query performance

Keep timescaledb first

Overwriting command with only pg_stat_statements breaks hypertables. This recipe preloads timescaledb,pg_stat_statements. Then CREATE EXTENSION pg_stat_statements.

StepWhat you do
PreloadRecipe sets shared_preload_libraries=timescaledb,pg_stat_statements
CreateCREATE EXTENSION IF NOT EXISTS pg_stat_statements
ConsoleStore → SQL band → Performance

Index Advisor is not in the Timescale image. Pin oke-postgres-advisor:18-alpine only if you drop Timescale — or enable index_advisor on an image that ships it.

Troubleshooting

Learn more

Next

On this page