From ff06bf0b34496ce472ba6d3ebd4ea249f21c0ec3 Mon Sep 17 00:00:00 2001 From: Elias Schneider Date: Fri, 18 Oct 2024 08:23:06 +0200 Subject: [PATCH] feat: add environment variable to change the caddy port in Docker --- README.md | 21 +++++++++++---------- reverse-proxy/Caddyfile | 2 +- reverse-proxy/Caddyfile.trust-proxy | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index c2dd463..d121a03 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ Required tools: cd .. pm2 start pocket-id-backend --name pocket-id-backend - # Optional: Download the GeoLite2 city database. + # Optional: Download the GeoLite2 city database. # If not downloaded the ip location in the audit log will be empty. MAXMIND_LICENSE_KEY= sh scripts/download-ip-database.sh @@ -151,15 +151,16 @@ docker compose up -d ### Environment variables -| Variable | Default Value | Recommended to change | Description | -| ---------------------- | ----------------------- | --------------------- | --------------------------------------------- | -| `PUBLIC_APP_URL` | `http://localhost` | yes | The URL where you will access the app. | -| `TRUST_PROXY` | `false` | yes | Whether the app is behind a reverse proxy. | -| `DB_PATH` | `data/pocket-id.db` | no | The path to the SQLite database. | -| `UPLOAD_PATH` | `data/uploads` | no | The path where the uploaded files are stored. | -| `INTERNAL_BACKEND_URL` | `http://localhost:8080` | no | The URL where the backend is accessible. | -| `PORT` | `3000` | no | The port on which the frontend should listen. | -| `BACKEND_PORT` | `8080` | no | The port on which the backend should listen. | +| Variable | Default Value | Recommended to change | Description | +| ---------------------- | ----------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `PUBLIC_APP_URL` | `http://localhost` | yes | The URL where you will access the app. | +| `TRUST_PROXY` | `false` | yes | Whether the app is behind a reverse proxy. | +| `DB_PATH` | `data/pocket-id.db` | no | The path to the SQLite database. | +| `UPLOAD_PATH` | `data/uploads` | no | The path where the uploaded files are stored. | +| `INTERNAL_BACKEND_URL` | `http://localhost:8080` | no | The URL where the backend is accessible. | +| `CADDY_PORT` | `80` | no | The port on which Caddy should listen. Caddy is only active inside the Docker container. If you want to change the exposed port of the container then you sould change this variable. | +| `PORT` | `3000` | no | The port on which the frontend should listen. | +| `BACKEND_PORT` | `8080` | no | The port on which the backend should listen. | ## Contribute diff --git a/reverse-proxy/Caddyfile b/reverse-proxy/Caddyfile index ae95db1..b6bd36d 100644 --- a/reverse-proxy/Caddyfile +++ b/reverse-proxy/Caddyfile @@ -1,4 +1,4 @@ -:80 { +:{$CADDY_PORT:80} { reverse_proxy /api/* http://localhost:{$BACKEND_PORT:8080} reverse_proxy /.well-known/* http://localhost:{$BACKEND_PORT:8080} reverse_proxy /* http://localhost:{$PORT:3000} diff --git a/reverse-proxy/Caddyfile.trust-proxy b/reverse-proxy/Caddyfile.trust-proxy index 97106c7..3214273 100644 --- a/reverse-proxy/Caddyfile.trust-proxy +++ b/reverse-proxy/Caddyfile.trust-proxy @@ -1,4 +1,4 @@ -:80 { +:{$CADDY_PORT:80} { reverse_proxy /api/* http://localhost:{$BACKEND_PORT:8080} { trusted_proxies 0.0.0.0/0 }