Update .env.example with new PUBLIC_BASE_URL, remove unused docker-compose.npm.yml and Caddyfile, and adjust docker-compose.yml to simplify network configuration. Revise deployment documentation to reflect changes in setup and clarify Nginx Proxy Manager integration.
If your network is not `npm_network`, edit `networks.default.name` in `docker-compose.yml`.
---
## 1. Clone and configure
```bash
cd /srv/docker-configs/warmbox # or your path
git pull # get latest docker-compose.yml
cp .env.example .env
nano .env
```
Required in `.env`:
Required variables:
```bash
ENCRYPTION_KEY=<64hexchars—opensslrand-hex32>
API_KEY=<opensslrand-hex24>
ENCRYPTION_KEY=<openssl rand-hex32> # never change after first deploy
API_KEY=<opensslrand-hex24> # dashboard login
PUBLIC_BASE_URL=https://warmbox.jonnyn.com
AI_API_KEY=sk-or-v1-...
```
Keep `ENCRYPTION_KEY` forever. If migrating from your Mac, copy the same key and `prisma/dev.db`.
**Migrating from your Mac:** use the **same**`ENCRYPTION_KEY` and copy `prisma/dev.db` (see §6).
---
## 2. Fix: “port 3000 already allocated”
Warmbox listens on **port 3000 inside its container**. That does **not** conflict with `homepage` using host port `3000` — unless you publish Warmbox to the host with a `ports:` mapping.
**NPM and Cloudflare Tunnel only need Docker network access** (`warmbox:3000`). No host port is required.
For tunnel-only access, let the **tunnel** own the hostname. In Cloudflare Zero Trust → your tunnel → **Public Hostname**:
| Field | Value |
|--------|--------|
| Subdomain | `warmbox` |
| Domain | `jonnyn.com` |
| Type | HTTP |
| URL | `warmbox:3000` |
Cloudflare usually creates a CNAME for you. You can **remove the A record** for `warmbox` if everything goes through the tunnel (avoids split routing).
### Step 1 — `.env`
## 6. Migrate local database (optional)
```bash
CLOUDFLARE_TUNNEL_TOKEN=eyJh... # from Zero Trust → Tunnels → your tunnel → Docker install
PUBLIC_BASE_URL=https://warmbox.jonnyn.com
```
# On your Mac
scp prisma/dev.db jonnyn@burke:/tmp/warmbox.db
### Step 2 — Start (no NPM override file)
```bash
docker compose --profile cloudflare up -d --build
```
`cloudflared` and `warmbox` share the `warmbox_internal` network — hostname `warmbox` resolves inside that network.
| SSL errors with Cloudflare proxy | Cloudflare SSL mode **Full** or **Full (strict)** when NPM terminates TLS |
### `port 3000 already allocated`
Your `docker-compose.yml` must **not** have a `ports:` section under `warmbox`:
```bash
grep ports docker-compose.yml
# should return nothing (or only comments)
```
Warmbox uses port 3000 **inside** the container only. `homepage` on host `0.0.0.0:3000` is unrelated.
### NPM 502 Bad Gateway
1. Warmbox running and healthy: `docker compose ps`
2. On `npm_network`: `docker inspect warmbox --format '{{json .NetworkSettings.Networks}}'`
3. NPM forward host is `warmbox` (not `localhost`, not `127.0.0.1`)
4. NPM forward port is `3000`
5. Logs: `docker compose logs warmbox`
### `network npm_network not found`
Create it or fix the name to match NPM:
```bash
docker network ls
# edit docker-compose.yml → networks.default.name
```
### Login fails
- `API_KEY` in `.env` must match what you type
- Restart after `.env` change: `docker compose up -d --force-recreate`
### Container unhealthy
```bash
docker compose logs warmbox
```
Common causes: missing `ENCRYPTION_KEY`, bad `DATABASE_URL`, migration error.
---
## Why only `npm_network`?
NPM and Warmbox must share a Docker network so NPM can resolve the hostname `warmbox`. A separate `warmbox_internal` network is unnecessary for this setup — one external network is enough.
See also [self-host-hardening.md](./self-host-hardening.md).
@ -21,9 +21,9 @@ npm run dev # API :3000, dashboard :5173
npm run build && npm run start
```
### Run on Ubuntu / VPS (Docker)
### Run on Ubuntu / VPS (Docker + Nginx Proxy Manager)
For a **30-day live test** without keeping your laptop on, see **[deploy-ubuntu-docker.md](./deploy-ubuntu-docker.md)** (Docker Compose + Cloudflare Tunnel or Caddy).
For a **30-day live test** without keeping your laptop on, see **[deploy-ubuntu-docker.md](./deploy-ubuntu-docker.md)**.