Deployment: Docker Compose
Docker Compose runs the Next.js app and a local Postgres database. The app image is tagged with the project version from the root VERSION file.
Requirements
Docker Engine with Compose v2
Node.js only if you want to run local checks outside Docker
Versioned Image Tag
Before building, export the version from the root file:
PowerShell:
$env:PCP_VERSION = (Get-Content VERSION).Trim()
Bash:
export PCP_VERSION="$(cat VERSION)"
The default Compose image is personal-context-protocol:0.1.15. When VERSION changes, set PCP_VERSION to the new value before building so each release gets a distinct image tag.
Start Locally
npm run docker:up
npm run docker:up creates or repairs .env with random local credentials, builds the app, starts Postgres, initializes the database after Postgres is healthy, and prints the generated first-login token once in app container logs when PCP_ADMIN_TOKEN is empty. Log in with that token, then change it immediately in Settings.
Environment Variables
Compose provides local defaults for development. Override them when needed:
Name |
Default |
Purpose |
|---|---|---|
|
|
App image tag and Docker build version |
|
|
Host port mapped to the app container |
|
|
Public app URL used by clients |
|
Local placeholder |
32+ character instance secret |
|
Generated in |
Local Postgres password |
|
Generated in |
App connection string for the Compose Postgres service |
|
Empty |
Optional 32+ character admin/reset token |
Reset Admin Token With Env
If the database is already initialized and the admin token is lost:
Set
PCP_ADMIN_TOKENto a new 32+ character value.Recreate the app container:
docker compose up -d --build app
Log in with
PCP_ADMIN_TOKEN.To move the credential back into database-managed settings, unset
PCP_ADMIN_TOKEN, recreate the app container, then open Settings and set a custom admin token.
Build and runtime logs report whether PCP_ADMIN_TOKEN is configured. User-supplied PCP_ADMIN_TOKEN values are not printed. If deploy initialization generates a first-login token because PCP_ADMIN_TOKEN is empty, that generated token is printed once so the local deployment can log in without pre-seeded credentials.
Health Check
curl http://localhost:3000/api/v1/health
Expected response:
{
"status": "ok",
"version": "0.1.15",
"database": "pending"
}
Stop
docker compose down
To remove the local Postgres volume created for this version:
docker compose down -v