-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
108 lines (104 loc) · 4.01 KB
/
Copy pathdocker-compose.yml
File metadata and controls
108 lines (104 loc) · 4.01 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
services:
postgres:
image: postgres:16
container_name: isolation_pg
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- ./init/postgres:/docker-entrypoint-initdb.d
- ./data/postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 10
# Generous window: the very first boot runs initdb + the seed script
# before the server accepts connections; don't flag that as unhealthy.
start_period: 40s
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: isolation_mssql
restart: unless-stopped
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: ${MSSQL_SA_PASSWORD}
MSSQL_PID: "Express"
ports:
- "${MSSQL_PORT:-1433}:1433"
volumes:
- ./data/mssql/data:/var/opt/mssql/data
- ./data/mssql/log:/var/opt/mssql/log
- ./data/mssql/secrets:/var/opt/mssql/secrets
healthcheck:
test: >
/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "${MSSQL_SA_PASSWORD}" -C
-Q "IF (SELECT state_desc FROM sys.databases WHERE name='model') = 'ONLINE' SELECT 1 ELSE RAISERROR('model not ready',16,1)"
|| exit 1
interval: 5s
timeout: 5s
retries: 20
start_period: 15s
mssql-init:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: isolation_mssql_init
depends_on:
mssql:
condition: service_healthy
volumes:
- ./init/mssql:/init
environment:
MSSQL_SA_PASSWORD: ${MSSQL_SA_PASSWORD}
command: >
bash -c "
for i in 1 2 3 4 5; do
echo \"Attempt $$i: running MSSQL init script...\";
/opt/mssql-tools18/bin/sqlcmd -S mssql -U sa -P \"$$MSSQL_SA_PASSWORD\" -C -b -i /init/01_init.sql;
if [ $$? -eq 0 ]; then
echo 'MSSQL initialized successfully.';
exit 0;
fi;
echo \"Failed, retrying in 10s...\";
sleep 10;
done;
echo 'All init attempts failed.';
exit 1
"
restart: "no"
cloudbeaver:
image: dbeaver/cloudbeaver:latest
container_name: isolation_cloudbeaver
restart: unless-stopped
ports:
- "${CB_PORT:-8978}:8978"
environment:
# Admin auto-created on first launch (fresh workspace). Values come from .env.
CB_SERVER_NAME: ${CB_SERVER_NAME:-CloudBeaver}
CB_ADMIN_NAME: ${CB_ADMIN_NAME}
CB_ADMIN_PASSWORD: ${CB_ADMIN_PASSWORD}
# Turn OFF SQL-editor autosave: it writes the open script back to the
# bind-mounted file on a timer, which races with external edits and
# corrupts the curated scenario scripts (truncation / null bytes).
#CLOUDBEAVER_SQL_EDITOR_AUTOSAVE: "false"
volumes:
# Persistent workspace (internal H2 DB, encrypted credentials) — gitignored
- ./data/cloudbeaver:/opt/cloudbeaver/workspace
# Pre-listed connections (no stored password — CloudBeaver prompts on connect)
- ./cloudbeaver/data-sources.json:/opt/cloudbeaver/workspace/GlobalConfiguration/.dbeaver/data-sources.json:ro
# Scenario scripts appear directly in the Resource Manager (replaces the old init container).
# Writable, because CloudBeaver's SQL editor autosaves the open script (read-only errors out).
- ./scenarios/postgres:/opt/cloudbeaver/workspace/GlobalConfiguration/Scripts/postgres
- ./scenarios/mssql:/opt/cloudbeaver/workspace/GlobalConfiguration/Scripts/mssql
# CloudBeaver connects to the databases on demand, so it must NOT block on
# their health — otherwise a slow/failing DB leaves CloudBeaver stuck in
# "Created" and you can't even open the UI to debug. Just order it after the
# DB containers start.
depends_on:
postgres:
condition: service_started
mssql:
condition: service_started