Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static mongodb single setup #149

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ docker-build:
-f ${dockerfile} \
.

network_type = host
network_type = docker_tcs
ifeq (${db_setup},cluster)
network_type = docker_mongo
endif
Expand Down Expand Up @@ -88,13 +88,13 @@ ifeq ($(db_setup),cluster)
endif

compose-new:
sudo docker-compose -f ${mongo_compose_file} up -d
docker-compose -f ${mongo_compose_file} up -d

compose-start:
sudo docker-compose -f ${mongo_compose_file} start
docker-compose -f ${mongo_compose_file} start

compose-stop:
sudo docker-compose -f ${mongo_compose_file} stop
docker-compose -f ${mongo_compose_file} stop

compose-rm:
sudo docker-compose -f ${mongo_compose_file} down
docker-compose -f ${mongo_compose_file} down
25 changes: 20 additions & 5 deletions docker/mongodb-single.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
version: '3'

networks:
tcs:
driver: bridge
ipam:
config:
- subnet: 172.22.0.0/24

services:
mongodb-single:
container_name: mongodb-single
image: mongo
network_mode: "host"
networks:
tcs:
ipv4_address: 172.22.0.10
restart: always
entrypoint: ["/usr/bin/mongod", "--port", "27017", "--bind_ip", "localhost,127.0.0.1", "--replSet", "mongoReplSet"]
ports:
- 27017:27017
entrypoint: ["/usr/bin/mongod", "--port", "27017", "--bind_ip", "127.0.0.1,172.22.0.10", "--replSet", "mongoReplSet"]

mongoinit:
image: mongo
network_mode: "host"
depends_on:
- mongodb-single
restart: "no"
entrypoint: ["bash", "-c", "sleep 5 && mongosh --host localhost:27017 --eval 'rs.initiate()'"]
networks:
tcs:
ipv4_address: 172.22.0.2
entrypoint: ["bash", "-c", "sleep 5 && mongosh --host 172.22.0.10:27017 --eval 'rs.initiate()'"]

redis:
image: redis
network_mode: "host"
container_name: redis-single
command: redis-server
networks:
tcs:
ipv4_address: 172.22.0.3
ports:
- '6379:6379'
expose:
Expand Down
Loading