@@ -90,6 +90,92 @@ Dokploy guidance:
90904 . Expose container port ` 18080 ` .
91915 . Avoid build-from-source mode unless you are actively developing Engram itself.
9292
93+ ### VPS / self-hosted Compose
94+
95+ For a plain VPS, put secrets in a ` .env ` file next to your compose file instead of
96+ hardcoding them into YAML.
97+
98+ Directory layout:
99+
100+ ``` text
101+ /opt/engram/
102+ docker-compose.yml
103+ .env
104+ ```
105+
106+ Example ` .env ` :
107+
108+ ``` dotenv
109+ POSTGRES_USER=engram
110+ POSTGRES_PASSWORD=replace-with-strong-postgres-password
111+ POSTGRES_DB=engram_cloud
112+
113+ ENGRAM_DATABASE_URL=postgres://engram:replace-with-strong-postgres-password@postgres:5432/engram_cloud?sslmode=disable
114+ ENGRAM_CLOUD_TOKEN=replace-with-long-random-bearer-token
115+ ENGRAM_CLOUD_ADMIN=replace-with-separate-admin-token
116+ ENGRAM_JWT_SECRET=replace-with-32+-byte-random-secret
117+ ENGRAM_CLOUD_ALLOWED_PROJECTS=engram,gentle-ai
118+ ENGRAM_CLOUD_HOST=0.0.0.0
119+ ENGRAM_PORT=18080
120+ ```
121+
122+ Notes:
123+ - Keep ` .env ` on the server only. Do not commit it.
124+ - ` ENGRAM_CLOUD_TOKEN ` is the bearer token clients use for authenticated sync.
125+ - ` ENGRAM_CLOUD_ADMIN ` is the dashboard admin token. Use a different secret from ` ENGRAM_CLOUD_TOKEN ` .
126+ - ` ENGRAM_JWT_SECRET ` must be an explicit, non-default strong secret in authenticated mode.
127+ - ` ENGRAM_CLOUD_ALLOWED_PROJECTS ` is required server-side and should be a comma-separated allowlist.
128+
129+ Reference compose:
130+
131+ ``` yaml
132+ services :
133+ postgres :
134+ image : postgres:16-alpine
135+ restart : unless-stopped
136+ env_file :
137+ - .env
138+ environment :
139+ POSTGRES_USER : ${POSTGRES_USER}
140+ POSTGRES_PASSWORD : ${POSTGRES_PASSWORD}
141+ POSTGRES_DB : ${POSTGRES_DB}
142+ volumes :
143+ - engram-cloud-pg:/var/lib/postgresql/data
144+
145+ cloud :
146+ image : ghcr.io/gentleman-programming/engram:latest
147+ restart : unless-stopped
148+ depends_on :
149+ postgres :
150+ condition : service_healthy
151+ env_file :
152+ - .env
153+ ports :
154+ - " 18080:18080"
155+ ` ` `
156+
157+ Start or restart after editing ` .env`:
158+
159+ ` ` ` bash
160+ docker compose up -d
161+ docker compose restart cloud
162+ ` ` `
163+
164+ If you upgrade the `engram` image tag, redeploy or restart the container so the
165+ running server picks up the new binary.
166+
167+ # ## Client-side token setup
168+
169+ On the machine that runs the Engram CLI, set the client token in the shell before
170+ cloud sync :
171+
172+ ` ` ` bash
173+ engram cloud config --server https://your-host:18080
174+ export ENGRAM_CLOUD_TOKEN=replace-with-long-random-bearer-token
175+ engram cloud enroll my-project
176+ engram sync --cloud --project my-project
177+ ` ` `
178+
93179> `ENGRAM_CLOUD_INSECURE_NO_AUTH=1` is for local/dev smoke only. Never use it in production.
94180
95181---
0 commit comments