golangLAKEHOUSE/deploy/systemd/lakehouse-storaged.service
root 68d9e554b0 shared: auto-emit Langfuse trace+span per HTTP request — closes OPEN #2
Adds langfuseMiddleware in internal/shared so every daemon's
shared.Run gets free production-traffic trace visibility when
LANGFUSE_URL + LANGFUSE_PUBLIC_KEY + LANGFUSE_SECRET_KEY are set.
Same env names + file shape as the multi_coord_stress driver, so
operators ship one /etc/lakehouse/langfuse.env across the deploy.

Wiring is auth-gated: middleware runs INSIDE the RequireAuth group,
so 401s from credential-stuffing don't pollute traces. /health is
exempt so LB probes don't either. Missing env vars → nil client →
middleware is a passthrough no-op (fail-open per ADR-005 5.1).

Bundled deploy:
- langfuse.env.example template (mode 0640, root:lakehouse)
- 11 systemd units gain `EnvironmentFile=-/etc/lakehouse/langfuse.env`
  (leading - so missing file = OK)
- REPLICATION.md bootstrap section documents setup

Tests (4): nil passthrough, /health bypass, real-request emission,
status-writer wrapping. All green.

STATE_OF_PLAY OPEN list: 5 rows → 4 rows.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 19:55:42 -05:00

41 lines
1.3 KiB
Desktop File

[Unit]
Description=Lakehouse-Go storaged — S3-backed object store gateway
Documentation=https://git.agentview.dev/profit/golangLAKEHOUSE
After=network-online.target
Wants=network-online.target
# Operator prereq: MinIO (or AWS S3) reachable at the URL in
# /etc/lakehouse/secrets-go.toml [s3.primary]. Not a systemd unit
# we control, so we just wait for network and let the bind+probe
# in storaged surface unreachable-bucket errors.
[Service]
Type=simple
User=lakehouse
Group=lakehouse
WorkingDirectory=/var/lib/lakehouse
ExecStart=/usr/local/bin/lakehouse/storaged -config /etc/lakehouse/lakehouse.toml -secrets /etc/lakehouse/secrets-go.toml
Restart=on-failure
RestartSec=5
# Per ADR-006 Decision 6.2: auth token from env, not committed TOML.
# Empty AUTH_TOKEN is fine for loopback-only deploys (matches
# requireAuthOnNonLoopback gate at startup).
EnvironmentFile=-/etc/lakehouse/auth.env
EnvironmentFile=-/etc/lakehouse/langfuse.env
# Hardening — minimum needed for the daemon to read its config
# + write its log + open its bind port.
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
ReadWritePaths=/var/lib/lakehouse /var/log/lakehouse
# Log routing — JSON to journald, structured per slogRequest middleware.
StandardOutput=journal
StandardError=journal
SyslogIdentifier=lakehouse-storaged
[Install]
WantedBy=lakehouse-go.target