-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
107 lines (100 loc) · 3.32 KB
/
Copy pathdocker-compose.yml
File metadata and controls
107 lines (100 loc) · 3.32 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
# Production-ish local stack for "This is NOT Jac".
#
# frontend (nginx) -> backend (gunicorn/uvicorn FastAPI) -> postgres + redis
# \-> analytics (uvicorn FastAPI microservice)
#
# Bring it up with: docker compose up --build
# Then open: http://localhost:8080
#
# Secrets come from a local .env file (copy .env.example -> .env first).
name: this-is-not-jac
services:
# --- Datastore: PostgreSQL ------------------------------------------------
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-tinj}
POSTGRES_USER: ${POSTGRES_USER:-tinj}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-tinj} -d ${POSTGRES_DB:-tinj}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
# --- Cache: Redis ---------------------------------------------------------
redis:
image: redis:7-alpine
restart: unless-stopped
command: ["redis-server", "--save", "60", "1", "--appendonly", "no"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
# --- Analytics microservice (separate process, like the Jac sv import) ----
analytics:
build:
context: ./analytics
restart: unless-stopped
expose:
- "8000"
healthcheck:
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:8000/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
# --- Backend API ----------------------------------------------------------
backend:
build:
context: ./backend
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
analytics:
condition: service_started
environment:
TINJ_ENVIRONMENT: production
TINJ_DEBUG: "false"
TINJ_DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-tinj}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-tinj}
TINJ_REDIS_URL: redis://redis:6379/0
TINJ_ANALYTICS_URL: http://analytics:8000
TINJ_SECRET_KEY: ${TINJ_SECRET_KEY:?set TINJ_SECRET_KEY in .env}
TINJ_CORS_ORIGINS: ${TINJ_CORS_ORIGINS:-["http://localhost:8080"]}
TINJ_STATIC_DIR: /app/static
# Source viewer: the repo is mounted read-only at /repo so the "read this
# site's own source" endpoints can highlight the real monorepo.
TINJ_SOURCE_ROOT: /repo
volumes:
# Project dir mounted read-only for the source viewer. (Bind-mounting the
# whole repo cleanly is awkward with build contexts, so we mount THIS
# project directory and point TINJ_SOURCE_ROOT at it.)
- ./:/repo:ro
expose:
- "8000"
healthcheck:
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:8000/api/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 20s
# --- Frontend (nginx serving the SPA + proxying to backend) ---------------
frontend:
build:
context: ./frontend
restart: unless-stopped
depends_on:
backend:
condition: service_started
ports:
- "8080:80"
volumes:
postgres_data: