From 08d02dfd6beb0ad4135f57d933123a419c117233 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Thu, 7 Oct 2021 11:43:09 +0200 Subject: [PATCH 1/3] Move MongoDB to a separate service. --- dc | 7 ++++++- docker-compose.accounts.yml | 15 --------------- docker-compose.mongodb.yml | 23 +++++++++++++++++++++++ 3 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 docker-compose.mongodb.yml diff --git a/dc b/dc index e703c4d3..60418cb8 100755 --- a/dc +++ b/dc @@ -10,13 +10,18 @@ COMPOSE_FILES="-f docker-compose.yml" for i in $(seq 1 ${#PORTAL_MODULES}); do # accounts module - alias "a" if [[ ${PORTAL_MODULES:i-1:1} == "a" ]]; then - COMPOSE_FILES+=" -f docker-compose.accounts.yml" + COMPOSE_FILES+=" -f docker-compose.mongodb.yml -f docker-compose.accounts.yml" fi # jaeger module - alias "j" if [[ ${PORTAL_MODULES:i-1:1} == "j" ]]; then COMPOSE_FILES+=" -f docker-compose.jaeger.yml" fi + + # mongodb module - alias "m". implied by "a" + if [[ ${PORTAL_MODULES:i-1:1} == "m" ]]; then + COMPOSE_FILES+=" -f docker-compose.mongodb.yml" + fi done # override file if exists diff --git a/docker-compose.accounts.yml b/docker-compose.accounts.yml index d0e1cc29..0ce21695 100644 --- a/docker-compose.accounts.yml +++ b/docker-compose.accounts.yml @@ -50,21 +50,6 @@ services: - mongo - oathkeeper - mongo: - image: mongo:4.4.1 - command: --keyFile=/data/mgkey --replSet=skynet - container_name: mongo - restart: unless-stopped - logging: *default-logging - volumes: - - ./docker/data/mongo/db:/data/db - - ./docker/data/mongo/mgkey:/data/mgkey:rw - networks: - shared: - ipv4_address: 10.10.10.71 - ports: - - "27017:27017" - kratos-migrate: image: oryd/kratos:v0.5.5-alpha.1 container_name: kratos-migrate diff --git a/docker-compose.mongodb.yml b/docker-compose.mongodb.yml new file mode 100644 index 00000000..53c1bb54 --- /dev/null +++ b/docker-compose.mongodb.yml @@ -0,0 +1,23 @@ +version: "3.7" + +x-logging: &default-logging + driver: json-file + options: + max-size: "10m" + max-file: "3" + +services: + mongo: + image: mongo:4.4.1 + command: --keyFile=/data/mgkey --replSet=skynet + container_name: mongo + restart: unless-stopped + logging: *default-logging + volumes: + - ./docker/data/mongo/db:/data/db + - ./docker/data/mongo/mgkey:/data/mgkey:rw + networks: + shared: + ipv4_address: 10.10.10.71 + ports: + - "27017:27017" From 6a435685bf08e6437396f30efb453f46c215bc35 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Thu, 7 Oct 2021 13:09:49 +0200 Subject: [PATCH 2/3] Add a changelog entry. --- changelog/items/key-updates/mongo-service.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/items/key-updates/mongo-service.md diff --git a/changelog/items/key-updates/mongo-service.md b/changelog/items/key-updates/mongo-service.md new file mode 100644 index 00000000..3ef3b13f --- /dev/null +++ b/changelog/items/key-updates/mongo-service.md @@ -0,0 +1 @@ +- Move MongoDB to a separate service (use `PORTAL_MODULES=m` to use it without accounts) From afd61692d955db80cf63fd278b7a5ef3f6d1d833 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Fri, 8 Oct 2021 14:05:55 +0200 Subject: [PATCH 3/3] Make the `SKYNET_DB_PORT` env var control on which port we expose MongoDB. --- docker-compose.mongodb.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.mongodb.yml b/docker-compose.mongodb.yml index 53c1bb54..ebc085ab 100644 --- a/docker-compose.mongodb.yml +++ b/docker-compose.mongodb.yml @@ -20,4 +20,4 @@ services: shared: ipv4_address: 10.10.10.71 ports: - - "27017:27017" + - "${SKYNET_DB_PORT}:27017"