add docker compose with persistent redis

This commit is contained in:
Arkadiy Kukarkin
2026-05-28 13:00:02 +02:00
parent fe27e70e43
commit 030b0afb24
4 changed files with 74 additions and 15 deletions

View File

@@ -16,26 +16,29 @@ The original PHP implementation works fine but has some overhead. This port prov
## usage
run go-hauk and redis together with docker compose:
```
# create network
docker network create hauk
# start redis
docker run -d --name redis --network hauk redis:alpine
# generate password hash
# generate a password hash
export HAUK_PASSWORD_HASH=$(htpasswd -nbBC 10 "" 'your-password' | tr -d ':\n')
# start hauk
docker run -d --name hauk \
--network hauk \
-p 8080:8080 \
-e HAUK_AUTH_METHOD=password \
-e HAUK_PASSWORD_HASH \
-e HAUK_REDIS_ADDR=redis:6379 \
ghcr.io/parkan/go-hauk
docker compose up -d
```
or copy `.env.example` to `.env`, fill it in, and `docker compose up -d`.
### persistence
share data (sessions, links, locations) lives in redis with a per-share TTL
(`HAUK_MAX_DURATION`, default 24h). the bundled redis persists to a named volume
by default, so restarts and redeploys keep active shares alive. set
`REDIS_PERSIST=off` for in-memory only -- faster, but every share is lost on
restart.
### deploy on railway
use the **Deploy on Railway** button above.
## config
all config via environment variables:
@@ -47,6 +50,7 @@ all config via environment variables:
| HAUK_REDIS_ADDR | localhost:6379 | redis address (host:port or redis:// url) |
| HAUK_AUTH_METHOD | password | auth method (password, htpasswd, ldap) |
| HAUK_PASSWORD_HASH | | bcrypt hash for password auth |
| HAUK_MAX_DURATION | 86400 | max share lifetime in seconds (redis key TTL) |
| HAUK_RATE_LIMIT_AUTH | 10 | max auth requests per minute per ip |
| HAUK_RATE_LIMIT_ADOPT | 10 | max adopt requests per minute per ip |
| HAUK_TRUST_PROXY | true | trust X-Forwarded-For (set false if not behind proxy) |