diff --git a/production/.env.analyzer.proc.sample b/production/.env.analyzer.sample similarity index 100% rename from production/.env.analyzer.proc.sample rename to production/.env.analyzer.sample diff --git a/production/.env.proc.sample b/production/.env.api.sample similarity index 100% rename from production/.env.proc.sample rename to production/.env.api.sample diff --git a/production/.env.bot.proc.sample b/production/.env.discord.sample similarity index 100% rename from production/.env.bot.proc.sample rename to production/.env.discord.sample diff --git a/production/.env.db.sample b/production/.env.mongodb.sample similarity index 100% rename from production/.env.db.sample rename to production/.env.mongodb.sample diff --git a/production/.env.rmq.sample b/production/.env.rabbitmq.sample similarity index 100% rename from production/.env.rmq.sample rename to production/.env.rabbitmq.sample diff --git a/production/docker-compose.yml b/production/docker-compose.yml index 686b415..a697b29 100644 --- a/production/docker-compose.yml +++ b/production/docker-compose.yml @@ -5,32 +5,36 @@ x-sm-resources-common: deploy: resources: limits: - cpus: '1' + cpus: '0.5' memory: 1G + <<: [*logging] x-md-resources-common: &md-resources-common deploy: resources: limits: - cpus: '2' + cpus: '1' memory: 2G + <<: [*logging] x-lg-resources-common: &lg-resources-common deploy: resources: limits: - cpus: '2' + cpus: '1' memory: 4G + <<: [*logging] -x-bot-resources-common: - &bot-resources-common +x-xl-resources-common: + &xl-resources-common deploy: resources: limits: - cpus: '1' + cpus: '2' memory: 8G + <<: [*logging] x-logging: &logging @@ -77,20 +81,27 @@ x-neo4j-healthcheck: retries: 2 start_period: 40s +x-redis: + &redis + image: redis:7.2.4 + restart: unless-stopped + command: ["redis-server", "/usr/local/etc/redis/redis.conf"] + networks: + - production + - monitoring + <<: [*redis-healthcheck, *md-resources-common] + services: - mongodb-prod: + + ### DATABASES ### + + mongodb: image: mongo:latest - container_name: mongodb-prod restart: unless-stopped env_file: - - ./.env.db + - ./.env.mongodb ports: - 37017:27017 - logging: - driver: "json-file" - options: - max-size: "400k" - max-file: "20" volumes: - mongodb_data_container:/data/db - type: bind @@ -100,9 +111,9 @@ services: networks: - production - monitoring - <<: *mongodb-healthcheck + <<: [*mongodb-healthcheck, *xl-resources-common] - rabbitmq-prod: + rabbitmq: image: rabbitmq:3-management restart: unless-stopped ports: @@ -111,41 +122,13 @@ services: volumes: - rmq_data_container:/var/lib/rabbitmq/ env_file: - - ./.env.rmq - networks: - - production - - monitoring - <<: [*logging, *rabbitmq-healthcheck] - - redis-discord-bot-prod: - image: redis:7.0.11 - restart: unless-stopped - command: ["redis-server", "/usr/local/etc/redis/redis.conf"] - volumes: - - type: bind - source: ./redis/discordBot.conf - target: /usr/local/etc/redis/redis.conf - read_only: true - networks: - - production - - monitoring - <<: [*logging, *redis-healthcheck] - - redis-discord-analyzer-prod: - image: redis:7.0.11 - restart: unless-stopped - command: ["redis-server", "/usr/local/etc/redis/redis.conf"] - volumes: - - type: bind - source: ./redis/discordAnalyzer.conf - target: /usr/local/etc/redis/redis.conf - read_only: true + - ./.env.rabbitmq networks: - production - monitoring - <<: [*logging, *redis-healthcheck] + <<: [*rabbitmq-healthcheck, *md-resources-common] - neo4j-prod: + neo4j: image: neo4j:5.9.0 restart: unless-stopped ports: @@ -167,34 +150,16 @@ services: networks: - production - monitoring - <<: [*logging, *neo4j-healthcheck] + <<: [*neo4j-healthcheck, *xl-resources-common] - tc-server-comm-prod: - build: - context: ../../tc-serverComm - dockerfile: Dockerfile - tags: - - tc-server-comm:${VERSION:-latest} - restart: unless-stopped - environment: - PORT: $PORT - ports: - - $HOST:$PORT:$PORT - env_file: - - ./.env.proc - depends_on: - mongodb-prod: - condition: service_healthy - neo4j-prod: - condition: service_healthy - rabbitmq-prod: - condition: service_healthy - networks: - - production - - monitoring - <<: *logging + ### DISCORD BOT ### + + redis-discord: + volumes: + - ./redis/discord.conf:/usr/local/etc/redis/redis.conf:ro + <<: [*redis] - tc-discord-bot-prod: + discord: build: context: ../../tc-discordBot target: prod @@ -205,66 +170,93 @@ services: env_file: - ./.env.bot.proc depends_on: - mongodb-prod: + mongodb: condition: service_healthy - redis-discord-bot-prod: + redis-discord: condition: service_healthy - rabbitmq-prod: + rabbitmq: condition: service_healthy networks: - production - monitoring - <<: [*logging, *bot-resources-common] + <<: [*lg-resources-common] + + ### ANALYZER ### + + redis-analyzer: + volumes: + - ./redis/analyzer.conf:/usr/local/etc/redis/redis.conf:ro + <<: [*redis] - discord-analyzer-server: + analyzer-server: image: ghcr.io/togethercrew/discord-analyzer:main command: python3 server.py restart: unless-stopped env_file: - ./.env.analyzer.proc depends_on: - redis-discord-analyzer-prod: + redis-analyzer: condition: service_healthy - rabbitmq-prod: + rabbitmq: condition: service_healthy networks: - production - monitoring - <<: *logging + <<: [*md-resources-common] - discord-analyzer-worker: + analyzer-worker: image: ghcr.io/togethercrew/discord-analyzer:main command: python3 worker.py restart: unless-stopped env_file: - ./.env.analyzer.proc depends_on: - mongodb-prod: + mongodb: + condition: service_healthy + redis-analyzer: + condition: service_healthy + neo4j: + condition: service_healthy + networks: + - production + - monitoring + <<: [*xl-resources-common] + + ### API ### + + redis-api: + volumes: + - ./redis/api.conf:/usr/local/etc/redis/redis.conf:ro + <<: [*redis] + + api: + build: + context: ../../tc-serverComm + dockerfile: Dockerfile + tags: + - tc-server-comm:${VERSION:-latest} + restart: unless-stopped + environment: + PORT: $PORT + ports: + - $HOST:$PORT:$PORT + env_file: + - ./.env.api + depends_on: + mongodb: + condition: service_healthy + neo4j: condition: service_healthy - redis-discord-analyzer-prod: + rabbitmq: condition: service_healthy - neo4j-prod: + redis-api: condition: service_healthy networks: - production - monitoring - <<: *logging + <<: [*md-resources-common] - # manual-triggers: - # build: - # context: ../../manual-triggers - # dockerfile: Dockerfile - # tags: - # - manual-triggers:${VERSION:-latest} - # env_file: - # - ./.env.manual-triggers - # depends_on: - # - mongodb-prod - # - rabbitmq-prod - # networks: - # - production - # - monitoring - # <<: *logging + ### OTHER ### volumes: mongodb_data_container: