Skip to content

Commit 7b77588

Browse files
committed
wip
1 parent 856b5f8 commit 7b77588

File tree

4 files changed

+39
-28
lines changed

4 files changed

+39
-28
lines changed

bin/utils

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ COMPOSE_FILE="docker-compose.yml"
7171
[ "$SHELLHUB_ENTERPRISE" = "true" ] && [ "$SHELLHUB_ENV" != "development" ] && COMPOSE_FILE="${COMPOSE_FILE}:docker-compose.enterprise.yml"
7272
[ -f docker-compose.override.yml ] && COMPOSE_FILE="${COMPOSE_FILE}:docker-compose.override.yml"
7373

74+
SHELLHUB_DATABASE=${SHELLHUB_DATABASE:-mongodb}
75+
case "$SHELLHUB_DATABASE" in
76+
mongodb|postgres)
77+
COMPOSE_FILE="${COMPOSE_FILE}:docker-compose.${SHELLHUB_DATABASE}.yml"
78+
;;
79+
*)
80+
echo "⚠️ WARNING: Unknown SHELLHUB_DATABASE '$SHELLHUB_DATABASE'. Defaulting to mongodb."
81+
SHELLHUB_DATABASE="mongodb"
82+
COMPOSE_FILE="${COMPOSE_FILE}:docker-compose.mongodb.yml"
83+
;;
84+
esac
85+
7486
[ -f "$EXTRA_COMPOSE_FILE" ] && COMPOSE_FILE="${COMPOSE_FILE}:${EXTRA_COMPOSE_FILE}"
7587

7688
export COMPOSE_FILE

docker-compose.mongodb.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
services:
2+
mongo:
3+
image: mongo:4.4.29
4+
restart: unless-stopped
5+
healthcheck:
6+
test: 'test $$(echo "rs.initiate({ _id: ''rs'', members: [ { _id: 0, host: ''mongo:27017'' } ] }).ok || rs.status().ok" | mongo --quiet) -eq 1'
7+
interval: 30s
8+
start_period: 10s
9+
command: ["--replSet", "rs", "--bind_ip_all"]
10+
networks:
11+
- shellhub

docker-compose.postgres.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
services:
2+
postgres:
3+
image: postgres:18.0
4+
healthcheck:
5+
test: ["CMD-SHELL", "pg_isready -U ${SHELLHUB_POSTGRES_USER} -d ${SHELLHUB_POSTGRES_DB}"]
6+
interval: 5s
7+
timeout: 5s
8+
retries: 5
9+
environment:
10+
- POSTGRES_USER=${SHELLHUB_POSTGRES_USER}
11+
- POSTGRES_PASSWORD=${SHELLHUB_POSTGRES_PASSWORD}
12+
- POSTGRES_DB=${SHELLHUB_POSTGRES_DB}
13+
ports:
14+
- "5432:5432"
15+
networks:
16+
- shellhub

docker-compose.yml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,8 @@ services:
6666
- POSTGRES_PASSWORD=${SHELLHUB_POSTGRES_PASSWORD}
6767
- POSTGRES_DB=${SHELLHUB_POSTGRES_DB}
6868
depends_on:
69-
- mongo
7069
- redis
71-
- postgres
7270
links:
73-
- mongo
7471
- redis
7572
secrets:
7673
- api_private_key
@@ -157,31 +154,6 @@ services:
157154
- POSTGRES_DB=${SHELLHUB_POSTGRES_DB}
158155
networks:
159156
- shellhub
160-
mongo:
161-
image: mongo:4.4.29
162-
restart: unless-stopped
163-
healthcheck:
164-
test: 'test $$(echo "rs.initiate({ _id: ''rs'', members: [ { _id: 0, host: ''mongo:27017'' } ] }).ok || rs.status().ok" | mongo --quiet) -eq 1'
165-
interval: 30s
166-
start_period: 10s
167-
command: ["--replSet", "rs", "--bind_ip_all"]
168-
networks:
169-
- shellhub
170-
postgres:
171-
image: postgres:18.0
172-
healthcheck:
173-
test: ["CMD-SHELL", "pg_isready -U ${SHELLHUB_POSTGRES_USER} -d ${SHELLHUB_POSTGRES_DB}"]
174-
interval: 5s
175-
timeout: 5s
176-
retries: 5
177-
environment:
178-
- POSTGRES_USER=${SHELLHUB_POSTGRES_USER}
179-
- POSTGRES_PASSWORD=${SHELLHUB_POSTGRES_PASSWORD}
180-
- POSTGRES_DB=${SHELLHUB_POSTGRES_DB}
181-
ports:
182-
- "5432:5432"
183-
networks:
184-
- shellhub
185157
redis:
186158
image: redis
187159
restart: unless-stopped

0 commit comments

Comments
 (0)