Refuse invalid settings at start, health check follows PORT (closes #31)
check / check (push) Successful in 2m49s
check / check (push) Successful in 2m49s
PORT (1 to 65535) and XDG_DATA_HOME (an absolute path) are now checked in the config package, which is built before the database opens, so a bad value stops the start with an error and a non-zero exit instead of leaving the daemon running without HTTP or putting the database somewhere else. entrypoint.sh refuses a MALLOC_ARENA_MAX that is not a positive whole number, since glibc ignores a bad one silently. The HEALTHCHECK probes the port PORT names. The README corrects the Linux state directory, lists XDG_DATA_HOME, and adds a "Running under upaas" section. Model: opus-5-5
This commit is contained in:
@@ -166,14 +166,21 @@ Configuration is handled via environment variables and OS-specific paths:
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|----------|-------------|
|
||||
| `PORT` | `8080` | HTTP server port |
|
||||
| `PORT` | `8080` | HTTP server port, a whole number from 1 to 65535 |
|
||||
| `DEBUG` | (empty) | Set to `routewatch` for debug logging |
|
||||
| `XDG_DATA_HOME` | `/var/lib` (in the Docker image) | Base of the state directory; must be an absolute path |
|
||||
| `GOMEMLIMIT` | `1536MiB` (in the Docker image) | Go soft memory limit; see Memory |
|
||||
| `MALLOC_ARENA_MAX` | `2` (in the Docker image) | glibc malloc arena cap; see Memory |
|
||||
| `MALLOC_ARENA_MAX` | `2` (in the Docker image) | glibc malloc arena cap, a positive whole number; see Memory |
|
||||
|
||||
A variable that is set to an invalid value stops the start with an error and a
|
||||
non-zero exit. An empty variable counts as unset.
|
||||
|
||||
State directory (database location):
|
||||
- macOS: `~/Library/Application Support/routewatch/`
|
||||
- Linux: `/var/lib/routewatch/` or `~/.local/share/routewatch/`
|
||||
- Linux: `/var/lib/berlin.sneak.app.routewatch/` when running as root,
|
||||
otherwise `$XDG_DATA_HOME/berlin.sneak.app.routewatch/` (with `XDG_DATA_HOME`
|
||||
unset, `~/.local/share/berlin.sneak.app.routewatch/`). In the Docker image
|
||||
this is `/var/lib/berlin.sneak.app.routewatch/`.
|
||||
|
||||
## Memory
|
||||
|
||||
@@ -220,6 +227,24 @@ What happens at each limit:
|
||||
With `DEBUG=routewatch` the daemon logs a `System stats` line every 60 seconds
|
||||
with the goroutine count and Go memory figures.
|
||||
|
||||
## Running under upaas
|
||||
|
||||
What the [upaas](https://git.eeqj.de/sneak/upaas) app needs:
|
||||
|
||||
- Container port: `8080`.
|
||||
- Volume: one, at container path `/var/lib/berlin.sneak.app.routewatch`. upaas
|
||||
does not create the host directory, so create it before the first deploy. The
|
||||
entrypoint takes ownership of it, so a root-owned directory works.
|
||||
- Environment: nothing is required. Leave `XDG_DATA_HOME`, `GOMEMLIMIT` and
|
||||
`MALLOC_ARENA_MAX` at the image's values. `DEBUG=routewatch` is optional and
|
||||
adds the `System stats` memory line to the log.
|
||||
- Memory Limit: `5g`, the 5 GiB limit from Memory above. upaas sets no swap
|
||||
limit, so on a host with swap Docker allows the same amount of swap again.
|
||||
- Health check: the image's `HEALTHCHECK` requests
|
||||
`/.well-known/healthcheck.json` on the container port. upaas reads the
|
||||
container's health 60 seconds after a deploy and fails the deploy unless it
|
||||
is `healthy`.
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user