-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
266 lines (252 loc) · 6.86 KB
/
docker-compose.yml
File metadata and controls
266 lines (252 loc) · 6.86 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
services:
# PostgreSQL - Port 5432
postgres:
image: postgres:16
container_name: dbfordevs-postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: testdb
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./docker/postgres-init:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
# MySQL - Port 3306
mysql:
image: mysql:8
container_name: dbfordevs-mysql
environment:
MYSQL_ROOT_PASSWORD: mysql
MYSQL_DATABASE: testdb
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
- ./docker/mysql-init:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-pmysql"]
interval: 5s
timeout: 5s
retries: 10
# MariaDB - Port 3307
mariadb:
image: mariadb:11
container_name: dbfordevs-mariadb
environment:
MYSQL_ROOT_PASSWORD: mariadb
MYSQL_DATABASE: testdb
ports:
- "3307:3306"
volumes:
- mariadb_data:/var/lib/mysql
- ./docker/mariadb-init:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 5s
timeout: 5s
retries: 10
# Microsoft SQL Server - Port 1433
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: dbfordevs-mssql
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: "Password123"
ports:
- "1433:1433"
volumes:
- mssql_data:/var/opt/mssql
healthcheck:
test: ["CMD-SHELL", "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P Password123 -C -Q 'SELECT 1' || exit 1"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
# MSSQL Init - runs sample data after MSSQL is ready
mssql-init:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: dbfordevs-mssql-init
depends_on:
mssql:
condition: service_healthy
volumes:
- ./docker/mssql-init:/init
entrypoint: ["/bin/bash", "-c"]
command:
- |
echo "Waiting for MSSQL to be ready..."
sleep 5
echo "Running init script..."
/opt/mssql-tools18/bin/sqlcmd -S mssql -U sa -P Password123 -C -i /init/01-sample-data.sql
echo "Init complete!"
restart: "no"
# CockroachDB - Port 26257 (SQL), 8080 (Admin UI)
cockroachdb:
image: cockroachdb/cockroach:latest
container_name: dbfordevs-cockroachdb
command: start-single-node --insecure
ports:
- "26257:26257"
- "8080:8080"
volumes:
- cockroach_data:/cockroach/cockroach-data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 5s
timeout: 5s
retries: 10
# CockroachDB Init - runs sample data after CockroachDB is ready
cockroachdb-init:
image: cockroachdb/cockroach:latest
container_name: dbfordevs-cockroachdb-init
depends_on:
cockroachdb:
condition: service_healthy
volumes:
- ./docker/cockroach-init:/init
entrypoint: ["/bin/bash", "-c"]
command:
- |
echo "Waiting for CockroachDB to be ready..."
sleep 5
echo "Running init script..."
/cockroach/cockroach sql --insecure --host=cockroachdb < /init/01-sample-data.sql
echo "Init complete!"
restart: "no"
# Oracle Database Free - Port 1521
oracle:
image: gvenzl/oracle-free:23-slim-faststart
container_name: dbfordevs-oracle
environment:
ORACLE_PASSWORD: oracle
APP_USER: testuser
APP_USER_PASSWORD: testuser
ports:
- "1521:1521"
volumes:
- oracle_data:/opt/oracle/oradata
healthcheck:
test: ["CMD", "healthcheck.sh"]
interval: 30s
timeout: 10s
retries: 10
start_period: 60s
# Oracle Init - runs sample data after Oracle is ready
oracle-init:
image: gvenzl/oracle-free:23-slim
container_name: dbfordevs-oracle-init
depends_on:
oracle:
condition: service_healthy
volumes:
- ./docker/oracle-init:/init
entrypoint: ["/bin/bash", "-c"]
command:
- |
echo "Waiting for Oracle to be ready..."
sleep 10
echo "Running init script..."
sqlplus testuser/testuser@//oracle:1521/FREEPDB1 @/init/01-sample-data.sql
echo "Init complete!"
restart: "no"
# Redis - Port 6379
redis:
image: redis:7-alpine
container_name: dbfordevs-redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
# Redis Init - loads sample data after Redis is ready
redis-init:
image: redis:7-alpine
container_name: dbfordevs-redis-init
depends_on:
redis:
condition: service_healthy
volumes:
- ./docker/redis-init:/init
entrypoint: ["/bin/sh", "-c"]
command:
- |
echo "Loading Redis sample data..."
redis-cli -h redis < /init/01-sample-data.redis
echo "Redis init complete!"
restart: "no"
# MongoDB - Port 27017
mongodb:
image: mongo:7
container_name: dbfordevs-mongodb
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: mongodb
MONGO_INITDB_DATABASE: testdb
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db
- ./docker/mongodb-init:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
# Cassandra - Port 9042
cassandra:
image: cassandra:4.1
container_name: dbfordevs-cassandra
environment:
- CASSANDRA_CLUSTER_NAME=dbfordevs_cluster
- MAX_HEAP_SIZE=512M
- HEAP_NEWSIZE=100M
ports:
- "9042:9042"
volumes:
- cassandra_data:/var/lib/cassandra
healthcheck:
test: ["CMD", "cqlsh", "-e", "describe keyspaces"]
interval: 30s
timeout: 10s
retries: 10
start_period: 60s
# Cassandra Init - loads sample data after Cassandra is ready
cassandra-init:
image: cassandra:4.1
container_name: dbfordevs-cassandra-init
depends_on:
cassandra:
condition: service_healthy
volumes:
- ./docker/cassandra-init:/init
entrypoint: ["/bin/bash", "-c"]
command:
- |
echo "Waiting for Cassandra to be ready..."
sleep 10
echo "Running init script..."
cqlsh cassandra -f /init/01-sample-data.cql
echo "Cassandra init complete!"
restart: "no"
volumes:
postgres_data:
mysql_data:
mariadb_data:
mssql_data:
cockroach_data:
oracle_data:
redis_data:
mongodb_data:
cassandra_data: