-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
129 lines (119 loc) · 3.62 KB
/
docker-compose.yml
File metadata and controls
129 lines (119 loc) · 3.62 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
services:
# =============================================================================
# Core Infrastructure
# =============================================================================
redis:
image: redis:7-alpine
container_name: watcher-redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis-data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
postgres:
image: postgres:16-alpine
container_name: watcher-postgres
restart: unless-stopped
ports:
- "5432:5432"
environment:
POSTGRES_USER: watcher
POSTGRES_PASSWORD: watcher123
POSTGRES_DB: watcher
volumes:
- postgres-data:/var/lib/postgresql/data
- ./migrations:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U watcher"]
interval: 10s
timeout: 5s
retries: 5
# =============================================================================
# Monitoring Stack
# =============================================================================
prometheus:
image: prom/prometheus:v2.48.0
container_name: watcher-prometheus
restart: unless-stopped
network_mode: host
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'
- '--web.enable-lifecycle'
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:9090/-/healthy"]
interval: 30s
timeout: 10s
retries: 3
grafana:
image: grafana/grafana:10.2.0
container_name: watcher-grafana
restart: unless-stopped
network_mode: host
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
GF_USERS_ALLOW_SIGN_UP: "false"
volumes:
- grafana-data:/var/lib/grafana
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning
- ./monitoring/grafana/dashboards:/var/lib/grafana/dashboards
depends_on:
- prometheus
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:3000/api/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
# Redis Monitoring UI (optional)
redis-commander:
image: rediscommander/redis-commander:latest
platform: linux/amd64 # Force amd64 for Apple Silicon compatibility
container_name: watcher-redis-ui
restart: unless-stopped
ports:
- "8081:8081"
environment:
REDIS_HOSTS: local:redis:6379
depends_on:
- redis
# =============================================================================
# Watcher Service (for production deployment)
# =============================================================================
# watcher:
# build:
# context: .
# dockerfile: Dockerfile
# container_name: watcher-app
# restart: unless-stopped
# ports:
# - "8080:8080"
# environment:
# REDIS_URL: redis://redis:6379
# DATABASE_URL: postgres://watcher:watcher123@postgres:5432/watcher?sslmode=disable
# depends_on:
# redis:
# condition: service_healthy
# postgres:
# condition: service_healthy
# volumes:
# - ./config.yaml:/app/config.yaml
volumes:
redis-data:
postgres-data:
prometheus-data:
grafana-data:
networks:
default:
name: watcher-network