# stackr: the services applications on artifactr, reflexr and evalr run on.
#
# Services are grouped in profiles, which are adapter sets behind stable ports
# (ADR-0005). Only what a task needs runs:
# observability the OpenTelemetry Collector (the telemetry port), with
# Tempo, Prometheus, Loki, Pyroscope and Grafana behind it
# langfuse Langfuse, behind the Collector for traces, with ClickHouse,
# MinIO (the S3 port) and Valkey (the Redis protocol)
# gateway the LiteLLM proxy (the LLM gateway port), with Valkey
# postgres plain PostgreSQL, the alternative database adapter
# auth GoTrue, Supabase's auth server alone (the identity port), on
# the postgres adapter: local Supabase runs its own
# smoke telemetrygen and curl, for scripts/smoke
# The database adapter is local Supabase by default, run beside this project
# by its CLI (supabase/). `make up` starts both; see docs/architecture.md.
#
# Published ports bind to STACKR_BIND (127.0.0.1 by default), and each is a
# setting in .env (ADR-0006).
name: stackr
networks:
# A fixed name, so the libraries' dev containers and applications can join
# it as an external network and reach the services by name.
default:
name: stackr
# Local Supabase's network (ADR-0002). The services that use PostgreSQL join
# it to reach supabase_db_stackr-supabase by name. `make up` creates it when
# it's missing, so it exists with the plain PostgreSQL adapter too, and the
# Supabase CLI joins it rather than creating its own.
supabase:
name: supabase_network_stackr-supabase
external: true
# Umami's (ADR-0050): its ingest takes anyone's events, so it shares no network with the stack's
# other services. `umami-ingest` is the application's way in, which `make up` creates as the
# stack starts, internal, for the applications to join; `umami-db` is plain PostgreSQL's and
# Umami's alone; `umami-ui` publishes its port, and nothing else is on it.
umami-ingest:
name: stackr-umami
external: true
umami-db:
internal: true
umami-ui: {}
volumes:
prometheus-data:
tempo-data:
loki-data:
pyroscope-data:
grafana-data:
postgres-data:
redis-data:
minio-data:
clickhouse-data:
clickhouse-logs:
# Langfuse's web and worker share their settings. SALT and ENCRYPTION_KEY
# must match between them and never change.
x-langfuse-env: &langfuse-env
# yamllint disable-line rule:line-length
DATABASE_URL: postgresql://langfuse:${LANGFUSE_DB_PASSWORD:?run make env}@${STACKR_DB_HOST:-supabase_db_stackr-supabase}:5432/langfuse
SALT: ${LANGFUSE_SALT:?run make env}
ENCRYPTION_KEY: ${LANGFUSE_ENCRYPTION_KEY:?run make env}
NEXTAUTH_URL: http://localhost:${LANGFUSE_PORT:-3300}
TELEMETRY_ENABLED: "false"
# Listen on every interface, not only the container's own address.
HOSTNAME: 0.0.0.0
CLICKHOUSE_URL: http://clickhouse:8123
CLICKHOUSE_MIGRATION_URL: clickhouse://clickhouse:9000
CLICKHOUSE_USER: langfuse
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:?run make env}
CLICKHOUSE_CLUSTER_ENABLED: "false"
# Database 0 of the shared Valkey; the gateway uses database 1.
REDIS_CONNECTION_STRING: redis://:${REDIS_PASSWORD:?run make env}@redis:6379/0
LANGFUSE_S3_EVENT_UPLOAD_BUCKET: langfuse
LANGFUSE_S3_EVENT_UPLOAD_PREFIX: events/
LANGFUSE_S3_EVENT_UPLOAD_REGION: ${S3_REGION:-auto}
LANGFUSE_S3_EVENT_UPLOAD_ENDPOINT: http://minio:9000
LANGFUSE_S3_EVENT_UPLOAD_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID:-stackr}
LANGFUSE_S3_EVENT_UPLOAD_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY:?run make env}
LANGFUSE_S3_EVENT_UPLOAD_FORCE_PATH_STYLE: "true"
LANGFUSE_S3_MEDIA_UPLOAD_BUCKET: langfuse
LANGFUSE_S3_MEDIA_UPLOAD_PREFIX: media/
LANGFUSE_S3_MEDIA_UPLOAD_REGION: ${S3_REGION:-auto}
LANGFUSE_S3_MEDIA_UPLOAD_ENDPOINT: http://minio:9000
LANGFUSE_S3_MEDIA_UPLOAD_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID:-stackr}
LANGFUSE_S3_MEDIA_UPLOAD_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY:?run make env}
LANGFUSE_S3_MEDIA_UPLOAD_FORCE_PATH_STYLE: "true"
# What Langfuse's web and worker wait for.
x-langfuse-depends-on: &langfuse-depends-on
db-init:
condition: service_completed_successfully
redis:
condition: service_healthy
minio:
condition: service_healthy
clickhouse:
condition: service_healthy
services:
# The telemetry port: every application, and the LiteLLM proxy, sends OTLP
# here. Swapping a backend changes the Collector's exporters only.
otel-collector:
image: otel/opentelemetry-collector-contrib:0.161.0@sha256:fd328de2552466ad78385e1b1289c3f2402b1c45f265b252aab1955b42845ac1
profiles: [observability]
restart: unless-stopped
command: ["--config=/etc/otelcol-contrib/config.yaml"]
environment:
STACKR_ENVIRONMENT: ${STACKR_ENVIRONMENT:-local}
# Where traces go. `make up` leaves Langfuse out when its profile isn't
# running (see the Makefile).
STACKR_TRACES_EXPORTERS: ${STACKR_TRACES_EXPORTERS:-[otlp_grpc/tempo, otlp_http/langfuse]}
LANGFUSE_OTLP_AUTH: ${LANGFUSE_OTLP_AUTH:?run make env}
volumes:
- ./deploy/otel-collector/config.yaml:/etc/otelcol-contrib/config.yaml:ro
ports:
- ${STACKR_BIND:-127.0.0.1}:${OTLP_GRPC_PORT:-4317}:4317
- ${STACKR_BIND:-127.0.0.1}:${OTLP_HTTP_PORT:-4318}:4318
depends_on:
- tempo
- prometheus
- loki
tempo:
image: grafana/tempo:3.0.3@sha256:0296560ac66f8a3600d7fb3014a52c189d4d9c3549ad6ff441bf2409855d68d5
profiles: [observability]
restart: unless-stopped
command: ["-config.file=/etc/tempo/tempo.yaml", "-config.expand-env=true"]
volumes:
- ./deploy/tempo/tempo.yaml:/etc/tempo/tempo.yaml:ro
- tempo-data:/var/tempo
ports:
- ${STACKR_BIND:-127.0.0.1}:${TEMPO_PORT:-3200}:3200
depends_on:
- prometheus
prometheus:
image: prom/prometheus:v3.15.0@sha256:efd719c99d83b060d9daefdcf00360461adf279f45ef5391f8d111892118753e
profiles: [observability]
restart: unless-stopped
# The image's own user, nobody, named so the state host's data directory can be given to it.
user: "65534:65534"
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --storage.tsdb.retention.time=15d
# Metrics arrive as OTLP from the Collector, and by remote write from
# Tempo's metrics generator (ADR-0007).
- --web.enable-otlp-receiver
- --web.enable-remote-write-receiver
- --enable-feature=exemplar-storage
volumes:
- ./deploy/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
ports:
- ${STACKR_BIND:-127.0.0.1}:${PROMETHEUS_PORT:-9090}:9090
healthcheck:
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:9090/-/ready"]
interval: 5s
timeout: 3s
retries: 30
# portalr's path to Prometheus: every query it sends names a tenant in the
# tenant_id parameter, and the proxy rewrites each selector to that tenant,
# so no query can read another's series. Grafana keeps its direct data
# source, for operators (lattice RFC-0002).
prom-label-proxy:
image: quay.io/prometheuscommunity/prom-label-proxy:v0.15.1@sha256:186f9fe791158ef25d6f810109746ac0acdb35cb8401b554526c77c065483373
profiles: [observability]
restart: unless-stopped
command:
- -label=tenant_id
- -upstream=http://prometheus:9090
- -insecure-listen-address=0.0.0.0:8080
- -internal-listen-address=127.0.0.1:8081
ports:
- ${STACKR_BIND:-127.0.0.1}:${PROM_LABEL_PROXY_PORT:-9091}:8080
healthcheck:
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8081/metrics"]
interval: 5s
timeout: 3s
retries: 30
depends_on:
- prometheus
loki:
image: grafana/loki:3.7.8@sha256:1107dd5274e0ada47e42472b7a7e71f3b2a2fe878878108f3e2f9e51528f0193
profiles: [observability]
restart: unless-stopped
command: ["-config.file=/etc/loki/loki.yaml", "-config.expand-env=true"]
volumes:
- ./deploy/loki/loki.yaml:/etc/loki/loki.yaml:ro
- loki-data:/loki
ports:
- ${STACKR_BIND:-127.0.0.1}:${LOKI_PORT:-3100}:3100
# The profiles port: applications push profiles here directly, until OTLP
# profiles are stable in the Collector (ADR-0005).
pyroscope:
image: grafana/pyroscope:2.3.1@sha256:86a9ee7448487409ead8ada78789de7b78b739711b92b5d7224a1a54abf3eeb2
profiles: [observability]
restart: unless-stopped
command: ["-config.file=/etc/pyroscope/config.yaml", "-config.expand-env=true"]
volumes:
- ./deploy/pyroscope/config.yaml:/etc/pyroscope/config.yaml:ro
- pyroscope-data:/data
ports:
- ${STACKR_BIND:-127.0.0.1}:${PYROSCOPE_PORT:-4040}:4040
grafana:
# stackr-grafana's image, as the AWS recipe runs it: Grafana with ClickHouse's data source
# plugin in it, pinned (ADR-0048). The mounts below keep the checkout's files live.
build:
context: ../..
dockerfile: packages/stackr/deploy/grafana/Dockerfile
image: stackr-grafana:local
profiles: [observability]
restart: unless-stopped
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD:?run make env}
GF_ANALYTICS_REPORTING_ENABLED: "false"
GF_ANALYTICS_CHECK_FOR_UPDATES: "false"
GF_ANALYTICS_CHECK_FOR_PLUGIN_UPDATES: "false"
GF_NEWS_NEWS_FEED_ENABLED: "false"
# The data sources' addresses, which the provisioning file reads.
PROMETHEUS_ADDRESS: prometheus
TEMPO_ADDRESS: tempo
LOKI_ADDRESS: loki
PYROSCOPE_ADDRESS: pyroscope
CLICKHOUSE_ADDRESS: clickhouse
# Its ClickHouse user's, which reads every tenant's analytics, for operators (ADR-0048).
CLICKHOUSE_GRAFANA_PASSWORD: ${CLICKHOUSE_GRAFANA_PASSWORD:?run make env}
volumes:
- ./deploy/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources:ro
- ./deploy/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro
# Each directory is a folder: stackr's, and the libraries', from the checkout.
- ./deploy/grafana/dashboards/stackr:/var/lib/grafana/dashboards/stackr:ro
- ../artifactr/deploy/grafana/dashboards:/var/lib/grafana/dashboards/artifactr:ro
- ../reflexr/deploy/grafana/dashboards:/var/lib/grafana/dashboards/reflexr:ro
- grafana-data:/var/lib/grafana
ports:
- ${STACKR_BIND:-127.0.0.1}:${GRAFANA_PORT:-3000}:3000
healthcheck:
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:3000/api/health"]
interval: 5s
timeout: 3s
retries: 30
depends_on:
- prometheus
- tempo
- loki
- pyroscope
# The database port's alternative adapter: plain PostgreSQL, selected with
# STACKR_DATABASE=postgres. Local Supabase is the default (supabase/).
postgres:
image: postgres:17.11-alpine@sha256:b0f9560a2de083e2cc7382e75f808c7381a32852a7ec49117deedb300e552b24
profiles: [postgres]
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_ADMIN_PASSWORD:?run make env}
TZ: UTC
PGTZ: UTC
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- ${STACKR_BIND:-127.0.0.1}:${POSTGRES_PORT:-55432}:5432
networks: [default, umami-db]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U \"$$POSTGRES_USER\" -d postgres"]
interval: 3s
timeout: 3s
retries: 30
# Creates each service's role and database on the database adapter, on
# every start (deploy/postgres/init.sql), then exits.
db-init:
image: postgres:17.11-alpine@sha256:b0f9560a2de083e2cc7382e75f808c7381a32852a7ec49117deedb300e552b24
profiles: [langfuse, gateway, auth]
restart: "no"
command: ["psql", "--no-psqlrc", "--quiet", "--file=/init.sql"]
# The adapter's host and admin password default to local Supabase's
# (whose local password is fixed); `make up` sets both for the plain
# PostgreSQL adapter.
environment:
PGHOST: ${STACKR_DB_HOST:-supabase_db_stackr-supabase}
PGPORT: "5432"
PGDATABASE: postgres
PGUSER: postgres
PGPASSWORD: ${STACKR_DB_ADMIN_PASSWORD:-postgres}
PGCONNECT_TIMEOUT: "10"
LANGFUSE_DB_PASSWORD: ${LANGFUSE_DB_PASSWORD:?run make env}
LITELLM_DB_PASSWORD: ${LITELLM_DB_PASSWORD:?run make env}
AUTH_DB_PASSWORD: ${AUTH_DB_PASSWORD:?run make env}
volumes:
- ./deploy/postgres/init.sql:/init.sql:ro
networks: [default, supabase]
depends_on:
postgres:
condition: service_healthy
required: false
# The identity port's adapter on plain PostgreSQL: GoTrue, the server behind
# local Supabase's /auth/v1, alone (RFC-0004). It signs users' tokens with the
# ES256 key set in AUTH_JWT_KEYS and serves it at /.well-known/jwks.json, as
# local Supabase does. Its admin API takes AUTH_SERVICE_ROLE_KEY, a JWT signed
# with the same key. `make up` refuses the profile beside local Supabase.
gotrue:
image: supabase/gotrue:v2.197.0@sha256:1736a63078f5922b198c4cbe50f80ab9a2d3b54fe8b7b6cfb2e9dc5dbbc12c6b
profiles: [auth]
restart: unless-stopped
environment:
GOTRUE_API_HOST: 0.0.0.0
PORT: "9999"
API_EXTERNAL_URL: ${AUTH_PUBLIC_URL:-http://localhost:9999}
GOTRUE_SITE_URL: ${AUTH_SITE_URL:-http://localhost:8800}
GOTRUE_DB_DRIVER: postgres
# yamllint disable-line rule:line-length
GOTRUE_DB_DATABASE_URL: postgres://gotrue:${AUTH_DB_PASSWORD:?run make env}@${STACKR_DB_HOST:-postgres}:5432/auth
GOTRUE_JWT_ISSUER: ${AUTH_PUBLIC_URL:-http://localhost:9999}
GOTRUE_JWT_KEYS: ${AUTH_JWT_KEYS:?run make env}
# Required, though tokens are signed with the key set: a random value no
# one signs with.
GOTRUE_JWT_SECRET: ${AUTH_JWT_SECRET:?run make env}
GOTRUE_JWT_AUD: authenticated
GOTRUE_JWT_DEFAULT_GROUP_NAME: authenticated
GOTRUE_JWT_ADMIN_ROLES: service_role
GOTRUE_JWT_EXP: "3600"
GOTRUE_EXTERNAL_EMAIL_ENABLED: "true"
# Users are created through the admin API (an application's admin
# commands, portalr's invitations), not by signing themselves up.
GOTRUE_DISABLE_SIGNUP: ${AUTH_DISABLE_SIGNUP:-true}
# Invitations and password resets need an SMTP server; without one, GoTrue sends no email.
GOTRUE_SMTP_HOST: ${AUTH_SMTP_HOST:-}
GOTRUE_SMTP_PORT: ${AUTH_SMTP_PORT:-587}
GOTRUE_SMTP_USER: ${AUTH_SMTP_USER:-}
GOTRUE_SMTP_PASS: ${AUTH_SMTP_PASSWORD:-}
GOTRUE_SMTP_ADMIN_EMAIL: ${AUTH_SMTP_SENDER:-}
ports:
- ${STACKR_BIND:-127.0.0.1}:${AUTH_PORT:-9999}:9999
healthcheck:
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:9999/health"]
interval: 3s
timeout: 3s
retries: 30
depends_on:
db-init:
condition: service_completed_successfully
# The Redis protocol, with Valkey as its adapter: Langfuse's queues and
# cache (database 0) and the gateway's routing state and cache (database 1).
# `noeviction`, because queued jobs must not be dropped; the gateway's
# entries expire by their TTLs.
redis:
image: valkey/valkey:9.1.2-alpine@sha256:48332870af354a799964c0012ae1194a0bf2bf894eb508f945810596dc2d8d11
profiles: [langfuse, gateway]
restart: unless-stopped
# The password goes into a config file, never onto the command line.
entrypoint:
- sh
- -c
- >-
printf 'requirepass %s\n' "$$REDIS_PASSWORD" > /tmp/valkey.conf &&
exec valkey-server /tmp/valkey.conf --maxmemory-policy noeviction --save 60 1
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD:?run make env}
REDISCLI_AUTH: ${REDIS_PASSWORD:?run make env}
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 3s
timeout: 3s
retries: 30
# The S3 port, with MinIO as its adapter. Chainguard publishes only
# `latest` for free, so the image is pinned by digest (ADR-0008).
minio:
image: cgr.dev/chainguard/minio:latest@sha256:dc455cdd4db6e390b1b26514f15ff37681a777bf8dab41aac445a0259f751e56
profiles: [langfuse]
restart: unless-stopped
entrypoint:
- sh
- -c
- mkdir -p /data/langfuse && exec minio server --address :9000 --console-address :9001 /data
environment:
MINIO_ROOT_USER: ${S3_ACCESS_KEY_ID:-stackr}
MINIO_ROOT_PASSWORD: ${S3_SECRET_ACCESS_KEY:?run make env}
volumes:
- minio-data:/data
ports:
- ${STACKR_BIND:-127.0.0.1}:${MINIO_PORT:-9000}:9000
- ${STACKR_BIND:-127.0.0.1}:${MINIO_CONSOLE_PORT:-9001}:9001
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 3s
timeout: 5s
retries: 30
clickhouse:
image: clickhouse/clickhouse-server:26.9.20.23@sha256:83243a0057e4c78fa019f5b59d0082f2f9844986b57a598a6d9b012221f90ba2
# Its own profile, which Langfuse's and portalr's analytics both pull in (ADR-0044), and
# clickhouse-init's, which `make up` runs after it.
profiles: [clickhouse, langfuse, analytics, analytics-init]
restart: unless-stopped
user: "101:101"
# Its users are deploy/clickhouse/users.xml's, not the image's: an admin for operators,
# Langfuse's, which may use only its own database and the system tables it reads (ADR-0031),
# and analytics' writer and reader (ADR-0044). Langfuse's password is
# CLICKHOUSE_LANGFUSE_PASSWORD here, since both the image's entrypoint and clickhouse-client
# read CLICKHOUSE_PASSWORD as their own. `make env` makes it whether or not Langfuse runs, and
# it is required here, so Langfuse's user, which signs in from anywhere, never has an empty one.
environment:
CLICKHOUSE_SKIP_USER_SETUP: "1"
CLICKHOUSE_ADMIN_PASSWORD: ${CLICKHOUSE_ADMIN_PASSWORD:?run make env}
CLICKHOUSE_LANGFUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:?run make env}
CLICKHOUSE_ANALYTICS_WRITER_PASSWORD: ${CLICKHOUSE_ANALYTICS_WRITER_PASSWORD:?run make env}
CLICKHOUSE_ANALYTICS_PASSWORD: ${CLICKHOUSE_ANALYTICS_PASSWORD:?run make env}
CLICKHOUSE_GRAFANA_PASSWORD: ${CLICKHOUSE_GRAFANA_PASSWORD:?run make env}
volumes:
- ./deploy/clickhouse/users.xml:/etc/clickhouse-server/users.d/users.xml:ro
- ./deploy/clickhouse/analytics-users.xml:/etc/clickhouse-server/users.d/analytics-users.xml:ro
- ./deploy/clickhouse/analytics.xml:/etc/clickhouse-server/config.d/analytics.xml:ro
- clickhouse-data:/var/lib/clickhouse
- clickhouse-logs:/var/log/clickhouse-server
# Its HTTP interface, for portalr's analytics in an application `make serve` runs on this
# machine: on 127.0.0.1 always, whatever STACKR_BIND says, since Langfuse's user signs in from
# anywhere and ClickHouse is never reachable from another machine (ADR-0006, ADR-0044).
ports:
- 127.0.0.1:${CLICKHOUSE_HTTP_PORT:-8123}:8123
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:8123/ping"]
interval: 3s
timeout: 5s
retries: 30
# portalr's analytics database (lattice RFC-0008, ADR-0044), made as ClickHouse's admin, who
# signs in from inside ClickHouse's own network namespace only; then it exits. `make up` runs it
# once ClickHouse is up, with `docker compose run`, so `up --wait` waits on no container that
# exits; its profile is never started on its own.
clickhouse-init:
image: clickhouse/clickhouse-server:26.9.20.23@sha256:83243a0057e4c78fa019f5b59d0082f2f9844986b57a598a6d9b012221f90ba2
profiles: [analytics-init]
restart: "no"
network_mode: service:clickhouse
user: "101:101"
entrypoint: ["sh", "-c"]
command:
- >-
case "$$ANALYTICS_RETENTION_DAYS" in ''|*[!0-9]*)
echo "ANALYTICS_RETENTION_DAYS is a number of days" >&2; exit 1;; esac;
sed "s/@RETENTION@/$$ANALYTICS_RETENTION_DAYS/g" /analytics.sql |
clickhouse-client --user admin --multiquery
environment:
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_ADMIN_PASSWORD:?run make env}
# How long an event is kept: 395 days unless the operator chooses (RFC-0008, P5).
ANALYTICS_RETENTION_DAYS: ${ANALYTICS_RETENTION_DAYS:-395}
volumes:
- ./deploy/clickhouse/analytics.sql:/analytics.sql:ro
depends_on:
clickhouse:
condition: service_healthy
# Journeys, for operators, from portalr's relay (lattice RFC-0008, ADR-0050), on the plain
# PostgreSQL adapter alone: `make up` refuses the profile beside local Supabase, whose database's
# network the stack's other services share. Its data is in its own database there, as its role's.
umami:
image: ghcr.io/umami-software/umami:3.4.0@sha256:85909afc45bdcda1917394594a087421fdbb05610fded0fa9f6fb861abb2f367
# And umami-init's, which `make up` runs after it.
profiles: [umami, umami-init]
restart: unless-stopped
environment:
DATABASE_URL: postgresql://umami:${UMAMI_DB_PASSWORD:?run make env}@postgres:5432/umami?schema=umami
APP_SECRET: ${UMAMI_APP_SECRET:?run make env}
# Nothing leaves for Umami's makers, and no update is looked for.
DISABLE_TELEMETRY: "1"
DISABLE_UPDATES: "1"
# Every event comes from portalr's relay, with portalr's own agent, never a browser's.
DISABLE_BOT_CHECK: "1"
networks: [umami-ingest, umami-db, umami-ui]
# On the loopback alone, whatever STACKR_BIND says: this port is the UI's, and Umami's ingest
# too, which takes anyone's events, so only this machine may reach it (ADR-0050).
ports:
- 127.0.0.1:${UMAMI_PORT:-3400}:3000
healthcheck:
test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1:3000/api/heartbeat"]
interval: 5s
timeout: 3s
retries: 60
depends_on:
umami-db-init:
condition: service_completed_successfully
# Umami's role and database on plain PostgreSQL (deploy/postgres/umami.sql), with its profile
# alone; then it exits.
umami-db-init:
image: postgres:17.11-alpine@sha256:b0f9560a2de083e2cc7382e75f808c7381a32852a7ec49117deedb300e552b24
profiles: [umami, umami-init]
restart: "no"
command: ["psql", "--no-psqlrc", "--quiet", "--file=/umami.sql"]
environment:
PGHOST: postgres
PGPORT: "5432"
PGDATABASE: postgres
PGUSER: postgres
PGPASSWORD: ${POSTGRES_ADMIN_PASSWORD:?run make env}
PGCONNECT_TIMEOUT: "10"
UMAMI_DB_PASSWORD: ${UMAMI_DB_PASSWORD:?run make env}
volumes:
- ./deploy/postgres/umami.sql:/umami.sql:ro
# `make up` starts plain PostgreSQL beside it, and refuses the profile without it.
depends_on:
postgres:
condition: service_healthy
required: false
# Umami's accounts and portalr's website (deploy/umami/init); `make up` runs it once Umami is
# up, with `docker compose run`, as it does clickhouse-init.
umami-init:
image: curlimages/curl:8.22.0@sha256:58adaa4e8dca9c988bae2aba4ab3434a0bb2da16bbe3f92dec39ec7785166777
profiles: [umami-init]
restart: "no"
entrypoint: ["sh", "/init"]
environment:
UMAMI_ADMIN_PASSWORD: ${UMAMI_ADMIN_PASSWORD:?run make env}
UMAMI_PORTALR_PASSWORD: ${UMAMI_PORTALR_PASSWORD:?run make env}
UMAMI_WEBSITE_ID: ${UMAMI_WEBSITE_ID:?run make env}
# Replays kept for portalr's website: off until the privacy review (portalr ADR-0077).
UMAMI_REPLAY: ${UMAMI_REPLAY:-false}
volumes:
- ./deploy/umami/init:/init:ro
networks: [umami-ingest]
depends_on:
umami:
condition: service_healthy
# Deletes replays older than UMAMI_REPLAY_RETENTION_DAYS (deploy/umami/retention, portalr
# ADR-0077): Umami has no retention setting, and its API deletes a replay only with its whole
# session. It runs as Umami's own database role, on Umami's database network alone, every six
# hours, whether or not replay is on, so recordings made before it was turned off still expire.
# It is unhealthy when no run has finished for a day: a failed run exits and is restarted, with
# nothing to show, and one stuck for a day shows the same. 0 days keeps them for ever.
umami-retention:
image: postgres:17.11-alpine@sha256:b0f9560a2de083e2cc7382e75f808c7381a32852a7ec49117deedb300e552b24
profiles: [umami]
restart: unless-stopped
entrypoint: ["sh", "/retention"]
init: true
stop_signal: SIGTERM
user: "70"
read_only: true
tmpfs: [/tmp]
cap_drop: [ALL]
security_opt: ["no-new-privileges:true"]
environment:
PGHOST: postgres
PGDATABASE: umami
PGUSER: umami
PGPASSWORD: ${UMAMI_DB_PASSWORD:?run make env}
PGCONNECT_TIMEOUT: "10"
PGOPTIONS: "-c lock_timeout=10s -c statement_timeout=5min"
UMAMI_REPLAY_RETENTION_DAYS: ${UMAMI_REPLAY_RETENTION_DAYS:-30}
volumes:
- ./deploy/umami/retention:/retention:ro
networks: [umami-db]
healthcheck:
test: ["CMD-SHELL", "test -n \"$$(find /tmp/umami-retention-ok -mmin -1440)\""]
interval: 5m
timeout: 5s
retries: 1
start_period: 5m
depends_on:
umami:
condition: service_healthy
langfuse-worker:
image: langfuse/langfuse-worker:4.46.0@sha256:3568d2d1eb5dd570f4087b37972ddffa3f6ae4f872553e0b0e2eedf4896a29e9
profiles: [langfuse]
restart: unless-stopped
environment:
<<: *langfuse-env
networks: [default, supabase]
healthcheck:
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:3030/api/health"]
interval: 5s
timeout: 3s
retries: 30
start_period: 60s
# After the web server, which applies the database's migrations as it starts: the worker
# writes Langfuse's default models as it starts, and doing so during a migration can deadlock
# it, which leaves the migration failed and the web server unable to start again.
depends_on:
<<: *langfuse-depends-on
langfuse-web:
condition: service_healthy
# Langfuse's web server runs the database migrations on start, and creates
# the organisation, project, API keys and admin user from .env on first
# start (headless initialization).
langfuse-web:
image: langfuse/langfuse:4.46.0@sha256:755b821ba8f73a20d43d90e68f2b75d2f597dd164c55890f67a05f5a8d0f0e24
profiles: [langfuse]
restart: unless-stopped
environment:
<<: *langfuse-env
NEXTAUTH_SECRET: ${LANGFUSE_NEXTAUTH_SECRET:?run make env}
AUTH_DISABLE_SIGNUP: "true"
# Browsers and SDKs upload media to MinIO's published port directly.
LANGFUSE_S3_MEDIA_UPLOAD_ENDPOINT: http://localhost:${MINIO_PORT:-9000}
LANGFUSE_S3_MEDIA_UPLOAD_INTERNAL_ENDPOINT: http://minio:9000
LANGFUSE_INIT_ORG_ID: ${LANGFUSE_INIT_ORG_ID:-stackr}
LANGFUSE_INIT_ORG_NAME: ${LANGFUSE_INIT_ORG_ID:-stackr}
LANGFUSE_INIT_PROJECT_ID: ${LANGFUSE_INIT_PROJECT_ID:-stackr}
LANGFUSE_INIT_PROJECT_NAME: ${LANGFUSE_INIT_PROJECT_ID:-stackr}
LANGFUSE_INIT_PROJECT_PUBLIC_KEY: ${LANGFUSE_PUBLIC_KEY:?run make env}
LANGFUSE_INIT_PROJECT_SECRET_KEY: ${LANGFUSE_SECRET_KEY:?run make env}
LANGFUSE_INIT_USER_EMAIL: ${LANGFUSE_ADMIN_EMAIL:-admin@stackr.local}
LANGFUSE_INIT_USER_NAME: admin
LANGFUSE_INIT_USER_PASSWORD: ${LANGFUSE_ADMIN_PASSWORD:?run make env}
ports:
- ${STACKR_BIND:-127.0.0.1}:${LANGFUSE_PORT:-3300}:3000
networks: [default, supabase]
healthcheck:
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:3000/api/public/health"]
interval: 5s
timeout: 3s
retries: 30
start_period: 120s
depends_on: *langfuse-depends-on
# The LLM gateway port: an OpenAI-compatible API in front of the providers
# and local model servers in deploy/litellm/config.yaml (ADR-0010).
litellm:
image: ghcr.io/berriai/litellm-non_root:v1.103.0@sha256:fda2894415d89350ca6a16195c935726382354d2194ebb1ce43e6bd5480b06ce
profiles: [gateway]
restart: unless-stopped
command: ["--config", "/etc/litellm/config.yaml", "--port", "4000"]
# With STACKR_UPSTREAM_CA, the authority that signed the upstream's certificate, when it is
# your own, ca-upstream.env makes it the gateway's SSL_CERT_FILE: the gateway then trusts it
# alone, the providers' public ones included. Without it, ca.env doesn't exist, and nothing
# is set.
env_file:
- path: ./deploy/litellm/ca${STACKR_UPSTREAM_CA:+-upstream}.env
required: false
environment:
LITELLM_MASTER_KEY: ${LITELLM_MASTER_KEY:?run make env}
# Encrypts credentials stored in the database; must never change.
LITELLM_SALT_KEY: ${LITELLM_SALT_KEY:?run make env}
# yamllint disable-line rule:line-length
DATABASE_URL: postgresql://litellm:${LITELLM_DB_PASSWORD:?run make env}@${STACKR_DB_HOST:-supabase_db_stackr-supabase}:5432/litellm
REDIS_URL: redis://:${REDIS_PASSWORD:?run make env}@redis:6379/1
# Provider keys: empty ones fail only the requests that need them.
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
GEMINI_API_KEY: ${GEMINI_API_KEY:-}
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY:-}
LM_STUDIO_API_BASE: ${LM_STUDIO_API_BASE:-http://host.docker.internal:1234/v1}
OMLX_API_BASE: ${OMLX_API_BASE:-http://host.docker.internal:4243/v1}
# An upstream gateway, when STACKR_GATEWAY_MODELS=upstream (ADR-0047).
STACKR_UPSTREAM_URL: ${STACKR_UPSTREAM_URL:-}
STACKR_UPSTREAM_API_KEY: ${STACKR_UPSTREAM_API_KEY:-}
STACKR_UPSTREAM_DEFAULT_MODEL: ${STACKR_UPSTREAM_DEFAULT_MODEL:-}
STACKR_UPSTREAM_FAST_MODEL: ${STACKR_UPSTREAM_FAST_MODEL:-}
# Traces to the Collector, continuing the caller's `traceparent`, with
# prompts and responses left out. `make up` turns it off when the
# observability profile isn't running.
LITELLM_OTEL_V2: ${STACKR_GATEWAY_TELEMETRY:-true}
OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
OTEL_SERVICE_NAME: litellm
OTEL_RESOURCE_ATTRIBUTES: deployment.environment.name=${STACKR_ENVIRONMENT:-local}
LITELLM_OTEL_INTEGRATION_ENABLE_METRICS: ${STACKR_GATEWAY_TELEMETRY:-true}
# Use the bundled model prices, and read no .env of its own.
LITELLM_LOCAL_MODEL_COST_MAP: "True"
LITELLM_MODE: PRODUCTION
volumes:
- ./deploy/litellm/config.yaml:/etc/litellm/config.yaml:ro
# The model groups: providers or upstream.
- ./deploy/litellm/groups/${STACKR_GATEWAY_MODELS:-providers}.yaml:/etc/litellm/groups.yaml:ro
- ${STACKR_UPSTREAM_CA:-/dev/null}:/etc/litellm/upstream-ca.pem:ro
ports:
- ${STACKR_BIND:-127.0.0.1}:${LITELLM_PORT:-4400}:4000
# Local model servers run on the host.
extra_hosts:
- host.docker.internal:host-gateway
networks: [default, supabase]
healthcheck:
test:
- CMD
- python
- -c
- >-
import sys, urllib.request;
sys.exit(urllib.request.urlopen('http://127.0.0.1:4000/health/readiness', timeout=3).status != 200)
interval: 5s
timeout: 5s
retries: 30
start_period: 120s
depends_on:
db-init:
condition: service_completed_successfully
redis:
condition: service_healthy
# Sends test telemetry for scripts/smoke; not a service.
telemetrygen:
image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:v0.162.0@sha256:5350f77dbc914034321dc7629058e141996c8dc2cdde076d281e573efee1a67e
profiles: [smoke]
# Runs scripts/smoke's requests from inside the stack's networks, so the
# checks need no published port; not a service.
probe:
image: curlimages/curl:8.22.0@sha256:58adaa4e8dca9c988bae2aba4ab3434a0bb2da16bbe3f92dec39ec7785166777
profiles: [smoke]
networks: [default, supabase]