Local PostgreSQL Development Setup
Audience
This page is for maintainers and developers who need a local AiOS control-plane workflow backed by external state rather than in-process stubs.Goal and Scope
This page explains how to:- start a local PostgreSQL instance with the repository-provided Docker Compose file
- apply the current schema migrations
- launch
go run ./cmd/aioswith PostgreSQL-backed module wiring
Core Concepts
- the repository’s real external state path is PostgreSQL, not SQLite
cmd/aiosnow requirespostgres.dsnindevmode and no longer silently falls back to in-memory repositoriesmake migrate-upandmake migrate-downwrap thegolang-migratemigrateCLI
Standard Workflow
1. Enter the repository root
2. Start local PostgreSQL
3. Set AiOS runtime environment variables
AIOS_RUNTIME__MODE=devkeeps the current local-development runtime semanticsdevnow requires PostgreSQL to be available; onlybootstrapmay start without a DSNAIOS_DEV_COMPOSE_PROJECTisolates Compose resource names across worktrees or developersAIOS_DEV_POSTGRES_PORTlets you avoid an existing local5432AIOS_POSTGRES__DSNoverridespostgres.dsnDATABASE_URLis consumed by the migration command
4. Run migrations
migrate is not installed on your machine yet, install golang-migrate first because the current Makefile calls it directly.
5. Start the current server/bootstrap entry
6. Verify the service is using external state
CLI Examples
Web UI Path
This page is about local control-plane development and does not map to a single product UI screen. Once the service is running, you can open the web frontend or call the frozen HTTP APIs directly.Pitfalls / Risk Notes
1. Running only go run ./cmd/aios without a DSN
In that case, dev mode now fails fast. Only bootstrap may start without a DSN, and that path still exists only as a temporary stub rather than an external-state development loop.
2. make migrate-up fails with migrate: command not found
That means golang-migrate is missing from your PATH. Install it first, then rerun the migration step.
3. PostgreSQL is up but the app still cannot connect
Check:AIOS_POSTGRES__DSN- whether
AIOS_DEV_POSTGRES_PORTmatches the port in the DSN - whether
AIOS_DEV_COMPOSE_PROJECTpoints to the same Compose resource set you started - whether the container health check has passed