Skip to content

Commit 8526792

Browse files
committed
Use Docker Compose named volumes, this allows further analysis on the data once the environment is torn down.
Added a clean-up button to delete not used volumes. For example, mongodb can be disabled and clicking on this button will delete its data.
1 parent 232f932 commit 8526792

2 files changed

Lines changed: 36 additions & 4 deletions

File tree

Tiltfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,23 @@ dc_resource('dozzle', labels=['Monitoring'], links=[
149149
link('http://localhost:8118', 'Dozzle Container Monitor'),
150150
])
151151

152+
# Cleanup
153+
154+
load('ext://uibutton', 'cmd_button', 'location')
155+
cmd_button(
156+
'cleanup-ancillary-volumes',
157+
argv=['sh', '-c', ' '.join([
158+
"for v in $(yq '.volumes | keys[]' ancillary-docker-compose.yml);",
159+
'do if docker volume rm peerdb_$v;',
160+
'then echo "Removed $v";',
161+
'else echo "Failed to remove $v (may be in use or not exist)";',
162+
'fi; done',
163+
])],
164+
text='Wipe ancillary volumes',
165+
icon_name='delete',
166+
location=location.NAV,
167+
)
168+
152169
# Tests launchers
153170

154171
def e2e_test(name, test_run, extra_deps=[], vars_overrides={}):

ancillary-docker-compose.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ services:
1010
MONGO_INITDB_ROOT_USERNAME: ${CI_MONGO_ADMIN_USERNAME}
1111
MONGO_INITDB_ROOT_PASSWORD: ${CI_MONGO_ADMIN_PASSWORD}
1212

13+
volumes:
14+
- mongo_data:/data/db
1315
ports:
1416
- "${CI_MONGO_PORT}:27017"
1517
extra_hosts:
1618
- "host.docker.internal:host-gateway"
1719
healthcheck:
18-
test: ["CMD", "mongosh", "--eval", "db.runCommand({ ping: 1 })"]
20+
test: ["CMD", "mongosh", "--quiet", "--eval", "db.runCommand({ ping: 1 })"]
1921
interval: 2s
2022
timeout: 10s
2123
retries: 5
@@ -28,9 +30,7 @@ services:
2830
- "${CI_CLICKHOUSE_HTTP_PORT}:8123"
2931
- "${CI_CLICKHOUSE_NATIVE_PORT}:9000"
3032
volumes:
31-
- ./volumes/ch_data:/var/lib/clickhouse/
32-
- ./volumes/ch_logs:/var/log/clickhouse-server/
33-
- ./volumes/ch_users.d:/etc/clickhouse-server/users.d/
33+
- clickhouse_data:/var/lib/clickhouse/
3434
ulimits:
3535
nofile:
3636
soft: 262144
@@ -47,6 +47,8 @@ services:
4747
container_name: peerdb-mysql-gtid
4848
image: mysql:9.5
4949
restart: unless-stopped
50+
volumes:
51+
- mysql_gtid_data:/var/lib/mysql
5052
ports:
5153
- "${CI_MYSQL_GTID_PORT}:3306"
5254
environment:
@@ -64,6 +66,8 @@ services:
6466
image: biarms/mysql:5.7
6567
command: ["--log_bin=mysql-bin", "--server-id=1", "--bind-address=::"]
6668
restart: unless-stopped
69+
volumes:
70+
- mysql_pos_data:/var/lib/mysql
6771
ports:
6872
- "${CI_MYSQL_POS_PORT}:3306"
6973
environment:
@@ -81,6 +85,8 @@ services:
8185
image: mariadb:lts-ubi9@sha256:55a81b2d791d2ff8ad33fef413d9e45e0ac57a951127e0cfc69a8e59f922ba6e
8286
command: ["--log-bin=maria"]
8387
restart: unless-stopped
88+
volumes:
89+
- mariadb_data:/var/lib/mysql
8490
ports:
8591
- "${CI_MARIADB_PORT}:3306"
8692
environment:
@@ -97,6 +103,8 @@ services:
97103
container_name: peerdb-postgres
98104
image: ${POSTGRES_IMAGE}
99105
restart: unless-stopped
106+
volumes:
107+
- postgres_data:/var/lib/postgresql/data
100108
ports:
101109
- "${PG_PORT}:5432"
102110
environment:
@@ -121,6 +129,13 @@ services:
121129
volumes:
122130
- /var/run/docker.sock:/var/run/docker.sock
123131

132+
volumes:
133+
postgres_data:
134+
clickhouse_data:
135+
mongo_data:
136+
mysql_gtid_data:
137+
mysql_pos_data:
138+
mariadb_data:
124139

125140
networks:
126141
default:

0 commit comments

Comments
 (0)