-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-compose.databases.yml
More file actions
222 lines (209 loc) · 5.55 KB
/
docker-compose.databases.yml
File metadata and controls
222 lines (209 loc) · 5.55 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
version: '3.8'
services:
# ============================================
# MySQL Database (Primary)
# ============================================
mysql-primary:
image: mysql:8.0
container_name: iac-mysql-primary
environment:
MYSQL_ROOT_PASSWORD: mysql_root_pass
MYSQL_DATABASE: iac
MYSQL_USER: iac_user
MYSQL_PASSWORD: iac_pass
ports:
- "3306:3306"
volumes:
- mysql-primary-data:/var/lib/mysql
- ./scripts/mysql/init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- iac-network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-pmysql_root_pass"]
interval: 10s
timeout: 5s
retries: 5
# MySQL Replica (Optional)
mysql-replica:
image: mysql:8.0
container_name: iac-mysql-replica
environment:
MYSQL_ROOT_PASSWORD: mysql_root_pass
MYSQL_DATABASE: iac
MYSQL_USER: iac_user
MYSQL_PASSWORD: iac_pass
ports:
- "3307:3306"
volumes:
- mysql-replica-data:/var/lib/mysql
networks:
- iac-network
depends_on:
- mysql-primary
# ============================================
# PostgreSQL Database
# ============================================
postgres:
image: postgres:15
container_name: iac-postgres
environment:
POSTGRES_DB: iac
POSTGRES_USER: iac_user
POSTGRES_PASSWORD: iac_pass
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
- ./scripts/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- iac-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U iac_user -d iac"]
interval: 10s
timeout: 5s
retries: 5
# ============================================
# Microsoft SQL Server
# ============================================
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: iac-mssql
environment:
ACCEPT_EULA: Y
SA_PASSWORD: MsSql_Pass123!
MSSQL_PID: Developer
ports:
- "1433:1433"
volumes:
- mssql-data:/var/opt/mssql
- ./scripts/mssql/init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- iac-network
healthcheck:
test: ["CMD-SHELL", "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P MsSql_Pass123! -Q 'SELECT 1'"]
interval: 10s
timeout: 5s
retries: 5
# ============================================
# Oracle Database (Express Edition)
# ============================================
oracle:
image: gvenzl/oracle-xe:21-slim
container_name: iac-oracle
environment:
ORACLE_PASSWORD: Oracle_Pass123
ORACLE_DATABASE: iac
APP_USER: iac_user
APP_USER_PASSWORD: iac_pass
ports:
- "1521:1521"
- "5500:5500"
volumes:
- oracle-data:/opt/oracle/oradata
- ./scripts/oracle/init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- iac-network
healthcheck:
test: ["CMD-SHELL", "healthcheck.sh"]
interval: 30s
timeout: 10s
retries: 5
# ============================================
# MongoDB (Document Database)
# ============================================
mongodb:
image: mongo:7.0
container_name: iac-mongodb
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: mongo_pass
MONGO_INITDB_DATABASE: iac
ports:
- "27017:27017"
volumes:
- mongodb-data:/data/db
- ./scripts/mongodb/init.js:/docker-entrypoint-initdb.d/init.js
networks:
- iac-network
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
# ============================================
# Redis (Caching - Optional)
# ============================================
redis:
image: redis:7-alpine
container_name: iac-redis
ports:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- iac-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# ============================================
# Database Administration Tools
# ============================================
# phpMyAdmin for MySQL
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: iac-phpmyadmin
environment:
PMA_HOSTS: mysql-primary,mysql-replica
PMA_USER: root
PMA_PASSWORD: mysql_root_pass
ports:
- "8080:80"
networks:
- iac-network
depends_on:
- mysql-primary
# pgAdmin for PostgreSQL
pgadmin:
image: dpage/pgadmin4:latest
container_name: iac-pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: admin@iac.local
PGADMIN_DEFAULT_PASSWORD: pgadmin_pass
ports:
- "8081:80"
volumes:
- pgadmin-data:/var/lib/pgadmin
networks:
- iac-network
depends_on:
- postgres
# Mongo Express for MongoDB
mongo-express:
image: mongo-express:latest
container_name: iac-mongo-express
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: admin
ME_CONFIG_MONGODB_ADMINPASSWORD: mongo_pass
ME_CONFIG_MONGODB_URL: mongodb://admin:mongo_pass@mongodb:27017/
ME_CONFIG_BASICAUTH_USERNAME: admin
ME_CONFIG_BASICAUTH_PASSWORD: admin
ports:
- "8082:8081"
networks:
- iac-network
depends_on:
- mongodb
networks:
iac-network:
driver: bridge
volumes:
mysql-primary-data:
mysql-replica-data:
postgres-data:
mssql-data:
oracle-data:
mongodb-data:
redis-data:
pgadmin-data: