-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
113 lines (106 loc) · 2.76 KB
/
docker-compose.yaml
File metadata and controls
113 lines (106 loc) · 2.76 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
# Infra (redis, postgres, mongodb, adminer): `docker compose up -d`
# App + Prometheus: `docker compose --profile app up -d`
services:
gomodel:
profiles:
- app
build:
context: .
dockerfile: Dockerfile
ports:
- "${PORT:-8080}:8080"
env_file:
- .env
environment:
# Cache configuration
- REDIS_URL=redis://redis:6379
# Metrics
- METRICS_ENABLED=true
# Storage configuration (PostgreSQL for audit logs)
- POSTGRES_URL=postgres://gomodel:gomodel@postgres:5432/gomodel
# MongoDB configuration (uncomment to use MongoDB instead)
- MONGODB_URL=mongodb://mongodb:27017/gomodel
# Audit logging - all enabled with PostgreSQL
- LOGGING_ENABLED=true
# - STORAGE_TYPE=postgresql
- STORAGE_TYPE=mongodb
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
mongodb:
condition: service_healthy
restart: unless-stopped
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: redis-server --appendonly yes
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
postgres:
image: postgres:18-alpine
ports:
- "5432:5432"
environment:
- POSTGRES_USER=gomodel
- POSTGRES_PASSWORD=gomodel
- POSTGRES_DB=gomodel
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U gomodel -d gomodel"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
mongodb:
image: mongo:8
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db
command: ["--replSet", "rs0", "--bind_ip_all"]
restart: unless-stopped
healthcheck:
test: ["CMD", "mongosh", "--quiet", "--eval", "try { rs.status() } catch(e) { rs.initiate({_id:'rs0',members:[{_id:0,host:'localhost:27017'}]}) }; if (!db.hello().isWritablePrimary) { quit(1) }"]
interval: 5s
timeout: 10s
retries: 10
start_period: 10s
adminer:
image: adminer:5
ports:
- "8081:8080"
depends_on:
- postgres
restart: unless-stopped
prometheus:
profiles:
- app
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--web.enable-lifecycle"
depends_on:
- gomodel
restart: unless-stopped
volumes:
redis_data:
postgres_data:
mongodb_data:
prometheus_data: