# Evaluate / self-host stack: PostgreSQL + the Memory Engine server. # # Usage: # cp .env.sample .env # set EMBEDDING_API_KEY, POSTGRES_PASSWORD, an OAuth provider # docker compose up --build # # Server: http://localhost:3000 # # This stack is the backend only. To use it you also need a client — the `me` # CLI (or another MCP client) — pointed at http://localhost:3000. See # SELF_HOST.md for the full walkthrough (including building the CLI). services: postgres: build: context: ./docker dockerfile: Dockerfile.postgres environment: POSTGRES_USER: postgres POSTGRES_DB: postgres POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env} volumes: # PostgreSQL 18 moved PGDATA to /var/lib/postgresql//docker and the # image VOLUME to /var/lib/postgresql (docker-library/postgres#1259). Mount # the named volume at that parent so data actually persists to `pgdata`; # the pre-18 /var/lib/postgresql/data path would miss the data dir. - pgdata:/var/lib/postgresql healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"] interval: 5s timeout: 5s retries: 10 start_period: 10s restart: unless-stopped # The DB is reachable only on the internal compose network. To use psql from # the host, uncomment below (conflicts with `./bun run pg:docker`, which # already binds 5432): # ports: # - "127.0.0.1:5432:5432" server: build: context: . dockerfile: packages/server/Dockerfile env_file: .env # Override both DB URLs from .env (host-oriented localhost) so the server # reaches the postgres service over the compose network. `environment` # takes precedence over `env_file`. environment: DATABASE_URL: postgres://postgres:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}@postgres:5432/postgres WORKER_DATABASE_URL: postgres://postgres:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}@postgres:5432/postgres # Fail fast with a clear message if the required signing secret is missing, # rather than letting the server boot and crash. Generate one with # `openssl rand -base64 32`. See SELF_HOST.md / .env.sample. BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET:?set BETTER_AUTH_SECRET in .env} ports: - "3000:3000" depends_on: postgres: condition: service_healthy restart: unless-stopped volumes: pgdata: