Make host port configurable via AW_PORT (default 8090, AMP uses 8080)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HJhXuLD2Z6hv3Wqeq9UL9K
This commit is contained in:
Claude
2026-10-21 12:38:03 +00:00
parent 2ae64420d9
commit e8584e043d
4 changed files with 8 additions and 6 deletions
+2
View File
@@ -3,3 +3,5 @@
AW_REGISTRATION_CODE= AW_REGISTRATION_CODE=
# 1 when running behind a reverse proxy that sets X-Forwarded-For / X-Forwarded-Proto / X-Forwarded-Host: # 1 when running behind a reverse proxy that sets X-Forwarded-For / X-Forwarded-Proto / X-Forwarded-Host:
AW_TRUST_PROXY=0 AW_TRUST_PROXY=0
# Port on the host (bound to 127.0.0.1 only). nginx proxies to it. Pick a free one (check: ss -tlnp | grep :8090):
AW_PORT=8090
+4 -4
View File
@@ -48,10 +48,10 @@ cp .env.example .env
nano .env # set AW_REGISTRATION_CODE, and AW_TRUST_PROXY=1 (nginx is in front) nano .env # set AW_REGISTRATION_CODE, and AW_TRUST_PROXY=1 (nginx is in front)
chmod 600 .env chmod 600 .env
docker compose up -d --build docker compose up -d --build
curl -sI http://127.0.0.1:8080 | head -1 # should print HTTP/1.1 200 OK curl -sI http://127.0.0.1:8090 | head -1 # should print HTTP/1.1 200 OK
``` ```
The container only listens on `127.0.0.1:8080`, so it is not reachable from outside until nginx forwards to it. The database is `./db/aw.db`. The container only listens on `127.0.0.1:8090` (change it with `AW_PORT` in `.env` if the port is taken, e.g. AMP uses 8080), so it is not reachable from outside until nginx forwards to it. The database is `./db/aw.db`.
## 4. nginx + HTTPS ## 4. nginx + HTTPS
@@ -65,7 +65,7 @@ server {
client_max_body_size 1m; client_max_body_size 1m;
location / { location / {
proxy_pass http://127.0.0.1:8080; proxy_pass http://127.0.0.1:8090; # same as AW_PORT in .env
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr; # overwrite, so clients cannot fake their address proxy_set_header X-Forwarded-For $remote_addr; # overwrite, so clients cannot fake their address
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
@@ -82,7 +82,7 @@ sudo certbot --nginx -d aw.yourdomain.tld # gets the certificate, adds
Then add inside the HTTPS `server` block: `add_header Strict-Transport-Security "max-age=31536000" always;` Then add inside the HTTPS `server` block: `add_header Strict-Transport-Security "max-age=31536000" always;`
Firewall: only SSH, 80 and 443 should be open. Port 8080 is not published to the outside at all. Firewall: only SSH, 80 and 443 should be open. The app port (AW_PORT, default 8090) is not published to the outside at all.
Open the site, choose "Create account" and register with your registration code. Open the site, choose "Create account" and register with your registration code.
+1 -1
View File
@@ -12,7 +12,7 @@ Website for creating characters for the Arcane Wasteland TTRPG, with a searchabl
docker compose up -d --build docker compose up -d --build
``` ```
Then open `http://localhost:8080` (the port is bound to the machine itself; see **DEPLOY.md** for running it on a server with its own user, nginx and HTTPS). Users, characters and presets are stored in `./db/aw.db`. Then open `http://localhost:8090` (the port is bound to the machine itself; see **DEPLOY.md** for running it on a server with its own user, nginx and HTTPS). Users, characters and presets are stored in `./db/aw.db`.
### Login and accounts ### Login and accounts
+1 -1
View File
@@ -5,7 +5,7 @@ services:
ports: ports:
# Only reachable from the server itself; the reverse proxy (nginx) is the public entrance. # Only reachable from the server itself; the reverse proxy (nginx) is the public entrance.
# Docker bypasses firewall rules for published ports, so never publish this on 0.0.0.0. # Docker bypasses firewall rules for published ports, so never publish this on 0.0.0.0.
- "127.0.0.1:8080:8000" - "127.0.0.1:${AW_PORT:-8090}:8000"
security_opt: security_opt:
- no-new-privileges:true - no-new-privileges:true
environment: environment: