Repository navigation
Expand file tree
/
Copy pathcompose.yml
More file actions
140 lines (134 loc) · 6.21 KB
/
Copy pathcompose.yml
File metadata and controls
140 lines (134 loc) · 6.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Controlvar: the production compose file, for one Docker host. It runs the
# published images and builds nothing.
#
# README.md beside this file says how to run it and lists its settings.
# Not `controlvar` (or `experimently`, the directory of a clone made before
# the rename): that is the project name the development compose file
# gets from a checkout directory of that name, and sharing it would make this
# file recreate those containers and adopt their volumes. Fixed rather than
# taken from the directory, so the volume names (experimently-selfhost_
# postgres_data, ..._redis_data) are the same on every host.
name: experimently-selfhost
services:
# ---------------------------------------------------------------------------
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-experimently}
# Applied only when the data volume is first initialised. Changing it
# later does not change the database's password.
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:?required: generate with openssl rand -hex 32}"
POSTGRES_DB: ${POSTGRES_DB:-experimentation}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
# $$: the container's own variables, read when the check runs.
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 5s
retries: 12
restart: unless-stopped
# ---------------------------------------------------------------------------
redis:
image: redis:7-alpine
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 12
restart: unless-stopped
# ---------------------------------------------------------------------------
api:
image: ghcr.io/controlvar/controlvar:${EXPERIMENTLY_PROFILE:-core}-0.47.0 # x-release-please-version
# Published for linux/amd64 only (#181): an arm64 host runs it emulated.
platform: linux/amd64
environment:
ENVIRONMENT: production
LOG_LEVEL: ${LOG_LEVEL:-INFO}
LOG_FORMAT: json
WEB_CONCURRENCY: ${WEB_CONCURRENCY:-1}
# Sign-in: local (the default), or cognito with the user pool, its app
# client and its Hosted UI domain below, each empty unless .env sets it.
AUTH_PROVIDER: ${AUTH_PROVIDER:-local}
COGNITO_USER_POOL_ID: ${COGNITO_USER_POOL_ID:-}
COGNITO_CLIENT_ID: ${COGNITO_CLIENT_ID:-}
COGNITO_DOMAIN: ${COGNITO_DOMAIN:-}
# The user pool's region; the API uses us-east-1 when it is not set.
AWS_REGION: ${AWS_REGION:-us-east-1}
# Local sign-in: the roles whose accounts must use two-step sign-in,
# e.g. ADMIN,DEVELOPER. Empty, the default, requires it for no role; an
# entry that is not one of ADMIN, DEVELOPER, ANALYST and VIEWER stops
# the API starting and names the entry.
LOCAL_AUTH_2FA_REQUIRED_ROLES: ${LOCAL_AUTH_2FA_REQUIRED_ROLES:-}
DEV_AUTH_BYPASS: "false"
PUBLIC_BASE_URL: "${PUBLIC_BASE_URL:?required: the URL people open, e.g. https://controlvar.example.com}"
SECRET_KEY: "${SECRET_KEY:?required: generate with openssl rand -hex 32}"
FIRST_SUPERUSER: "${FIRST_SUPERUSER:?required: the first administrator's email address}"
FIRST_SUPERUSER_PASSWORD: "${FIRST_SUPERUSER_PASSWORD:?required: generate with openssl rand -base64 18}"
# The full profile refuses to start without it; the core profile ignores it.
AUDIT_HMAC_KEY: ${AUDIT_HMAC_KEY:-}
METRICS_TOKEN: ${METRICS_TOKEN:-}
# Optional, empty by default, and an empty key is the same as an unset
# one. Each turns a feature on when it is set: warehouse analysis (the
# full profile), then LLM experiment variants by provider.
WAREHOUSE_CREDENTIALS_KEYS: ${WAREHOUSE_CREDENTIALS_KEYS:-}
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
GEMINI_API_KEY: ${GEMINI_API_KEY:-}
# Proxies whose X-Forwarded-For the API believes besides the dashboard
# container and the gateway of this project's network, which it always
# believes: a TLS proxy on another machine. Empty by default.
FORWARDED_ALLOW_IPS: ${FORWARDED_ALLOW_IPS:-}
POSTGRES_SERVER: ${POSTGRES_SERVER:-postgres}
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
POSTGRES_USER: ${POSTGRES_USER:-experimently}
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:?required: generate with openssl rand -hex 32}"
POSTGRES_DB: ${POSTGRES_DB:-experimentation}
POSTGRES_SCHEMA: experimentation
# The container waits for the database (up to 120 s), then creates or
# upgrades the schema and the first administrator before serving.
RUN_MIGRATIONS: "true"
# No seeds in production: the demo seed creates a user with a published
# password.
SEED: ""
REDIS_HOST: ${REDIS_HOST:-redis}
REDIS_PORT: ${REDIS_PORT:-6379}
REDIS_REQUIRED: "false"
# Deliberately no depends_on: with POSTGRES_SERVER pointing elsewhere the
# bundled postgres is not started, and the entrypoint's own wait covers
# the start-up order when it is.
healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost:8000/health/ready"]
interval: 10s
timeout: 5s
retries: 30
start_period: 300s
restart: unless-stopped
# ---------------------------------------------------------------------------
web:
image: ghcr.io/controlvar/controlvar-web:${EXPERIMENTLY_PROFILE:-core}-0.47.0 # x-release-please-version
platform: linux/amd64
environment:
# The dashboard serves the static app and proxies /api, /ws and /health
# to the api service: one origin, PUBLIC_BASE_URL.
API_UPSTREAM: http://api:8000
# The only published port. Bound to loopback by default: put a TLS reverse
# proxy in front and forward the Host header unchanged.
ports:
- "${HTTP_BIND:-127.0.0.1}:${HTTP_PORT:-8080}:8080"
depends_on:
api:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8080/healthz"]
interval: 10s
timeout: 5s
retries: 6
start_period: 10s
restart: unless-stopped
volumes:
postgres_data:
redis_data: