-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
215 lines (206 loc) · 7.64 KB
/
Copy pathdocker-compose.yml
File metadata and controls
215 lines (206 loc) · 7.64 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
# ======================================================================
# EverNifeCore - Integration test database suite
# ======================================================================
#
# Starts the 3 database servers used by the integration tests in the
# :core module. Credentials and ports match the defaults in
# DotEnvTestUtil for each *StorageTest - if you don't set any env vars,
# the tests will connect automatically to these containers.
#
# ----------------------------------------------------------------------
# How to use
# ----------------------------------------------------------------------
# # Start all databases in the background:
# docker compose up -d
#
# # Watch initialization logs:
# docker compose logs -f
#
# # Check status / healthcheck of each container:
# docker compose ps
#
# # Start only one service:
# docker compose up -d postgres
#
# # Stop while keeping data:
# docker compose stop
#
# # Stop and remove containers (volumes are kept):
# docker compose down
#
# # Full wipe - deletes volumes (destroys all data):
# docker compose down -v
#
# ----------------------------------------------------------------------
# Ports exposed on the host
# ----------------------------------------------------------------------
# Arbitrary, sequential, high ports chosen to avoid clashing with other
# database containers that may already use the default ports on the host.
# MariaDB -> 39306 (container 3306, wire-compatible with MySQL)
# PostgreSQL -> 39307 (container 5432)
# MongoDB -> 39308 (container 27017)
# Valkey -> 39309 (container 6379)
# Redis -> 39310 (container 6379)
#
# ----------------------------------------------------------------------
# Credentials
# ----------------------------------------------------------------------
# MongoDB -> none (open; 1-node replica set, connect with
# mongodb://localhost:39308/?directConnection=true)
# MariaDB -> root / root
# PostgreSQL -> root / root
# Valkey -> none (open)
# Redis -> none (open)
#
# ======================================================================
name: evernifecore-space
services:
# --------------------------------------------------------------------
# MongoDB 7 - single-node replica set (used by MongoStorageTest)
#
# Runs as a 1-node replica set ("rs0") so the features that REQUIRE one
# work in tests: multi-document transactions and Change Streams (the
# cache-sync change feed). The healthcheck auto-initiates the set on first
# start and then reports healthy only once the node is PRIMARY.
#
# No access control: a replica set with auth would also need an internal
# keyfile, which is awkward to provision across hosts (esp. Windows bind
# mounts). This is a throwaway test database, so it runs open. Clients
# connect WITHOUT credentials and with directConnection=true (the node
# advertises an in-container address that the host cannot route to):
# mongodb://localhost:39308/?directConnection=true
# --------------------------------------------------------------------
mongo:
image: mongo:7
container_name: evernifecore-mongo
restart: unless-stopped
command: ["--replSet", "rs0", "--bind_ip_all"]
ports:
- "39308:27017"
volumes:
- mongo_data:/data/db
- mongo_configdb:/data/configdb
networks:
- evernifecore-test
healthcheck:
# Initiate the set if it has none yet; healthy only once this node is PRIMARY (myState == 1).
test: >-
mongosh --quiet --eval '
try { quit(rs.status().myState === 1 ? 0 : 1) }
catch (e) { rs.initiate({_id: "rs0", members: [{_id: 0, host: "localhost:27017"}]}); quit(1) }
'
interval: 5s
timeout: 10s
retries: 30
start_period: 15s
# --------------------------------------------------------------------
# MariaDB 11 - used by MariaDbStorageTest
#
# Wire-compatible with MySQL: the mysql-connector-j driver connects
# to it normally via jdbc:mysql://localhost:3306. Also covers real
# MySQL servers that plugin users may run.
# --------------------------------------------------------------------
mariadb:
image: mariadb:11
container_name: evernifecore-mariadb
restart: unless-stopped
environment:
MARIADB_ROOT_PASSWORD: root
ports:
- "39306:3306"
volumes:
- mariadb_data:/var/lib/mysql
networks:
- evernifecore-test
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 10
start_period: 20s
# --------------------------------------------------------------------
# PostgreSQL 16 - used by PostgreSqlStorageTest
# --------------------------------------------------------------------
postgres:
image: postgres:16
container_name: evernifecore-postgres
restart: unless-stopped
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
ports:
- "39307:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- evernifecore-test
healthcheck:
test: ["CMD-SHELL", "pg_isready -U root"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
# --------------------------------------------------------------------
# Valkey 8 - pub/sub transport for the manager cache-sync tests
#
# The everydatabase-manager-jedis transport publishes cache-invalidation
# signals over a Redis/Valkey pub/sub channel. Valkey is the open-source
# (BSD) Redis fork; the same Jedis client connects to it unchanged.
# Ephemeral - persistence is disabled (test signals are throwaway).
# --------------------------------------------------------------------
valkey:
image: valkey/valkey:8.1-alpine
container_name: evernifecore-valkey
restart: unless-stopped
command: ["valkey-server", "--save", "", "--appendonly", "no"]
ports:
- "39309:6379"
networks:
- evernifecore-test
healthcheck:
test: ["CMD-SHELL", "valkey-cli ping | grep -q PONG"]
interval: 5s
timeout: 3s
retries: 5
start_period: 3s
# --------------------------------------------------------------------
# Redis 7 - the same cache-sync transport, against upstream Redis
#
# Pinned to 7.4 (the last BSD-3 Redis line) so the Jedis transport is
# exercised against both Valkey and Redis. Ephemeral, no auth.
# --------------------------------------------------------------------
redis:
image: redis:7.4-alpine
container_name: evernifecore-redis
restart: unless-stopped
command: ["redis-server", "--save", "", "--appendonly", "no"]
ports:
- "39310:6379"
networks:
- evernifecore-test
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep -q PONG"]
interval: 5s
timeout: 3s
retries: 5
start_period: 3s
# ----------------------------------------------------------------------
# Named volumes - survive `down`, deleted with `down -v`.
# ----------------------------------------------------------------------
volumes:
mongo_data:
name: evernifecore-mongo-data
mongo_configdb:
name: evernifecore-mongo-configdb
mariadb_data:
name: evernifecore-mariadb-data
postgres_data:
name: evernifecore-postgres-data
# ----------------------------------------------------------------------
# Shared network - useful if you ever want to link containers together
# (e.g.: run Adminer/pgAdmin in the same compose).
# ----------------------------------------------------------------------
networks:
evernifecore-test:
name: evernifecore-test
driver: bridge