Repository navigation
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
61 lines (59 loc) · 2.37 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
61 lines (59 loc) · 2.37 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
volumes:
timescale_data:
go_mod_cache:
services:
timescaledb:
image: timescale/timescaledb-ha:pg17.9-ts2.26.4
container_name: timescaledb
ports:
- "5432:5432"
environment:
# The superuser and the maintenance database, used by `just database
# init`, psql and the healthcheck. The application never connects as
# this: `just database up` creates a `trakrf` database owned by
# trakrf-migrate and served by trakrf-app, because a superuser bypasses
# row-level security (TRA-1075). See database/sql/.
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB:-postgres}
volumes:
- timescale_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -U postgres"]
interval: 10s
timeout: 5s
retries: 5
backend:
build:
context: ./backend
target: development
network: host
container_name: backend
ports:
- "8080:8080"
environment:
BACKEND_PORT: ${BACKEND_PORT:-8080}
BACKEND_LOG_LEVEL: ${BACKEND_LOG_LEVEL:-info}
# Composed from parts, the same way helm/trakrf-backend builds it from
# $(PGUSER)/$(PGPASSWORD) and a host/port/database (TRA-1190). Nothing
# here stores a DSN, so nothing here can hold a stale one.
#
# `:-` and not `:?` on purpose: these carry the well-known local defaults
# that `just database init` bootstraps, so a fresh clone with no .env.local
# comes up on the canonical database rather than on nothing. The defaults
# are the same values database/justfile uses — `just test-env-drift`
# checks that claim rather than trusting it.
#
# The app role, never the migrate role and never postgres: a superuser or
# an owner bypasses row-level security, so connecting as one means no
# policy is ever evaluated locally (TRA-1075).
PG_URL: postgresql://${PG_APP_USER:-trakrf-app}:${PG_APP_PASSWORD:-trakrf-app}@${PG_HOST:-timescaledb}:${PG_PORT:-5432}/${PG_DATABASE:-trakrf}?sslmode=${PG_SSLMODE:-disable}
JWT_SECRET: ${JWT_SECRET:-dev-secret-change-in-production}
JWT_EXPIRATION: ${JWT_EXPIRATION:-3600}
volumes:
- ./backend:/app
- ./database/seeds:/app/database/seeds
- go_mod_cache:/go/pkg/mod
depends_on:
timescaledb:
condition: service_healthy
restart: unless-stopped