59 lines
2.3 KiB
YAML
59 lines
2.3 KiB
YAML
# docker compose for the @logger/collector server.
|
|
#
|
|
# Builds the image from ./Dockerfile, which installs @logger/collector from the
|
|
# private Verdaccio registry and runs the HTTP ingest/query server on :4319.
|
|
#
|
|
# docker compose up -d --build # build + start
|
|
# docker compose logs -f # tail logs
|
|
# docker compose ps # see health (image defines the probe)
|
|
# docker compose restart # restart without rebuild
|
|
# docker compose down # stop, keep the named data volume
|
|
# docker compose down -v # stop AND wipe stored logs
|
|
#
|
|
# All knobs default sensibly; override any of them from a .env file or the env:
|
|
# COLLECTOR_VERSION=0.2.2 \
|
|
# REGISTRY=http://host.docker.internal:4873 \
|
|
# COLLECTOR_HOST_PORT=4319 \
|
|
# docker compose up -d --build
|
|
#
|
|
# NOTE: COLLECTOR_VERSION must match a package actually published to Verdaccio
|
|
# (./scripts/publish.sh <version>). If 0.2.2 isn't published yet, publish first
|
|
# or point COLLECTOR_VERSION at whatever is on the registry.
|
|
|
|
name: logger
|
|
|
|
services:
|
|
collector:
|
|
container_name: logger-collector
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
args:
|
|
# Verdaccio reachable from inside the BUILD container.
|
|
# host.docker.internal resolves to the host on Docker Desktop (mac/win);
|
|
# on Linux, build with `--add-host=host.docker.internal:host-gateway`.
|
|
REGISTRY: ${REGISTRY:-http://host.docker.internal:4873}
|
|
COLLECTOR_VERSION: ${COLLECTOR_VERSION:-0.2.2}
|
|
image: logger-collector:${COLLECTOR_VERSION:-0.2.2}
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${COLLECTOR_HOST_PORT:-4319}:4319"
|
|
volumes:
|
|
- logger-collector-data:/data
|
|
environment:
|
|
# The image already bakes these in (NODE_ENV/HOST/PORT/LOG_FILE); listed
|
|
# here so they can be overridden without rebuilding the image.
|
|
NODE_ENV: production
|
|
HOST: 0.0.0.0
|
|
PORT: "4319"
|
|
LOG_FILE: /data/logs.jsonl
|
|
# Lets the running container reach host services (e.g. Verdaccio) on Linux;
|
|
# a no-op safe-net on Docker Desktop for mac/win.
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
# Healthcheck is inherited from the Dockerfile (GET /query?limit=1).
|
|
# Add a healthcheck: block here only if you need to override it.
|
|
|
|
volumes:
|
|
logger-collector-data:
|