From f4513562350c1567d3c19e180551659c099268a4 Mon Sep 17 00:00:00 2001
From: Jesus Galaz <jesusgalazr@icloud.com>
Date: Tue, 26 Nov 2024 00:17:47 +0100
Subject: [PATCH] feat: add support for horizontal scaling with multiple
 back-end instances in docker-compose

---
 docker-compose.yml | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/docker-compose.yml b/docker-compose.yml
index cb7d10c..b606057 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,3 +1,4 @@
+version: '3.9'
 services:
   mongodb:
     image: mongo:latest
@@ -9,14 +10,28 @@ 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}
+      - PORT=3000
-- 
GitLab