Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
devportal-offline / build-offline (push) Has been cancelled
2.8 KiB
2.8 KiB
Local PostgreSQL for StellaOps (Scheduler focus)
This doc describes how to bring up a local PostgreSQL 17 instance for Scheduler development and tests.
Quick start (Docker)
# from repo root
docker compose -f ops/devops/local-postgres/docker-compose.yml up -d
Defaults:
- Host/Port:
localhost:5432 - User:
stella - Password:
stella - Database:
stella
Verify:
docker ps --filter name=stella-postgres
docker exec -it stella-postgres psql -U stella -d stella -c 'select version();'
Stop/cleanup:
docker compose -f ops/devops/local-postgres/docker-compose.yml down
# keep data
docker volume ls | grep stella-postgres-data
# remove data volume if you want a clean slate
docker volume rm stella-postgres-data
Connection strings
- ADO.NET:
Host=localhost;Port=5432;Username=stella;Password=stella;Database=stella;Include Error Detail=true - Npgsql env example:
PGHOST=localhostPGPORT=5432PGUSER=stellaPGPASSWORD=stellaPGDATABASE=stella
Using with Scheduler Postgres storage
- Scheduler Postgres repositories connect via
SchedulerDataSourceusing tenant-aware connections; for local work set your appsettings or environment to the connection string above. - Integration tests currently rely on Testcontainers; if Docker is available the tests will spin up their own isolated container. When Docker is unavailable, run against this local instance by exporting the variables above and disabling Testcontainers in your local run configuration if supported.
Notes
- Image:
postgres:17(latest GA at time of writing). - Healthcheck is built into the compose service; wait for
healthybefore running tests. - Keep volumes deterministic: the compose file names the volume
stella-postgres-data.
Scheduler Mongo → Postgres backfill
Use the new Scheduler.Backfill tool to copy Scheduler data from MongoDB into the Postgres schema.
dotnet run \
--project src/Scheduler/Tools/Scheduler.Backfill/Scheduler.Backfill.csproj \
--mongo "${MONGO_CONNECTION_STRING:-mongodb://localhost:27017}" \
--mongo-db "${MONGO_DATABASE:-stellaops_scheduler}" \
--pg "Host=localhost;Port=5432;Username=stella;Password=stella;Database=stella" \
--batch 500
Flags:
--dry-runto validate without writing.--batchto tune insert batch size (defaults to 500).
What it does:
- Reads
schedulesandrunscollections. - Serialises documents with
CanonicalJsonSerializerfor deterministic JSON. - Upserts into
scheduler.schedulesandscheduler.runstables (created by migration001_initial_schema.sql).
Verification tips:
- Compare counts after backfill:
select count(*) from scheduler.schedules;and...runs;. - Spot-check next-fire timing by comparing
cron_expressionandtimezonewith the Mongo source; deterministic ordering is preserved via canonical JSON.