Repository navigation
Expand file tree
/
Copy pathdocker-compose.postgres.yml
More file actions
52 lines (50 loc) · 2.07 KB
/
Copy pathdocker-compose.postgres.yml
File metadata and controls
52 lines (50 loc) · 2.07 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
# Rustrak with PostgreSQL: one container serves the dashboard and the API on
# 8080, next to a PostgreSQL service.
#
# export SESSION_SECRET_KEY=$(openssl rand -hex 32)
# export CREATE_SUPERUSER=admin@example.com:changeme123
# export POSTGRES_PASSWORD=$(openssl rand -hex 16)
# docker compose -f docker-compose.postgres.yml up -d
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-rustrak}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?generate one with openssl rand -hex 16}
POSTGRES_DB: ${POSTGRES_DB:-rustrak}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-rustrak} -d ${POSTGRES_DB:-rustrak}"]
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
server:
image: rustrak/rustrak-server:postgres
# Behind a reverse proxy on the same Docker network, delete this `ports`
# block: the proxy reaches the container on 8080 and nothing needs a host
# port. Full setup: https://rustrak.dev/configuration/production#reverse-proxy
ports:
- "${SERVER_PORT:-8080}:8080"
environment:
- DATABASE_URL=postgres://${POSTGRES_USER:-rustrak}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-rustrak}
- SESSION_SECRET_KEY=${SESSION_SECRET_KEY:?generate one with openssl rand -hex 32}
- CREATE_SUPERUSER=${CREATE_SUPERUSER:-}
# The address people and SDKs reach, e.g. https://rustrak.example.com.
# Without it the DSN carries the bind address, which nothing can reach.
- PUBLIC_URL=${PUBLIC_URL:-}
# Anonymous telemetry is on by default. Uncomment to turn it off.
# - RUSTRAK_TELEMETRY=off
# /metrics is unauthenticated. Restrict access before setting this to on.
- RUSTRAK_METRICS=${RUSTRAK_METRICS:-off}
# Uploaded source maps live here; the database is in PostgreSQL.
volumes:
- rustrak_data:/data
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
volumes:
postgres_data:
rustrak_data: