Skip to content

Commit 64d1129

Browse files
committed
docs: reconcile deployment env guidance
1 parent 50d63e0 commit 64d1129

6 files changed

Lines changed: 93 additions & 31 deletions

File tree

examples/deployment/.env

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Domain & routing
2+
CADDY_HOST=example.com
3+
4+
# Core runtime
5+
RACK_ENV=production
6+
7+
# Security
8+
# Generate with: openssl rand -hex 32
9+
HTML2RSS_SECRET_KEY=replace-with-64-hex-characters-generated-by-openssl-rand-hex-32
10+
11+
# Authenticated health endpoint token
12+
# Required by the documented Compose stack.
13+
# If you build a custom stack and probe only /api/v1/health/live and /api/v1/health/ready,
14+
# you can omit this value.
15+
HEALTH_CHECK_TOKEN=replace-with-strong-health-token
16+
17+
# Auto source (optional; keep false unless you need automatic feed generation)
18+
AUTO_SOURCE_ENABLED=false
19+
20+
# Observability (optional)
21+
#SENTRY_DSN=
22+
23+
# Performance tuning (override defaults only when needed)
24+
WEB_CONCURRENCY=2
25+
WEB_MAX_THREADS=5
26+
RACK_TIMEOUT_SERVICE_TIMEOUT=15

examples/deployment/docker-compose.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
services:
22
html2rss-web:
33
image: html2rss/web:latest
4-
env_file: .env
4+
restart: unless-stopped
5+
env_file:
6+
- path: .env
7+
required: false
8+
environment:
9+
PORT: 4000
510

611
caddy:
712
image: caddy:2-alpine
@@ -28,9 +33,7 @@ services:
2833
command:
2934
- --cleanup
3035
- --interval
31-
- "300"
32-
- html2rss-web
33-
- caddy
36+
- "7200"
3437
volumes:
3538
- /var/run/docker.sock:/var/run/docker.sock:ro
3639
restart: unless-stopped

src/components/docs/DockerComposeSnippet.astro

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const snippets: Record<Props["variant"], string> = {
2121
environment:
2222
RACK_ENV: production
2323
PORT: 4000
24+
BUILD_TAG: \${BUILD_TAG:-local}
25+
GIT_SHA: \${GIT_SHA:-local}
2426
HTML2RSS_SECRET_KEY: \${HTML2RSS_SECRET_KEY:?set HTML2RSS_SECRET_KEY}
2527
HEALTH_CHECK_TOKEN: \${HEALTH_CHECK_TOKEN:?set HEALTH_CHECK_TOKEN}
2628
SENTRY_DSN: \${SENTRY_DSN:-}
@@ -35,7 +37,7 @@ const snippets: Record<Props["variant"], string> = {
3537
environment:
3638
PORT: 4002
3739
CONCURRENT: 10
38-
TOKEN: your-browserless-token`,
40+
TOKEN: \${BROWSERLESS_IO_API_TOKEN:?set BROWSERLESS_IO_API_TOKEN}`,
3941
productionCaddy: `services:
4042
caddy:
4143
image: ${caddyImage}
@@ -62,6 +64,8 @@ const snippets: Record<Props["variant"], string> = {
6264
environment:
6365
RACK_ENV: production
6466
PORT: 4000
67+
BUILD_TAG: \${BUILD_TAG:-local}
68+
GIT_SHA: \${GIT_SHA:-local}
6569
HTML2RSS_SECRET_KEY: \${HTML2RSS_SECRET_KEY:?set HTML2RSS_SECRET_KEY}
6670
HEALTH_CHECK_TOKEN: \${HEALTH_CHECK_TOKEN:?set HEALTH_CHECK_TOKEN}
6771
SENTRY_DSN: \${SENTRY_DSN:-}
@@ -88,6 +92,8 @@ volumes:
8892
environment:
8993
RACK_ENV: production
9094
PORT: 4000
95+
BUILD_TAG: \${BUILD_TAG:-local}
96+
GIT_SHA: \${GIT_SHA:-local}
9197
HTML2RSS_SECRET_KEY: \${HTML2RSS_SECRET_KEY:?set HTML2RSS_SECRET_KEY}
9298
HEALTH_CHECK_TOKEN: \${HEALTH_CHECK_TOKEN:?set HEALTH_CHECK_TOKEN}
9399
SENTRY_DSN: \${SENTRY_DSN:-}
@@ -106,7 +112,7 @@ volumes:
106112
image: ${watchtowerImage}
107113
restart: unless-stopped
108114
volumes:
109-
- /var/run/docker.sock:/var/run/docker.sock
115+
- /var/run/docker.sock:/var/run/docker.sock:ro
110116
# Optional for private registries only:
111117
# - "\${HOME}/.docker/config.json:/config.json:ro"
112118
command: --cleanup --interval 7200`,

src/content/docs/web-application/how-to/automatic-updates.mdx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@ sidebar:
55
order: 10
66
---
77

8-
The [watchtower](https://containrrr.dev/watchtower/) service automatically pulls running Docker images and checks for updates. If an update is available, it will automatically start the updated image with the same configuration as the running one. Please read its manual.
8+
import DockerComposeSnippet from "../../../../components/docs/DockerComposeSnippet.astro";
99

10-
The `docker-compose.yml` in the [Installation Guide](/web-application/getting-started#installation-guide) contains a service description for watchtower.
10+
Use [watchtower](https://containrrr.dev/watchtower/) to periodically pull and restart containers when newer images are available.
11+
12+
Add this service to your existing `docker-compose.yml`:
13+
14+
<DockerComposeSnippet variant="watchtower" />
15+
16+
Then restart the stack:
17+
18+
```bash
19+
docker compose up -d
20+
```
21+
22+
Operational note:
23+
24+
- Keep the Docker socket mount (read-only in this example).
25+
- Add the optional Docker config mount only if you pull private images that require registry auth.
26+
- The shown Watchtower command updates all running containers by default.
27+
- Check `docker compose logs watchtower` to confirm scans and update runs.

src/content/docs/web-application/how-to/deployment.mdx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ Before exposing html2rss-web, ensure:
2727
- Your domain (for example `yourdomain.com`) resolves to the host running Docker
2828
- Inbound TCP ports 80 and 443 reach the host (check firewalls and cloud security groups)
2929
- You are ready to watch the first deployment logs for certificate issuance
30-
- You have values ready for `HTML2RSS_SECRET_KEY` and `HEALTH_CHECK_TOKEN`
30+
- You have a value ready for `HTML2RSS_SECRET_KEY`
31+
- You have a value ready for `HEALTH_CHECK_TOKEN` (required by the documented Compose stack)
3132

3233
If you plan to enable automatic feed generation, also prepare:
3334

@@ -47,20 +48,27 @@ Caddy handles certificates and redirects with almost no configuration.
4748

4849
- Create a `.env` file beside your compose file with the following variables:
4950

50-
```bash
51+
```env
5152
# Required for reverse proxy and application
5253
CADDY_HOST=yourdomain.com
53-
HTML2RSS_SECRET_KEY= # Generate with: openssl rand -hex 32
54-
HEALTH_CHECK_TOKEN= # Generate a strong token for /api/v1/health
55-
BROWSERLESS_IO_API_TOKEN= # Required by the default compose stack
56-
# Optional: see [environment reference](/web-application/reference/env-variables)
54+
# Generate with: openssl rand -hex 32
55+
HTML2RSS_SECRET_KEY=
56+
# Required by the documented Compose stack
57+
HEALTH_CHECK_TOKEN=
58+
# Required by the default compose stack
59+
BROWSERLESS_IO_API_TOKEN=
60+
# Recommended for production traceability (compose defaults to local)
61+
BUILD_TAG=
62+
# Recommended for production traceability (compose defaults to local)
63+
GIT_SHA=
5764
```
5865

5966
- Update your `.env` before starting the stack:
6067
- Set `CADDY_HOST` for your domain.
6168
- Generate a production secret (`openssl rand -hex 32`) and assign it to `HTML2RSS_SECRET_KEY`.
62-
- Generate a strong `HEALTH_CHECK_TOKEN` for `/api/v1/health`.
63-
- Adjust optional knobs such as `AUTO_SOURCE_ENABLED`, `SENTRY_DSN`, `BUILD_TAG`, and `GIT_SHA` as needed; refer to the [environment reference](/web-application/reference/env-variables) for details.
69+
- Set a strong `HEALTH_CHECK_TOKEN` (required by the documented Compose stack).
70+
- Set `BUILD_TAG` and `GIT_SHA` to real release metadata for production.
71+
- Adjust optional knobs such as `AUTO_SOURCE_ENABLED` and `SENTRY_DSN` as needed; refer to the [environment reference](/web-application/reference/env-variables) for details.
6472
- After `docker compose up -d`, run `docker compose logs caddy --tail 20`; look for `certificate obtained`.
6573
- Re-test after DNS changes with [SSL Labs](https://www.ssllabs.com/ssltest/).
6674
- Want automatic updates? Add the Watchtower service shown below.
@@ -69,7 +77,7 @@ Caddy handles certificates and redirects with almost no configuration.
6977

7078
Harden the application before inviting other users:
7179

72-
- Set strong credentials for health checks and any protected feeds
80+
- Set a strong `HEALTH_CHECK_TOKEN` for authenticated `GET /api/v1/health`, and strong credentials for any protected feeds
7381
- Prefer environment files (`.env`) stored outside version control for secrets
7482
- Keep any operator-only token distribution flow outside public docs and outside version control
7583

@@ -90,6 +98,8 @@ Keep the instance healthy once it is in production:
9098

9199
<DockerComposeSnippet variant="watchtower" />
92100

101+
This Watchtower shape updates all containers in the Docker host by default (not only `html2rss-web`).
102+
93103
Check `docker compose logs watchtower` occasionally to confirm updates are applied.
94104

95105
### Resource Guardrails

src/content/docs/web-application/reference/env-variables.mdx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ description: "Configuration reference for html2rss-web environment variables."
55

66
## Supported ENV variables
77

8-
| Name | Description |
9-
| --------------------------------- | ------------------------------------------------------------------------------------------------------------- |
10-
| `HTML2RSS_SECRET_KEY` | required in production; development/test gets a temporary default |
11-
| `HEALTH_CHECK_TOKEN` | bearer token for `GET /api/v1/health`; optional but recommended |
12-
| `BUILD_TAG` | optional build metadata (typically set by CI image builds) |
13-
| `GIT_SHA` | optional commit metadata (typically set by CI image builds) |
14-
| `SENTRY_DSN` | optional; enables Sentry errors/logs when set |
15-
| `BROWSERLESS_IO_WEBSOCKET_URL` | optional; Browserless websocket endpoint for `browserless` strategy |
16-
| `BROWSERLESS_IO_API_TOKEN` | optional for local default endpoint; required when `BROWSERLESS_IO_WEBSOCKET_URL` points to a custom endpoint |
17-
| `AUTO_SOURCE_ENABLED` | `true` by default in development/test, `false` otherwise |
18-
| `ASYNC_FEED_REFRESH_ENABLED` | optional boolean; default `false` |
19-
| `ASYNC_FEED_REFRESH_STALE_FACTOR` | optional integer `>= 1`; default `3` |
20-
| `PORT` | app listen port; compose uses `4000` |
21-
| `RACK_ENV` | Rack environment; compose uses `production` |
8+
| Name | Description |
9+
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10+
| `HTML2RSS_SECRET_KEY` | required in production; development/test gets a temporary default |
11+
| `HEALTH_CHECK_TOKEN` | bearer token for authenticated `GET /api/v1/health`; required by the documented Compose stack, but custom stacks that probe only `/api/v1/health/live` and `/api/v1/health/ready` can omit it |
12+
| `BUILD_TAG` | defaults to `local` in the Compose stack; set release metadata explicitly in production |
13+
| `GIT_SHA` | defaults to `local` in the Compose stack; set deployed commit SHA explicitly in production |
14+
| `SENTRY_DSN` | optional; enables Sentry errors/logs when set |
15+
| `BROWSERLESS_IO_WEBSOCKET_URL` | optional; Browserless websocket endpoint for `browserless` strategy |
16+
| `BROWSERLESS_IO_API_TOKEN` | required by this site's Compose stack and by custom websocket endpoints; standalone `html2rss` local defaults can omit it |
17+
| `AUTO_SOURCE_ENABLED` | `true` by default in development/test, `false` otherwise |
18+
| `ASYNC_FEED_REFRESH_ENABLED` | optional boolean; default `false` |
19+
| `ASYNC_FEED_REFRESH_STALE_FACTOR` | optional integer `>= 1`; default `3` |
20+
| `PORT` | app listen port; compose uses `4000` |
21+
| `RACK_ENV` | Rack environment; compose uses `production` |
2222

2323
Older environment-variable examples from previous docs revisions are obsolete. Use only the supported table above and the `Environment & Runtime Flags` table in [`html2rss-web/docs/README.md`](https://github.com/html2rss/html2rss-web/blob/master/docs/README.md).

0 commit comments

Comments
 (0)