Merge pull request 'Make the app port configurable (PORT)' (#4) from feat/configurable-port into main
Reviewed-on: #4
This commit is contained in:
commit
1c691cd54f
5 changed files with 18 additions and 10 deletions
6
SPEC.md
6
SPEC.md
|
|
@ -506,7 +506,7 @@ e2e/ Playwright tests
|
|||
## 13. Deployment (podman compose, with or without the panel)
|
||||
|
||||
`compose.yaml` (repo root) runs the `app` service: the Node server, which
|
||||
also serves the built static client, on port 8080 with its data in the
|
||||
also serves the built static client, on port 8080 (`PORT`) with its data in the
|
||||
`oweme-data` volume. It works with **zero configuration**: VAPID keys are
|
||||
generated on first start and stored in the volume (`vapid.json`, mode 600),
|
||||
and the push contact defaults to `https://<site domain>`.
|
||||
|
|
@ -514,11 +514,11 @@ and the push contact defaults to `https://<site domain>`.
|
|||
Every setting is an optional environment variable, written in `compose.yaml`
|
||||
as `${VAR:-default}` so it is visible and documented in one place:
|
||||
`MAX_PHOTO_BYTES`, `MAX_EVENT_BYTES`, `MAX_GROUP_BYTES`,
|
||||
`GROUP_CREATE_PER_HOUR`, `VAPID_SUBJECT`, `VAPID_PUBLIC_KEY` /
|
||||
`GROUP_CREATE_PER_HOUR`, `PORT`, `VAPID_SUBJECT`, `VAPID_PUBLIC_KEY` /
|
||||
`VAPID_PRIVATE_KEY` (pin keys), `PUSH_DISABLED`.
|
||||
|
||||
- **With the panel** (the main target): the panel clones the repo, finds
|
||||
`compose.yaml` at the root, routes the app's domain to `app:8080` through
|
||||
`compose.yaml` at the root, routes the app's domain to `app:$PORT` through
|
||||
its own Caddy (HTTPS) and passes the Environment tab's variables to
|
||||
compose for `${VAR}` interpolation. "Pass to every container" must stay
|
||||
off until the panel's injection override stops clashing with variables the
|
||||
|
|
|
|||
13
compose.yaml
13
compose.yaml
|
|
@ -2,7 +2,8 @@
|
|||
# overridden with an environment variable (in the panel's Environment tab,
|
||||
# or in a .env file next to this file).
|
||||
#
|
||||
# With the panel: point the app's domain at service `app`, port 8080.
|
||||
# With the panel: point the app's domain at service `app`, port $PORT
|
||||
# (8080 unless you set PORT).
|
||||
# The panel's Caddy provides HTTPS.
|
||||
# Standalone (no panel): set DOMAIN and run
|
||||
# podman compose --profile standalone up -d --build
|
||||
|
|
@ -34,19 +35,21 @@ services:
|
|||
VAPID_PRIVATE_KEY: ${VAPID_PRIVATE_KEY:-}
|
||||
# 1 = turn push notifications off.
|
||||
PUSH_DISABLED: ${PUSH_DISABLED:-0}
|
||||
# Port the app listens on inside the container. If you change it,
|
||||
# point the panel's domain at the new port too.
|
||||
PORT: ${PORT:-8080}
|
||||
# Fixed for the container; no need to change these.
|
||||
HOST: 0.0.0.0
|
||||
PORT: "8080"
|
||||
DATA_DIR: /data
|
||||
STATIC_DIR: /app/web
|
||||
TRUST_PROXY: "1"
|
||||
volumes:
|
||||
- oweme-data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8080/api/health"]
|
||||
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:${PORT:-8080}/api/health"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
# No ports: the panel publishes 8080 for its routes; standalone, only
|
||||
# No ports: the panel publishes $PORT for its routes; standalone, only
|
||||
# Caddy reaches the app.
|
||||
|
||||
caddy:
|
||||
|
|
@ -58,6 +61,8 @@ services:
|
|||
environment:
|
||||
# Public hostname for standalone HTTPS (needs a DNS record).
|
||||
DOMAIN: ${DOMAIN:-localhost}
|
||||
# Where Caddy finds the app (same as the app's PORT).
|
||||
APP_PORT: ${PORT:-8080}
|
||||
ports:
|
||||
# Rootless Podman can't bind ports below 1024 by default; see
|
||||
# deploy/README.md "Ports".
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# Security headers (CSP etc.) are set by the app itself.
|
||||
{$DOMAIN} {
|
||||
encode zstd gzip
|
||||
reverse_proxy app:8080 {
|
||||
reverse_proxy app:{$APP_PORT:8080} {
|
||||
# Server-Sent Events: don't buffer
|
||||
flush_interval -1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,5 +25,6 @@ COPY --from=build /src/apps/web/dist ./web
|
|||
RUN mkdir -p /data && chown node:node /data
|
||||
USER node
|
||||
VOLUME /data
|
||||
# Default port; compose sets PORT (see compose.yaml).
|
||||
EXPOSE 8080
|
||||
CMD ["node", "--disable-warning=ExperimentalWarning", "server/main.ts"]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Deploying OweMe
|
||||
|
||||
`compose.yaml` (repo root) runs the **app** container: the Node server plus
|
||||
the built web client, listening on port 8080, with its data in the
|
||||
the built web client, listening on port 8080 (or `PORT`), with its data in the
|
||||
`oweme-data` volume. It needs **no configuration**: push keys are generated
|
||||
on first start and kept in the volume. Every setting is an optional
|
||||
environment variable, listed with its default in `compose.yaml`.
|
||||
|
|
@ -13,7 +13,8 @@ container enabled with the `standalone` profile.
|
|||
|
||||
1. **New app → Git repository**: this repo, branch `main`. The panel finds
|
||||
`compose.yaml` in the repository root.
|
||||
2. **Domain**: point it at service **`app`**, port **`8080`**. The panel
|
||||
2. **Domain**: point it at service **`app`**, port **`8080`** (or the
|
||||
`PORT` you set in the Environment tab). The panel
|
||||
publishes the port on 127.0.0.1 and its Caddy serves HTTPS.
|
||||
3. **Environment** (optional): any variable from `compose.yaml`, for example
|
||||
`MAX_PHOTO_BYTES=5242880` or `VAPID_SUBJECT=mailto:you@example.com`.
|
||||
|
|
@ -72,6 +73,7 @@ standalone deploy.
|
|||
| `VAPID_SUBJECT` | `https://<site domain>` | Contact sent to push services |
|
||||
| `VAPID_PUBLIC_KEY` / `VAPID_PRIVATE_KEY` | generated | Pin push keys (set both); otherwise kept in the volume as `vapid.json` |
|
||||
| `PUSH_DISABLED` | `0` | `1` turns push notifications off |
|
||||
| `PORT` | `8080` | Port the app listens on inside the container (the panel's domain must target it) |
|
||||
| `DOMAIN` | `localhost` | Standalone only: Caddy's site address and certificate |
|
||||
| `BIND_ADDR` | `0.0.0.0` | Standalone only: address Caddy's ports are published on |
|
||||
| `HTTP_PORT` / `HTTPS_PORT` | `80` / `443` | Standalone only: host ports for Caddy |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue