diff --git a/docker-compose.yml b/docker-compose.yml index 8fa1285..2b2d161 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,14 @@ -version: "3" +version: "3.8" services: anonymous_github: build: . restart: always image: tdurieux/anonymous_github:v2 + deploy: + mode: replicated + replicas: 4 + endpoint_mode: vip env_file: - ./.env volumes: @@ -12,8 +16,6 @@ services: environment: - REDIS_HOSTNAME=redis - DB_HOSTNAME=mongodb - ports: - - $PORT:$PORT healthcheck: test: - CMD @@ -27,6 +29,17 @@ services: - redis - opentelemetry + nginx: + image: nginx:stable-alpine + env_file: + - ./.env + volumes: + - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro + depends_on: + - anonymous_github + ports: + - "$EXPOSED_PORT:4000" + redis: image: "redis:alpine" restart: always diff --git a/index.ts b/index.ts index 83da5be..fbd7cd1 100644 --- a/index.ts +++ b/index.ts @@ -1,16 +1,7 @@ -const cluster = require('node:cluster'); import { config } from "dotenv"; config(); import server from "./src/server"; -if (cluster.isPrimary) { - console.log(`Master process ${process.pid} is running`); - - for (let i = 0; i < 8; i++) { - cluster.fork(); - } -} else { - // start the server - server(); -} +// start the server +server();