Local Docker workflow + Docker Compose self-host stack#96
Merged
Conversation
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.
5af666a to
bd3003f
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/Dockerfileanddocker/Dockerfile.postgres— no changes to either Dockerfile.What's included
Local server-in-Docker scripts (
package.json)pg→pg:docker; addedserver:build/server:docker/server:rm(Docker counterparts to thepg:*trio). The host-runserverscript is unchanged.server:dockerruns the production image in the foreground (--rm -t) against theme-postgrescontainer: logs scroll,Ctrl+Cshuts down gracefully, the container auto-removes. Reaches Postgres viahost.docker.internal(--add-host=...:host-gatewayfor Linux), loads.envwith--env-file, and overridesDATABASE_URLto the container-correct host.Docker Compose self-host stack (
compose.yaml, root)postgres+serverfrom the existing Dockerfiles on one network (server reaches the DB by service name).${POSTGRES_PASSWORD:?...}(fail-fast if unset), persistentpgdatavolume, healthcheck-gated startup, DB port unpublished. Overrides bothDATABASE_URLandWORKER_DATABASE_URL. No bun scripts.Docs
SELF_HOST.md: end-to-end guide — checkout a taggedserver/v*release, configure.env(with GitHub/Google OAuth setup links),docker compose up, build themeCLI from the same checkout, connect. Linked fromREADME.md.DEVELOPMENT.md: documents theserver:*Docker workflow and thepg→pg:dockerrename.Cleanups
/postgres(.env.sample,DEVELOPMENT.md) — aligns with the test/psqldefaults and makessetupa no-op..dockerignore: excludeddownload/,scratch/,queries/,packs/,*.mdto speed builds..env.sampleaudit: documentedWEB_DIST/WEB_ALLOWED_ORIGINS, addedPOSTGRES_PASSWORD, notedWORKER_DB_POOL_MAXdefault.Testing
docker buildofpackages/server/Dockerfile(viaserver:build) succeeds with the new.dockerignore.docker compose configrenders correctly withPOSTGRES_PASSWORDset, and fails fast with a clear message when unset.Notes