Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ jobs:
run: |
docker run -d --name smoke -p 8000:8000 \
-v ${{ github.workspace }}/tests/container:/deploy/config:ro \
tag_for_testing
tag_for_testing \
tiled serve config --host 0.0.0.0 --port 8000 --scalable \
--log-config /deploy/log_config.yml
for i in $(seq 60); do curl -sf localhost:8000/healthz && break; sleep 1; done
# 422 (unknown scan) proves the visr router is mounted; 404 would mean it is not
status=$(curl -s -o /dev/null -w '%{http_code}' localhost:8000/api/v1/binned/none || true)
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ RUN --mount=from=ghcr.io/astral-sh/uv:0.10,source=/uv,target=/bin/uv \
&& chown -R app:app /app
USER app

# Logging config that also shows the plugin loggers: use with
# tiled serve config ... --log-config /deploy/log_config.yml
COPY log_config.yml /deploy/log_config.yml

# Check the plugins import and that upstream tiled was left at its release
RUN python -c "import dls_tiled.visr, tiled; \
assert tiled.__version__ == '${TILED_VERSION}', tiled.__version__"
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ routers:

Ported from Hiran Wijesinghe's [visr-tiled](https://github.com/hyperrealist/visr-tiled).

## Logging

tiled's default logging config has no handler for the plugin loggers, so their
INFO messages are dropped. The image includes `/deploy/log_config.yml`, which is
tiled's default plus the `dls_tiled` loggers. Select it by overriding the
container command, e.g. with the tiled helm chart:

```yaml
args: [tiled, serve, config, --host, 0.0.0.0, --port, "8000", --scalable,
--log-config, /deploy/log_config.yml]
```

## Tiled version

`TILED_VERSION` at the top of the `Dockerfile` selects the upstream release.
Expand Down
51 changes: 51 additions & 0 deletions log_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# tiled's default logging (tiled.server.logging_config.LOGGING_CONFIG) plus the
# dls_tiled plugin loggers, which otherwise have no handler and drop INFO.
# Use with: tiled serve config ... --log-config /deploy/log_config.yml
version: 1
disable_existing_loggers: false
filters:
principal:
"()": tiled.server.principal_log_filter.PrincipalFilter
correlation_id:
"()": asgi_correlation_id.CorrelationIdFilter
default_value: "-"
uuid_length: 16
formatters:
access:
"()": tiled.server.logging_config.AccessFormatter
datefmt: "%Y-%m-%dT%H:%M:%S"
format: '[%(correlation_id)s] %(client_addr)s (%(principal)s) - "%(request_line)s" %(status_code)s'
use_colors: true
default:
"()": uvicorn.logging.DefaultFormatter
datefmt: "%Y-%m-%dT%H:%M:%S"
format: "[%(correlation_id)s] %(levelprefix)s %(name)s: %(message)s"
use_colors: true
handlers:
access:
class: logging.StreamHandler
filters: [principal, correlation_id]
formatter: access
stream: ext://sys.stdout
default:
class: logging.StreamHandler
filters: [correlation_id]
formatter: default
stream: ext://sys.stderr
loggers:
tiled:
handlers: [default]
level: INFO
propagate: false
dls_tiled:
handlers: [default]
level: INFO
propagate: false
uvicorn.access:
handlers: [access]
level: INFO
propagate: false
uvicorn.error:
handlers: [default]
level: INFO
propagate: false
Loading