Skip to content

Local Docker workflow + Docker Compose self-host stack#96

Merged
jgpruitt merged 6 commits into
mainfrom
jgpruitt/docker
Jun 25, 2026
Merged

Local Docker workflow + Docker Compose self-host stack#96
jgpruitt merged 6 commits into
mainfrom
jgpruitt/docker

Conversation

@jgpruitt

Copy link
Copy Markdown
Collaborator

Summary

Makes it easy to build and run the app in Docker locally, and adds a Docker Compose stack for evaluating / self-hosting. Builds on the existing packages/server/Dockerfile and docker/Dockerfile.postgres — no changes to either Dockerfile.

What's included

Local server-in-Docker scripts (package.json)

  • Renamed pgpg:docker; added server:build / server:docker / server:rm (Docker counterparts to the pg:* trio). The host-run server script is unchanged.
  • server:docker runs the production image in the foreground (--rm -t) against the me-postgres container: logs scroll, Ctrl+C shuts down gracefully, the container auto-removes. Reaches Postgres via host.docker.internal (--add-host=...:host-gateway for Linux), loads .env with --env-file, and overrides DATABASE_URL to the container-correct host.

Docker Compose self-host stack (compose.yaml, root)

  • postgres + server from the existing Dockerfiles on one network (server reaches the DB by service name).
  • Password auth via ${POSTGRES_PASSWORD:?...} (fail-fast if unset), persistent pgdata volume, healthcheck-gated startup, DB port unpublished. Overrides both DATABASE_URL and WORKER_DATABASE_URL. No bun scripts.

Docs

  • New SELF_HOST.md: end-to-end guide — checkout a tagged server/v* release, configure .env (with GitHub/Google OAuth setup links), docker compose up, build the me CLI from the same checkout, connect. Linked from README.md.
  • DEVELOPMENT.md: documents the server:* Docker workflow and the pgpg:docker rename.

Cleanups

  • Standardized the local DB name on /postgres (.env.sample, DEVELOPMENT.md) — aligns with the test/psql defaults and makes setup a no-op.
  • .dockerignore: excluded download/, scratch/, queries/, packs/, *.md to speed builds.
  • .env.sample audit: documented WEB_DIST / WEB_ALLOWED_ORIGINS, added POSTGRES_PASSWORD, noted WORKER_DB_POOL_MAX default.

Testing

  • docker build of packages/server/Dockerfile (via server:build) succeeds with the new .dockerignore.
  • docker compose config renders correctly with POSTGRES_PASSWORD set, and fails fast with a clear message when unset.

Notes

  • No application/runtime code changed — scripts, compose, ignore rules, and docs only.

@jgpruitt jgpruitt requested a review from cevian June 24, 2026 22:41
jgpruitt added 5 commits June 25, 2026 09:28
Add `server:build`/`server:docker`/`server:rm` (Docker counterparts to the
`pg:*` trio) that build the existing packages/server/Dockerfile and run it
against the me-postgres container, overriding DATABASE_URL to
host.docker.internal and loading the rest from --env-file .env.

Rename `pg` -> `pg:docker` for symmetry, standardize the local DB name on
`/postgres` (aligns with the test/psql defaults; makes setup a no-op), trim
the build context (download/, scratch/, queries/, packs/, *.md), and document
the workflow in DEVELOPMENT.md.
Audit of server-side process.env reads vs .env.sample: add the two missing
optional server knobs (WEB_DIST, WEB_ALLOWED_ORIGINS) and note that
WORKER_DB_POOL_MAX defaults to max(WORKER_COUNT, 1). Deliberately leaves
SPACE_SCHEMA_PREFIX undocumented and omits the dead OPENAI_API_KEY fallback
and the deprecated ENGINE_DATABASE_URL alias.
Add a root compose.yaml that runs the existing Postgres and server Dockerfiles
as a self-host/evaluate stack: server reaches Postgres over the compose
network, DATABASE_URL/WORKER_DATABASE_URL overridden from .env, password-based
auth via ${POSTGRES_PASSWORD:?} (fail-fast), persistent pgdata volume,
healthcheck-gated startup, DB port unpublished.

Add SELF_HOST.md walking through it end to end — checkout a tagged server/v*
release, configure .env (incl. OAuth provider setup links), docker compose up,
build the me CLI from the same checkout, and connect. Document POSTGRES_PASSWORD
in .env.sample and link the guide from README.
Switch the server:docker script from detached (-d) to foreground (--rm -t) so
logs scroll in the terminal and Ctrl+C does a graceful shutdown, with the
container auto-removed on exit. Update DEVELOPMENT.md accordingly.
The commented telemetry vars showed enable/change values, not defaults
(e.g. # LOGFIRE_CONSOLE=true implied console was on by default when it is
off). Keep the actionable value but state the real default in each comment,
matching the file's "commented = default" convention for scalar vars. Also
note LOGFIRE_TOKEN is project-scoped.
The better-auth migration introduced a required BETTER_AUTH_SECRET (the
server refuses to boot without it) and renamed DEVICE_FLOW_CLEANUP_CRON to
AUTH_CLEANUP_CRON (legacy name still honored). Document both in .env.sample.
@jgpruitt jgpruitt merged commit 556c641 into main Jun 25, 2026
4 checks passed
@jgpruitt jgpruitt deleted the jgpruitt/docker branch June 25, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant