Skip to content

Commit f31e572

Browse files
committed
docs: document LOG_DIR mounted log files and rotation
1 parent 150ef74 commit f31e572

4 files changed

Lines changed: 39 additions & 4 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ Per-service config files live under `config/`:
4646

4747
Local defaults: `config/api.local.yaml`, `config/indexer.local.yaml`. Override at runtime with `APP_CONFIG=/path/to/file.yaml`.
4848

49+
Logging is environment-driven: `RUST_LOG` sets verbosity, and `LOG_DIR`
50+
(optional) makes each service also write rotated log files into a directory —
51+
the Compose deployment bind-mounts these to `./logs/<service>`. See
52+
[docs/deployment.md](docs/deployment.md#logs).
53+
4954
Secrets and environment-specific values live in `.env`:
5055

5156
```sh

docs/deployment.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,10 @@ api only:
252252
## Step 4 — Compose override, build, and run
253253

254254
The base `docker-compose.yml` mounts `./config` into each container read-only
255-
(`/app/config`) and defaults `APP_CONFIG` to the `*.local.yaml` files. Add an
256-
override that points `APP_CONFIG` at your own files — mirroring how
255+
(`/app/config`), bind-mounts a per-service host log directory
256+
(`./logs/api`, `./logs/indexer` → `/app/logs`) with `LOG_DIR=/app/logs` set,
257+
and defaults `APP_CONFIG` to the `*.local.yaml` files. Add an override that
258+
points `APP_CONFIG` at your own files — mirroring how
257259
`docker-compose.stage.yml` selects the Supabase configs.
258260

259261
Create `docker-compose.prod.yml`:
@@ -327,12 +329,30 @@ docker compose -f docker-compose.yml -f docker-compose.prod.yml kill -s SIGUSR1
327329

328330
### Logs
329331

332+
Each service writes to **both** stdout and a host-mounted directory. The base
333+
`docker-compose.yml` bind-mounts `./logs/api` and `./logs/indexer` (on the host)
334+
to `/app/logs` (in each container) and sets `LOG_DIR=/app/logs`. With `LOG_DIR`
335+
set, the service writes daily-rotated, human-readable files named
336+
`<service>.log.<YYYY-MM-DD>` into that directory, keeping at most `LOG_MAX_FILES`
337+
of them (default 14):
338+
330339
```sh
340+
# tail the live stdout stream (unchanged)
331341
docker compose -f docker-compose.yml -f docker-compose.prod.yml logs -f api indexer
342+
343+
# the persisted files on the host (survive container removal / redeploy)
344+
tail -f logs/api/api.log.*
345+
ls -1 logs/indexer/
332346
```
333347

334-
Log verbosity is controlled by `RUST_LOG` (set in the override) and
335-
`app.log_level` in config.
348+
Notes:
349+
350+
- The containers run as `root`, so files under `logs/` are root-owned — use
351+
`sudo` to read/rotate them as a non-root user.
352+
- `LOG_DIR` and `LOG_MAX_FILES` are environment variables (there is no YAML
353+
config key). Unset `LOG_DIR` to disable file logging and keep stdout only.
354+
- Verbosity is still controlled by `RUST_LOG` (set in the override) and
355+
`app.log_level` in config; the same filter applies to stdout and files.
336356

337357
### Upgrades
338358

services/api/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ Config sections:
3535
`page_size` defaults to 100 and may be omitted; it is used by the
3636
indexer's paginated fetches but not by the API tier.
3737

38+
Logging is configured by environment variables, not YAML: `RUST_LOG` sets the
39+
filter (default `info`), and `LOG_DIR` (optional) makes the service additionally
40+
write daily-rotated `api.log.<date>` files into that directory, retaining
41+
`LOG_MAX_FILES` of them (default 14). See [docs/deployment.md](../../docs/deployment.md#logs).
42+
3843
The `auth.kek_hex` field is the 32-byte master key used to encrypt
3944
`api_secret` and `pn_seckey` at rest. `config/api.local.yaml` ships a
4045
shared dev value; stage and prod configs carry their own KEKs assembled

services/indexer/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ Config sections:
2525
- `graphql`: gateway endpoint, page size, request timeout.
2626
- `indexer`: polling/reconciliation/reprojection intervals and ignored addresses.
2727

28+
Logging is configured by environment variables, not YAML: `RUST_LOG` sets the
29+
filter (default `info`), and `LOG_DIR` (optional) makes the service additionally
30+
write daily-rotated `indexer.log.<date>` files into that directory, retaining
31+
`LOG_MAX_FILES` of them (default 14). See [docs/deployment.md](../../docs/deployment.md#logs).
32+
2833
## Database
2934

3035
The indexer applies SQL migrations from `migrations/` on startup. Column and

0 commit comments

Comments
 (0)