From e4fc371ff8bd938be36c051f8aeaca8d7ec54897 Mon Sep 17 00:00:00 2001 From: Victor Rocheleau Date: Mon, 15 May 2023 13:55:34 -0400 Subject: [PATCH 1/3] service resource limits in docker-compose.dev.yaml --- docker-compose.dev.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml index 9f991435..9d7f856c 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.dev.yaml @@ -17,7 +17,20 @@ services: - NODE_ENV=development ports: - "${BENTO_PUBLIC_EXTERNAL_PORT}:${BENTO_PUBLIC_INTERNAL_PORT}" + deploy: + resources: + limits: + memory: 2G + auth-db: + extends: + file: $PWD/lib/auth/docker-compose.auth.yaml + service: auth-db + deploy: + resources: + limits: + memory: 1G + gateway: # Override network aliases, adding BENTOV2_AUTH_DOMAIN # Other networks are inherited @@ -115,6 +128,10 @@ services: - default ports: - 8080:8080 + deploy: + resources: + limits: + memory: 2G aggregation: environment: From 1b2ed8d94f7925e5f3def254c528213348dcece0 Mon Sep 17 00:00:00 2001 From: Victor Rocheleau Date: Mon, 15 May 2023 14:08:23 -0400 Subject: [PATCH 2/3] dev public mem limit increase --- docker-compose.dev.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml index 9d7f856c..cd2f954d 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.dev.yaml @@ -20,7 +20,7 @@ services: deploy: resources: limits: - memory: 2G + memory: 3G auth-db: extends: From ec9e1b7c1ae52bbb055192367daf853cf0ab1b20 Mon Sep 17 00:00:00 2001 From: Victor Rocheleau Date: Thu, 18 May 2023 12:01:39 -0400 Subject: [PATCH 3/3] replace deploy with mem_limit, uses env vars --- docker-compose.dev.yaml | 13 +------------ etc/bento.env | 2 ++ lib/auth/docker-compose.auth.yaml | 1 + lib/public/docker-compose.public.yaml | 1 + 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml index cd2f954d..e662b528 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.dev.yaml @@ -17,19 +17,11 @@ services: - NODE_ENV=development ports: - "${BENTO_PUBLIC_EXTERNAL_PORT}:${BENTO_PUBLIC_INTERNAL_PORT}" - deploy: - resources: - limits: - memory: 3G auth-db: extends: file: $PWD/lib/auth/docker-compose.auth.yaml service: auth-db - deploy: - resources: - limits: - memory: 1G gateway: # Override network aliases, adding BENTOV2_AUTH_DOMAIN @@ -128,10 +120,7 @@ services: - default ports: - 8080:8080 - deploy: - resources: - limits: - memory: 2G + mem_limit: 1G aggregation: environment: diff --git a/etc/bento.env b/etc/bento.env index 95b52a93..d23df5d7 100644 --- a/etc/bento.env +++ b/etc/bento.env @@ -63,6 +63,7 @@ BENTO_AUTH_DB="auth" BENTO_AUTH_DB_USER="auth_user" # BENTO_AUTH_DB_PASSWORD is set in local.env BENTO_AUTH_DB_NETWORK="${BENTOV2_PREFIX}-auth-db-net" +BENTO_AUTH_DB_MEM_LIM=1G # Web BENTO_WEB_CUSTOM_HEADER= @@ -328,6 +329,7 @@ BENTO_PUBLIC_NETWORK=${BENTOV2_PREFIX}-public-net BENTO_PUBLIC_INTERNAL_PORT=${BENTO_STD_SERVICE_INTERNAL_PORT} BENTO_PUBLIC_EXTERNAL_PORT=8090 +BENTO_PUBLIC_MEM_LIM=2G BENTO_PUBLIC_DEBUG=false BENTO_PUBLIC_SERVICE_ID=${BENTOV2_PREFIX}-public diff --git a/lib/auth/docker-compose.auth.yaml b/lib/auth/docker-compose.auth.yaml index 329c2aed..3869bd32 100644 --- a/lib/auth/docker-compose.auth.yaml +++ b/lib/auth/docker-compose.auth.yaml @@ -46,6 +46,7 @@ services: - auth-db-net volumes: - ${BENTOV2_AUTH_VOL_DIR}:/var/lib/postgresql/data + mem_limit: ${BENTO_AUTH_DB_MEM_LIM} healthcheck: test: [ "CMD", "pg_isready", "-q", "-d", "${BENTO_AUTH_DB}", "-U", "${BENTO_AUTH_DB_USER}" ] timeout: 5s diff --git a/lib/public/docker-compose.public.yaml b/lib/public/docker-compose.public.yaml index 9dbdf5db..7bf34a83 100644 --- a/lib/public/docker-compose.public.yaml +++ b/lib/public/docker-compose.public.yaml @@ -22,6 +22,7 @@ services: - ${PWD}/lib/public/about.html:/bento-public/www/public/about.html:ro - ${PWD}/lib/public/branding.png:/bento-public/www/public/assets/branding.png:ro + mem_limit: ${BENTO_PUBLIC_MEM_LIM} healthcheck: test: [ "CMD", "curl", "http://localhost:${BENTO_PUBLIC_INTERNAL_PORT}/service-info" ] timeout: ${BENTOV2_HEALTHCHECK_TIMEOUT}