Skip to content

Commit

Permalink
feat: add configuration variable to limit mongors available memory (c…
Browse files Browse the repository at this point in the history
…lose #221)
  • Loading branch information
robinbourianes-kalisio committed Dec 17, 2020
1 parent d7685d7 commit 7ff619b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.default
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ MONGORS_IMAGE=mongo
MONGORS_TAG=3.6.5
MONGORS_NAME=mongors
MONGORS_VOLUME_PATH=
MONGORS_MEMORY_LIMIT=

# OpenAQ
OPENAQ_IMAGE=kalisio/k-openaq
Expand Down
9 changes: 9 additions & 0 deletions deploy/mongors.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ services:
- node.labels.${MONGORS_NAME}0 == true
restart_policy:
condition: on-failure
resources:
limits:
memory: ${MONGORS_MEMORY_LIMIT}
networks:
- kargo-back-network

Expand All @@ -34,6 +37,9 @@ services:
- node.labels.${MONGORS_NAME}1 == true
restart_policy:
condition: on-failure
resources:
limits:
memory: ${MONGORS_MEMORY_LIMIT}
networks:
- kargo-back-network

Expand All @@ -52,6 +58,9 @@ services:
- node.labels.${MONGORS_NAME}2 == true
restart_policy:
condition: on-failure
resources:
limits:
memory: ${MONGORS_MEMORY_LIMIT}
networks:
- kargo-back-network

Expand Down
7 changes: 6 additions & 1 deletion deploy/mongors_before.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/bin/bash

envsubst '${MONGORS_NAME}' < deploy/mongors.yml.tpl > deploy/mongors.yml
if [ -z "${MONGORS_MEMORY_LIMIT}" ]; then
echo [mongors] MONGORS_MEMORY_LIMIT variable is mandatory but is not set, stopping now.
exit 1
fi

envsubst '${MONGORS_NAME}' < deploy/mongors.yml.tpl > deploy/mongors.yml

0 comments on commit 7ff619b

Please sign in to comment.