From f5c5b00513908b2b107b3175cbd6020d32bef91d Mon Sep 17 00:00:00 2001 From: Jesus Galaz <jesusgalazr@icloud.com> Date: Tue, 26 Nov 2024 00:26:36 +0100 Subject: [PATCH] feat: add support for horizontal scaling with multiple back-end instances in docker-compose --- docker-compose.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index cb7d10c..a99e7f9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,4 @@ +version: '3.9' services: mongodb: image: mongo:latest @@ -9,14 +10,27 @@ services: - MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD} - MONGO_INITDB_DATABASE=todo-app - todo-app: + todo-app-1: build: context: . dockerfile: Dockerfile - container_name: todo-app + container_name: todo-app-1 ports: - - "80:3000" + - "3001:3000" depends_on: - mongodb environment: - MONGO_URI=${MONGO_URI} + - PORT=3000 + + todo-app-2: + build: + context: . + dockerfile: Dockerfile + container_name: todo-app-2 + ports: + - "3002:3000" + depends_on: + - mongodb + environment: + - MONGO_URI=${MONGO_URI} \ No newline at end of file -- GitLab