docs: document VITE_API_BASE_URL and VITE_BASE_URL runtime configuration

- Add VITE_BASE_URL to frame-cms environment in docker-compose.yml (default /)
- Add inline comments explaining both CMS env vars
- Expand README with a runtime environment variables table and
  a subpath deployment example (e.g. serving CMS at /admin)
This commit is contained in:
2026-03-22 14:16:40 +01:00
parent e9223d8e16
commit 0952c1abc9
2 changed files with 36 additions and 9 deletions

View File

@@ -33,12 +33,6 @@ Edit `backend.env` and at minimum set:
| `FRONTEND_BASE_URL` | Same URL (used in email links) | | `FRONTEND_BASE_URL` | Same URL (used in email links) |
| `SMTP_*` | Optional — needed for email verification | | `SMTP_*` | Optional — needed for email verification |
`VITE_API_BASE_URL` for frame-cms defaults to `http://localhost:8080`. Override it in `docker-compose.yml` or via env:
```bash
VITE_API_BASE_URL=https://api.example.com docker compose up -d
```
### 3. Pull images and start ### 3. Pull images and start
```bash ```bash
@@ -51,13 +45,41 @@ Services will be available at:
- **CMS:** http://localhost:3000 - **CMS:** http://localhost:3000
- **API:** http://localhost:8080 - **API:** http://localhost:8080
Ports can be overridden via environment variables before `docker compose up`: ---
## Runtime environment variables
Both CMS variables are injected at container startup — **no image rebuild needed**.
### frame-cms
| Variable | Default | Description |
|---|---|---|
| `VITE_API_BASE_URL` | `http://localhost:8080` | URL of the backend API as seen by the browser |
| `VITE_BASE_URL` | `/` | Base path where the CMS is served |
| `CMS_PORT` | `3000` | Host port for the CMS container |
### frame-backend
| Variable | Default | Description |
|---|---|---|
| `BACKEND_PORT` | `8080` | Host port for the backend container |
### Subpath deployment example
To serve the CMS at `https://frame.example.com/admin` and the API at `https://frame.example.com/api`:
```bash ```bash
BACKEND_PORT=9090 CMS_PORT=4000 docker compose up -d # .env
VITE_API_BASE_URL=https://frame.example.com/api
VITE_BASE_URL=/admin
``` ```
### 4. Create an admin user (first time only) Then in your reverse proxy, strip `/api` before forwarding to the backend.
---
## Create an admin user (first time only)
If SMTP is not configured, email verification won't work — you'll need to manually verify the user in the DB: If SMTP is not configured, email verification won't work — you'll need to manually verify the user in the DB:

View File

@@ -31,7 +31,12 @@ services:
depends_on: depends_on:
- frame-backend - frame-backend
environment: environment:
# URL of the backend API as seen by the browser.
# Override this when the API is not at the default path.
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-http://localhost:8080} VITE_API_BASE_URL: ${VITE_API_BASE_URL:-http://localhost:8080}
# Base path where the CMS is served (e.g. /admin for frame.example.com/admin).
# Defaults to / (served at the root).
VITE_BASE_URL: ${VITE_BASE_URL:-/}
ports: ports:
- "${CMS_PORT:-3000}:80" - "${CMS_PORT:-3000}:80"
healthcheck: healthcheck: