-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
206 lines (194 loc) · 4.37 KB
/
docker-compose.yml
File metadata and controls
206 lines (194 loc) · 4.37 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# Docker Compose for Redis Stream Client Go Development Environment
version: '3.8'
services:
# Redis server
redis:
image: redis:7.2.3-alpine
container_name: redis-stream-dev
ports:
- "6379:6379"
command: redis-server --notify-keyspace-events Ex --appendonly yes
volumes:
- redis_data:/data
- ./docker/redis.conf:/usr/local/etc/redis/redis.conf:ro
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
networks:
- redis-stream-network
# Redis Insight for monitoring (optional)
redis-insight:
image: redislabs/redisinsight:latest
container_name: redis-insight
ports:
- "8001:8001"
environment:
- RIPORT=8001
volumes:
- redis_insight_data:/db
networks:
- redis-stream-network
depends_on:
redis:
condition: service_healthy
# Development environment
dev:
build:
context: .
dockerfile: Dockerfile
target: development
container_name: redis-stream-dev-env
volumes:
- .:/app
- go_mod_cache:/go/pkg/mod
environment:
- POD_NAME=dev-consumer-1
- GO_ENV=development
- REDIS_URL=redis:6379
- REDIS_ADDR=redis:6379
working_dir: /app
command: tail -f /dev/null # Keep container running
networks:
- redis-stream-network
depends_on:
redis:
condition: service_healthy
# Consumer 1
consumer1:
build:
context: .
dockerfile: Dockerfile
target: development
container_name: consumer-1
volumes:
- .:/app
- go_mod_cache:/go/pkg/mod
environment:
- POD_NAME=consumer-1
- REDIS_URL=redis:6379
- REDIS_ADDR=redis:6379
working_dir: /app
command: go run ./examples/load-balancing
networks:
- redis-stream-network
depends_on:
redis:
condition: service_healthy
# Consumer 2
consumer2:
build:
context: .
dockerfile: Dockerfile
target: development
container_name: consumer-2
volumes:
- .:/app
- go_mod_cache:/go/pkg/mod
environment:
- POD_NAME=consumer-2
- REDIS_URL=redis:6379
- REDIS_ADDR=redis:6379
working_dir: /app
command: go run ./examples/load-balancing
networks:
- redis-stream-network
depends_on:
redis:
condition: service_healthy
# Consumer 3
consumer3:
build:
context: .
dockerfile: Dockerfile
target: development
container_name: consumer-3
volumes:
- .:/app
- go_mod_cache:/go/pkg/mod
environment:
- POD_NAME=consumer-3
- REDIS_URL=redis:6379
- REDIS_ADDR=redis:6379
working_dir: /app
command: go run ./examples/load-balancing
networks:
- redis-stream-network
depends_on:
redis:
condition: service_healthy
# Producer
producer:
build:
context: .
dockerfile: Dockerfile
target: development
container_name: producer
volumes:
- .:/app
- go_mod_cache:/go/pkg/mod
environment:
- REDIS_URL=redis:6379
- REDIS_ADDR=redis:6379
working_dir: /app
command: go run ./examples/load-balancing producer
networks:
- redis-stream-network
depends_on:
redis:
condition: service_healthy
# Testing environment
test:
build:
context: .
dockerfile: Dockerfile
target: testing
container_name: redis-stream-test
volumes:
- .:/app
- go_mod_cache:/go/pkg/mod
environment:
- POD_NAME=test-consumer
- GO_ENV=test
working_dir: /app
networks:
- redis-stream-network
depends_on:
redis:
condition: service_healthy
# Linting environment
lint:
build:
context: .
dockerfile: Dockerfile
target: linting
container_name: redis-stream-lint
volumes:
- .:/app
- go_mod_cache:/go/pkg/mod
working_dir: /app
# Security scanning environment
security:
build:
context: .
dockerfile: Dockerfile
target: security
container_name: redis-stream-security
volumes:
- .:/app
- go_mod_cache:/go/pkg/mod
working_dir: /app
volumes:
redis_data:
driver: local
redis_insight_data:
driver: local
go_mod_cache:
driver: local
networks:
redis-stream-network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16