-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
140 lines (133 loc) · 3.75 KB
/
docker-compose.yml
File metadata and controls
140 lines (133 loc) · 3.75 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
version: '3.8'
services:
# PostgreSQL source database
postgres:
image: postgres:15-alpine
container_name: cdc_postgres
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: test.123
POSTGRES_INITDB_ARGS: "--encoding=UTF8"
restart: always
ports:
- "5432:5432"
volumes:
- ./examples/scripts/init_postgres.sql:/docker-entrypoint-initdb.d/init_postgres.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
command: >
postgres
-c wal_level=logical
-c max_replication_slots=10
-c max_wal_senders=10
-c max_connections=100
# MySQL destination database
mysql:
image: mysql:8.0
container_name: cdc_mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: test.123
MYSQL_DATABASE: cdc_db
MYSQL_USER: cdc_user
MYSQL_PASSWORD: test.123
ports:
- "3306:3306"
volumes:
- ./examples/scripts/init_mysql.sql:/docker-entrypoint-initdb.d/init_mysql.sql:ro
command:
- --max_allowed_packet=536870912 # 512MB
- --innodb_buffer_pool_size=4GB
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "cdc_user", "-ptest.123"]
interval: 10s
timeout: 5s
retries: 5
# CDC Application
cdc_app:
# image: pg2any_cdc_app
build:
context: .
dockerfile: Dockerfile
container_name: cdc_application
depends_on:
postgres:
condition: service_healthy
mysql:
condition: service_healthy
env_file:
- ./env/.env
ports:
- "8080:8080" # Metrics endpoint
restart: unless-stopped
stop_grace_period: 300s
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# Prometheus monitoring
prometheus:
image: prom/prometheus:latest
container_name: cdc_prometheus
ports:
- "9090:9090"
volumes:
- ./examples/monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
- ./examples/monitoring/prometheus-rules:/etc/prometheus/rules
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'
- '--web.enable-admin-api'
restart: unless-stopped
# Node Exporter for system metrics
node-exporter:
image: prom/node-exporter:latest
container_name: cdc_node_exporter
ports:
- "9100:9100"
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
restart: unless-stopped
# PostgreSQL Exporter
postgres-exporter:
image: prometheuscommunity/postgres-exporter:latest
container_name: cdc_postgres_exporter
ports:
- "9187:9187"
environment:
DATA_SOURCE_NAME: "postgresql://postgres:test.123@postgres:5432/postgres?sslmode=disable"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
# MySQL Exporter
mysql-exporter:
image: prom/mysqld-exporter:latest
container_name: cdc_mysql_exporter
ports:
- "9104:9104"
command:
- --config.my-cnf=/etc/mysql/.my.cnf
volumes:
- ./examples/monitoring/exporter/mysql/:/etc/mysql/:ro
restart: unless-stopped
depends_on:
mysql:
condition: service_healthy