-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
191 lines (182 loc) · 4.82 KB
/
Copy pathdocker-compose.yml
File metadata and controls
191 lines (182 loc) · 4.82 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
services:
# Nebula application for development
nebula-dev:
build:
context: .
dockerfile: Dockerfile.dev
target: development
container_name: nebula-dev
volumes:
- .:/workspace
- /workspace/tmp # Exclude tmp directory from sync
- go-cache:/go/pkg/mod
- nebula-cache:/home/nebula/.cache
working_dir: /workspace
ports:
- "8080:8080" # Application port
- "9090:9090" # Metrics port
- "2345:2345" # Delve debugger port
environment:
- GO_ENV=development
- POSTGRES_URL=postgres://nebula:password@postgres:5432/nebula_dev?sslmode=disable
- MYSQL_URL=nebula:password@tcp(mysql:3306)/nebula_dev
- REDIS_URL=redis://redis:6379/0
depends_on:
- postgres
- mysql
- redis
networks:
- nebula-network
command: ["air", "-c", ".air.toml"]
# Nebula production build
nebula-prod:
build:
context: .
dockerfile: Dockerfile
target: production
container_name: nebula-prod
ports:
- "9091:9090" # Metrics port (different from dev)
environment:
- GO_ENV=production
profiles:
- production
networks:
- nebula-network
# PostgreSQL for CDC testing
postgres:
image: postgres:16-alpine
container_name: nebula-postgres
environment:
POSTGRES_DB: nebula_dev
POSTGRES_USER: nebula
POSTGRES_PASSWORD: password
POSTGRES_INITDB_ARGS: "--encoding=UTF-8"
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
- ./scripts/postgres-init.sql:/docker-entrypoint-initdb.d/init.sql
command: >
postgres -c wal_level=logical
-c max_wal_senders=10
-c max_replication_slots=10
-c shared_preload_libraries=pgoutput
networks:
- nebula-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U nebula -d nebula_dev"]
interval: 10s
timeout: 5s
retries: 5
# MySQL for CDC testing
mysql:
image: mysql:8.0
container_name: nebula-mysql
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: nebula_dev
MYSQL_USER: nebula
MYSQL_PASSWORD: password
ports:
- "3306:3306"
volumes:
- mysql-data:/var/lib/mysql
- ./scripts/mysql-init.sql:/docker-entrypoint-initdb.d/init.sql
command: >
--log-bin=mysql-bin
--binlog-format=ROW
--server-id=1
--gtid-mode=ON
--enforce-gtid-consistency=ON
--binlog-row-image=FULL
networks:
- nebula-network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "nebula", "-ppassword"]
interval: 10s
timeout: 5s
retries: 5
# Redis for caching and state management
redis:
image: redis:7-alpine
container_name: nebula-redis
ports:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- nebula-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# MinIO for S3-compatible object storage testing
minio:
image: minio/minio:latest
container_name: nebula-minio
ports:
- "9000:9000"
- "9001:9001"
environment:
MINIO_ROOT_USER: nebula
MINIO_ROOT_PASSWORD: nebulapass123
volumes:
- minio-data:/data
command: server /data --console-address ":9001"
networks:
- nebula-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
# Prometheus for metrics collection
prometheus:
image: prom/prometheus:latest
container_name: nebula-prometheus
ports:
- "9092:9090"
volumes:
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention.time=200h'
- '--web.enable-lifecycle'
networks:
- nebula-network
profiles:
- monitoring
# Grafana for metrics visualization
grafana:
image: grafana/grafana:latest
container_name: nebula-grafana
ports:
- "3000:3000"
environment:
GF_SECURITY_ADMIN_PASSWORD: admin
volumes:
- grafana-data:/var/lib/grafana
- ./config/grafana/datasources:/etc/grafana/provisioning/datasources
- ./config/grafana/dashboards:/etc/grafana/provisioning/dashboards
networks:
- nebula-network
profiles:
- monitoring
volumes:
postgres-data:
mysql-data:
redis-data:
minio-data:
prometheus-data:
grafana-data:
go-cache:
nebula-cache:
networks:
nebula-network:
driver: bridge