From a80af102002649d60018fb4ff0b755e56b36d9d4 Mon Sep 17 00:00:00 2001 From: ashrion Date: Sat, 11 Jul 2026 18:38:48 +0530 Subject: [PATCH] chore: update docker-compose.yml - remove deprecated version, add admin service - Remove deprecated 'version' key (deprecated in Docker Compose v2+) - Add admin service with proper dependencies and networking - Add explicit network configuration for service communication - Add volume for MongoDB data persistence GSSoC26 --- docker-compose.yml | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e3531ef1..b225b3d8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,37 +1,31 @@ -version: "3.8" - services: # MongoDB Service (Secured & Reliable) mongo: - image: mongo:7.0 # <--- PINNED VERSION (was latest) + image: mongo:7.0 container_name: riveto_mongo restart: always ports: - "27017:27017" environment: - # <--- AUTHENTICATION ADDED MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: examplepassword volumes: - mongo-data:/data/db networks: - riveto-network - # <--- HEALTH CHECK ADDED - # This checks if Mongo is actually ready to accept connections healthcheck: test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet interval: 10s timeout: 10s retries: 5 start_period: 40s - # <--- RESOURCE LIMITS ADDED deploy: resources: limits: - cpus: "1.0" # Max 1 CPU core - memory: 1G # Max 1GB RAM + cpus: "1.0" + memory: 1G reservations: - memory: 256M # Guarantees at least 256MB + memory: 256M # Backend Service backend: @@ -45,13 +39,18 @@ services: env_file: - ./backend/.env environment: - # <--- UPDATED URI WITH AUTH CREDENTIALS - MONGO_URI=mongodb://root:examplepassword@mongo:27017/riveto?authSource=admin depends_on: mongo: - condition: service_healthy # <--- WAITS FOR HEALTH CHECK + condition: service_healthy networks: - riveto-network + healthcheck: + test: ["CMD", "node", "-e", "require('http').get('http://localhost:5000/', (r) => r.statusCode === 200 ? process.exit(0) : process.exit(1))"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s # Frontend Service frontend: @@ -71,9 +70,27 @@ services: networks: - riveto-network + # Admin Service + admin: + build: ./admin + container_name: riveto_admin + ports: + - "5174:5173" + volumes: + - ./admin:/app + - /app/node_modules + env_file: + - ./admin/.env + stdin_open: true + tty: true + depends_on: + - backend + networks: + - riveto-network + volumes: mongo-data: networks: riveto-network: - driver: bridge + driver: bridge \ No newline at end of file