generated from System-Deep-Dive/Bitly-Dongwoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.infra.yml
More file actions
160 lines (149 loc) · 4.25 KB
/
docker-compose.infra.yml
File metadata and controls
160 lines (149 loc) · 4.25 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
services:
postgres:
image: postgres:16-bookworm
deploy:
resources:
limits:
memory: 2G
reservations:
memory: 1G
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_SHARED_BUFFERS: ${POSTGRES_SHARED_BUFFERS}
POSTGRES_EFFECTIVE_CACHE_SIZE: ${POSTGRES_EFFECTIVE_CACHE_SIZE}
ports:
- "${POSTGRES_HOST_PORT}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- monitoring
redis:
image: redis:7-alpine
deploy:
resources:
limits:
memory: 1G
reservations:
memory: 512M
ports:
- "${REDIS_HOST_PORT}:6379"
volumes:
- redis_data:/data
command: redis-server --appendonly yes --maxmemory 800m --maxmemory-policy allkeys-lru
networks:
- monitoring
# 모니터링 스택
prometheus:
image: prom/prometheus:latest
deploy:
replicas: 1
ports:
- "${PROMETHEUS_HOST_PORT}:9090"
volumes:
- ./monitoring/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:
- monitoring
grafana:
image: grafana/grafana:latest
deploy:
replicas: 1
ports:
- "${GRAFANA_HOST_PORT}:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD}
- GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=grafana-exploretraces-app,grafana-metricsdrilldown-app,grafana-lokiexplore-app,grafana-pyroscope-app
volumes:
- grafana_data:/var/lib/grafana
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning
networks:
- monitoring
redis-exporter:
image: oliver006/redis_exporter:latest
deploy:
replicas: 1
ports:
- "${REDIS_EXPORTER_HOST_PORT}:9121"
environment:
- REDIS_ADDR=${REDIS_EXPORTER_ADDR}
depends_on:
- redis
networks:
- monitoring
postgres-exporter:
image: prometheuscommunity/postgres-exporter:latest
deploy:
replicas: 1
ports:
- "${POSTGRES_EXPORTER_HOST_PORT}:9187"
environment:
- DATA_SOURCE_NAME=${POSTGRES_EXPORTER_DATA_SOURCE_NAME}
depends_on:
- postgres
networks:
- monitoring
node-exporter:
image: prom/node-exporter:latest
deploy:
replicas: 1
ports:
- "${NODE_EXPORTER_HOST_PORT}: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)($$|/)'
networks:
- monitoring
# k6 테스트 결과 저장용 InfluxDB
influxdb:
image: influxdb:1.8
deploy:
replicas: 1
ports:
- "${INFLUXDB_HOST_PORT}:8086"
environment:
- INFLUXDB_DB=${INFLUXDB_DB}
- INFLUXDB_ADMIN_USER=${INFLUXDB_ADMIN_USER}
- INFLUXDB_ADMIN_PASSWORD=${INFLUXDB_ADMIN_PASSWORD}
- INFLUXDB_USER=${INFLUXDB_USER}
- INFLUXDB_USER_PASSWORD=${INFLUXDB_USER_PASSWORD}
# HTTP 요청 크기 제한 대폭 증가 (500MB)
- INFLUXDB_HTTP_MAX_BODY_SIZE=524288000
# 배치 크기 최적화
- INFLUXDB_DATA_MAX_SERIES_PER_DATABASE=1000000
- INFLUXDB_DATA_MAX_VALUES_PER_TAG=100000
# 메모리 및 성능 최적화
- INFLUXDB_DATA_CACHE_MAX_MEMORY_SIZE=1073741824
- INFLUXDB_DATA_CACHE_SNAPSHOT_MEMORY_SIZE=26214400
- INFLUXDB_DATA_CACHE_SNAPSHOT_WRITE_COLD_DURATION=10m
# HTTP 연결 최적화
- INFLUXDB_HTTP_MAX_CONCURRENT_WRITE_LIMIT=0
- INFLUXDB_HTTP_MAX_ENQUEUED_WRITE_LIMIT=0
- INFLUXDB_HTTP_MAX_LINE_PROTOCOL_LENGTH=0
volumes:
- influxdb_data:/var/lib/influxdb
networks:
- monitoring
volumes:
postgres_data:
redis_data:
prometheus_data:
grafana_data:
influxdb_data:
networks:
monitoring:
driver: bridge