From 40d964cd14881eaafa8d639e4cde150439831e8d Mon Sep 17 00:00:00 2001 From: James Date: Sat, 7 May 2022 15:55:34 +0100 Subject: [PATCH] add workers and mem limits --- docker-compose.yaml | 105 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 23c2287..0912c46 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -38,8 +38,9 @@ services: logging: driver: "json-file" options: - max-size: "1G" + max-size: "100M" max-file: "3" + mem_limit: ${SYNAPSE_MEM_LIMIT:-2g} ports: - ${SYNAPSE_PORT}:8008 networks: @@ -53,3 +54,105 @@ services: TZ: ${TZ} depends_on: - postgres + + synapse-worker-1: + image: matrixdotorg/synapse:${SYNAPSE_IMAGE_TAG} + restart: unless-stopped + entrypoint: ["/start.py", "run", "--config-path=/data/${CONFIG_FILE_NAME}", "--config-path=/data/generic_worker_1.yaml"] + healthcheck: + test: ["CMD-SHELL", "curl -fSs http://localhost:8081/health || exit 1"] + start_period: "5s" + interval: "15s" + timeout: "5s" + volumes: + - ${VOLUME_PATH}/data:/data:rw + logging: + driver: "json-file" + options: + max-size: "100M" + max-file: "3" + mem_limit: ${WORKER_MEM_LIMIT:-512m} + networks: + - frontend + - backend + environment: + SYNAPSE_CONFIG_DIR: /data + SYNAPSE_WORKER: synapse.app.generic_worker + depends_on: + - synapse + + synapse-worker-2: + image: matrixdotorg/synapse:${SYNAPSE_IMAGE_TAG} + restart: unless-stopped + entrypoint: ["/start.py", "run", "--config-path=/data/${CONFIG_FILE_NAME}", "--config-path=/data/generic_worker_2.yaml"] + healthcheck: + test: ["CMD-SHELL", "curl -fSs http://localhost:8081/health || exit 1"] + start_period: "5s" + interval: "15s" + timeout: "5s" + volumes: + - ${VOLUME_PATH}/data:/data:rw + logging: + driver: "json-file" + options: + max-size: "100M" + max-file: "3" + mem_limit: ${WORKER_MEM_LIMIT:-512m} + networks: + - frontend + - backend + environment: + SYNAPSE_CONFIG_DIR: /data + SYNAPSE_WORKER: synapse.app.generic_worker + depends_on: + - synapse + + synapse-federation-sender-1: + image: matrixdotorg/synapse:${SYNAPSE_IMAGE_TAG} + restart: unless-stopped + entrypoint: ["/start.py", "run", "--config-path=/data/${CONFIG_FILE_NAME}", "--config-path=/data/federation_sender_worker_1.yaml"] + healthcheck: + test: ["CMD-SHELL", "curl -fSs http://localhost:8081/health || exit 1"] + start_period: "5s" + interval: "15s" + timeout: "5s" + volumes: + - ${VOLUME_PATH}/data:/data:rw + logging: + driver: "json-file" + options: + max-size: "100M" + max-file: "3" + mem_limit: ${WORKER_MEM_LIMIT:-512m} + networks: + - backend + environment: + SYNAPSE_CONFIG_DIR: /data + SYNAPSE_WORKER: synapse.app.federation_sender + depends_on: + - synapse + + synapse-federation-sender-2: + image: matrixdotorg/synapse:${SYNAPSE_IMAGE_TAG} + restart: unless-stopped + entrypoint: ["/start.py", "run", "--config-path=/data/${CONFIG_FILE_NAME}", "--config-path=/data/federation_sender_worker_2.yaml"] + healthcheck: + test: ["CMD-SHELL", "curl -fSs http://localhost:8081/health || exit 1"] + start_period: "5s" + interval: "15s" + timeout: "5s" + volumes: + - ${VOLUME_PATH}/data:/data:rw + logging: + driver: "json-file" + options: + max-size: "100M" + max-file: "3" + mem_limit: ${WORKER_MEM_LIMIT:-512m} + networks: + - backend + environment: + SYNAPSE_CONFIG_DIR: /data + SYNAPSE_WORKER: synapse.app.federation_sender + depends_on: + - synapse