Changeset f99bbe8 in Klonkt
- Timestamp:
- 06/23/2026 10:00:00 PM (3 months ago)
- Branches:
- main
- Children:
- 5eef817
- Parents:
- 09ee2bd
- Files:
-
- 5 edited
-
.env.example (modified) (1 diff)
-
README.md (modified) (1 diff)
-
docker-compose.yml (modified) (1 diff)
-
scripts/install.sh (modified) (2 diffs)
-
src/server.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
.env.example
r09ee2bd rf99bbe8 1 1 NODE_ENV=development 2 2 PORT=3000 3 4 # Network interface to bind. 127.0.0.1 = only reachable via a reverse proxy on the 5 # same machine (recommended for a manual install behind Caddy/nginx — keeps the app 6 # off the public internet). Use 0.0.0.0 only if you need direct external access 7 # (no proxy/HTTPS — not recommended). Docker sets this to 0.0.0.0 itself. 8 HOST=127.0.0.1 3 9 # Secret used to sign login-session cookies. Leave EMPTY to auto-generate a strong 4 10 # one on first start (saved to storage/.session-secret, stays stable across -
README.md
r09ee2bd rf99bbe8 115 115 ``` 116 116 117 By default the app binds to `127.0.0.1` (via `HOST` in `.env`), so only your 118 reverse proxy can reach it — not the open internet. Local testing on the same 119 machine (`localhost:3000`) still works. Only set `HOST=0.0.0.0` if you need direct 120 external access without a proxy (then open the port in your firewall and add HTTPS 121 yourself). 122 117 123 (`cwebp` is optional — `apt install webp` — for WebP image conversion.) 118 124 -
docker-compose.yml
r09ee2bd rf99bbe8 16 16 env_file: .env 17 17 environment: 18 # In de container draait 'ie altijd op 3000 en in productie-modus, 19 # ongeacht wat er in .env staat. 18 # Inside the container it always runs on port 3000 in production mode and 19 # binds all interfaces (so the port mapping works) — overrides .env. The 20 # loopback host-mapping below is what keeps it off the public internet. 20 21 NODE_ENV: production 21 22 PORT: "3000" 23 HOST: "0.0.0.0" 22 24 ports: 23 # host:container — wijzig de host-poort (links) als 3000 al bezet is. 24 - "3000:3000" 25 # Bind the host port to loopback only — reach the app through your reverse 26 # proxy (Caddy/nginx) on this host, not directly from the internet. 27 # Change the left side if 3000 is taken, e.g. "127.0.0.1:3001:3000". 28 - "127.0.0.1:3000:3000" 25 29 volumes: 26 # All e data (database, geüploade media + audio) blijft hier bewaard.30 # All data (database, uploaded media + audio) is kept here. 27 31 - klonkt-data:/app/storage 28 32 -
scripts/install.sh
r09ee2bd rf99bbe8 160 160 echo "NODE_ENV=production" 161 161 echo "PORT=${KLONKT_PORT}" 162 # Bind to loopback only: Caddy (this host) reaches it; the internet cannot 163 # hit the app directly on its port, bypassing HTTPS. 164 echo "HOST=127.0.0.1" 162 165 echo "SESSION_SECRET=${SECRET}" 163 166 echo "DATABASE_PATH=./storage/database.sqlite" … … 168 171 } > "$ENV" 169 172 chown "$KLONKT_USER:$KLONKT_USER" "$ENV"; chmod 600 "$ENV" 170 ok "new .env (random SESSION_SECRET )"173 ok "new .env (random SESSION_SECRET, app bound to 127.0.0.1)" 171 174 else 172 175 # sync the port in an existing .env with the chosen port 173 176 if grep -q '^PORT=' "$ENV"; then sed -i "s/^PORT=.*/PORT=${KLONKT_PORT}/" "$ENV"; fi 174 ok "kept existing .env (port synced)" 177 # harden older installs: bind to loopback if not already configured 178 grep -q '^HOST=' "$ENV" || echo "HOST=127.0.0.1" >> "$ENV" 179 ok "kept existing .env (port synced, bound to 127.0.0.1)" 175 180 fi 176 181 -
src/server.js
r09ee2bd rf99bbe8 87 87 const __dirname = path.dirname(fileURLToPath(import.meta.url)); 88 88 const PORT = process.env.PORT || 3000; 89 // Interface to bind. Default 0.0.0.0 (needed for Docker port-forwarding). Behind a 90 // reverse proxy on the same host, set HOST=127.0.0.1 so the app is NOT reachable 91 // directly from the internet (only via the proxy) — see README/install docs. 92 const HOST = process.env.HOST || '0.0.0.0'; 89 93 const isDev = process.env.NODE_ENV !== 'production'; 90 94 … … 427 431 }); 428 432 429 server.listen(PORT, () => {433 server.listen(PORT, HOST, () => { 430 434 console.log(''); 431 435 console.log('🪶 Klonkt Beta');
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)