Skip to content

Commit

Permalink
[GH-158] feat(db): WTF
Browse files Browse the repository at this point in the history
  • Loading branch information
pablojvritx committed Jun 4, 2024
1 parent a74f620 commit cfc73e6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
14 changes: 11 additions & 3 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.7"
version: '3.7'

services:
ts-api-mongo:
Expand All @@ -9,6 +9,7 @@ services:
ports:
- 27017:27017
volumes:
- ./mongo/mongo-init.js:/docker-entrypoint-initdb.d/init.js:ro
- ts_api_mongo_data:/data/db:delegated
environment:
MONGO_INITDB_DATABASE: ts-api
Expand All @@ -17,11 +18,18 @@ services:
MONGO_USERNAME: localUser
MONGO_PASSWORD: localPassword
healthcheck:
test: ["CMD", "mongo", "--eval", "db.adminCommand('ping')"]
interval: 60s
test: |
if test $(echo "rs.initiate({_id:'rs0',members:[{_id:0,host:'localhost:27017'}]}).ok" | mongosh -u root -p rootPassword --quiet | grep -o 1); then
test 1;
else
test $(echo "rs.status().ok" | mongosh -u root -p rootPassword --quiet | grep -o 1);
fi
interval: 10s
start_period: 30s
timeout: 10s
retries: 3
command:
['--replSet', 'rs0', '--bind_ip_all', '--keyFile', '/data/replica.key']

volumes:
ts_api_mongo_data:
7 changes: 4 additions & 3 deletions docker/mongo/Dockerfile_mongo
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
FROM mongo:6.0.15
RUN apt-get update && apt-get install -y curl iputils-ping
COPY ./mongo-init.js /docker-entrypoint-initdb.d/
FROM mongo:5.0.23
RUN openssl rand --base64 768 > /data/replica.key
RUN chmod 400 /data/replica.key
RUN chown 999:999 /data/replica.key

0 comments on commit cfc73e6

Please sign in to comment.