-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
100 lines (93 loc) · 2.92 KB
/
docker-compose.yml
File metadata and controls
100 lines (93 loc) · 2.92 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
# ============================================================
# Telentic - Local Development Stack
# ============================================================
# Usage:
# 1. Copy backend/.env.example -> backend/.env (add your API keys)
# 2. docker compose up --build
# 3. Open http://localhost:3000
#
# Services:
# - db : PostgreSQL 15 (port 54322)
# - rest : PostgREST API (internal)
# - supabase : nginx gateway (port 54321) — mimics Supabase API
# - backend : FastAPI (port 8001)
# - frontend : Next.js (port 3000)
# ============================================================
x-jwt-secret: &jwt-secret "super-secret-jwt-token-with-at-least-32-characters-long"
# JWT for role=postgres, signed with the secret above (never expires)
x-service-key: &service-key "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoicG9zdGdyZXMifQ.oM0SXF31Vs1nfwCaDxjlczE237KcNKhTpKEYxMX-jEU"
services:
# ---- PostgreSQL ----
db:
image: postgres:15-alpine
restart: unless-stopped
ports:
- "54322:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
volumes:
- pgdata:/var/lib/postgresql/data
- ./docker/db-init.sh:/docker-entrypoint-initdb.d/00_init.sh
- ./supabase/migrations:/app/migrations:ro
- ./supabase/seed.sql:/app/seed.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
# ---- PostgREST (REST API over Postgres) ----
rest:
image: postgrest/postgrest:v12.2.3
restart: unless-stopped
environment:
PGRST_DB_URI: postgres://postgres:postgres@db:5432/postgres
PGRST_DB_SCHEMAS: public
PGRST_DB_ANON_ROLE: postgres
PGRST_JWT_SECRET: *jwt-secret
PGRST_DB_USE_LEGACY_GUCS: "false"
depends_on:
db:
condition: service_healthy
# ---- Supabase Gateway (routes /rest/v1 -> PostgREST) ----
supabase:
image: nginx:alpine
restart: unless-stopped
ports:
- "54321:80"
volumes:
- ./docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- rest
# ---- Backend (FastAPI) ----
backend:
build: ./backend
restart: unless-stopped
ports:
- "8001:8000"
env_file:
- path: ./backend/.env
required: false
environment:
# Override Supabase to point at local gateway
SUPABASE_URL: http://supabase:80
SUPABASE_SERVICE_KEY: *service-key
APP_URL: http://localhost:3000
API_URL: http://localhost:8001
depends_on:
- supabase
# ---- Frontend (Next.js) ----
frontend:
build: ./frontend
restart: unless-stopped
ports:
- "3000:3000"
environment:
NEXT_PUBLIC_API_URL: http://localhost:8001
NEXT_PUBLIC_SUPABASE_URL: http://localhost:54321
NEXT_PUBLIC_SUPABASE_ANON_KEY: *service-key
depends_on:
- backend
volumes:
pgdata: