production/docker-compose.yml
version: '3.9'
x-logging:
&logging
logging:
driver: loki
options:
loki-url: http://172.22.22.15:3100/loki/api/v1/push
loki-retries: 5
loki-batch-size: 400
x-sm-resources-common:
&sm-resources-common
deploy:
resources:
limits:
cpus: '0.5'
memory: 1G
<<: [*logging]
x-md-resources-common:
&md-resources-common
deploy:
resources:
limits:
cpus: '1'
memory: 2G
<<: [*logging]
x-lg-resources-common:
&lg-resources-common
deploy:
resources:
limits:
cpus: '1'
memory: 4G
<<: [*logging]
x-xl-resources-common:
&xl-resources-common
deploy:
resources:
limits:
cpus: '2'
memory: 8G
<<: [*logging]
x-redis-resources-common:
&redis-resources-common
deploy:
resources:
limits:
cpus: '0.5'
memory: 16G
<<: [*logging]
x-redis-healthcheck:
&redis-healthcheck
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
interval: 60s
timeout: 10s
retries: 2
start_period: 40s
x-rabbitmq-healthcheck:
&rabbitmq-healthcheck
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 30s
timeout: 30s
retries: 2
start_period: 40s
x-mongodb-healthcheck:
&mongodb-healthcheck
healthcheck:
test: test $(echo $(mongosh -u $$MONGO_INITDB_ROOT_USERNAME -p $$MONGO_INITDB_ROOT_PASSWORD --quiet /etc/mongo/healthcheck.js)) -eq 1
interval: 60s
timeout: 10s
retries: 2
start_period: 40s
x-neo4j-healthcheck:
&neo4j-healthcheck
healthcheck:
test: ["CMD" ,"wget", "http://localhost:7474"]
interval: 1m30s
timeout: 10s
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, *redis-resources-common]
services:
### DATABASES ###
mongodb:
container_name: mongodb
image: mongo:7.0.5
restart: unless-stopped
command: ['--replSet', 'rs0', '--keyFile', '/etc/mongo/replica.key']
env_file:
- ./.env.mongodb
ports:
- 37017:27017
volumes:
- ./mongo:/etc/mongo:ro
- ../init-mongo.sh:/docker-entrypoint-initdb.d/init-mongo.sh:ro
- mongodb_data_container:/data/db
networks:
- production
- monitoring
<<: [*mongodb-healthcheck, *xl-resources-common]
rabbitmq:
container_name: rabbitmq
image: rabbitmq:3.12.12-management
restart: unless-stopped
ports:
- 15672:15672
- 6672:5672
volumes:
- rmq_data_container:/var/lib/rabbitmq/
env_file:
- ./.env.rabbitmq
networks:
- production
- monitoring
<<: [*rabbitmq-healthcheck, *md-resources-common]
neo4j:
container_name: neo4j
image: neo4j:5.9.0
restart: unless-stopped
ports:
- 27474:7474
- 27687:7687
env_file:
- ./.env.neo4j
volumes:
# - neo4j_conf:/var/lib/neo4j/conf
- neo4j_data:/data
- neo4j_import:/import
- neo4j_plugins:/plugins
environment:
# Raise memory limits
- NEO4J_server.memory.heap.initial_size=4G
- NEO4J_server.memory.heap.max_size=8G
- NEO4J_PLUGINS=["apoc", "graph-data-science"]
- NEO4J_dbms_security_procedures_unrestricted=apoc.*,gds.*
networks:
- production
- monitoring
<<: [*neo4j-healthcheck, *xl-resources-common]
redis-discord:
container_name: redis-discord
volumes:
- ./redis/discord.conf:/usr/local/etc/redis/redis.conf:ro
<<: [*redis]
redis-analyzer:
container_name: redis-analyzer
volumes:
- ./redis/analyzer.conf:/usr/local/etc/redis/redis.conf:ro
<<: [*redis]
redis-api:
container_name: redis-api
volumes:
- ./redis/api.conf:/usr/local/etc/redis/redis.conf:ro
<<: [*redis]
### SERVICES ###
discord:
container_name: discord
image: ghcr.io/togethercrew/discord-bot:main
restart: unless-stopped
env_file:
- ./.env.discord
ports:
- 3300:3000
depends_on:
mongodb:
condition: service_healthy
redis-discord:
condition: service_healthy
rabbitmq:
condition: service_healthy
networks:
- production
- monitoring
<<: [*lg-resources-common]
analyzer-server:
container_name: analyzer-server
image: ghcr.io/togethercrew/discord-analyzer:main
command: python3 server.py
restart: unless-stopped
env_file:
- ./.env.analyzer.proc
depends_on:
redis-analyzer:
condition: service_healthy
rabbitmq:
condition: service_healthy
networks:
- production
- monitoring
<<: [*md-resources-common]
analyzer-worker:
container_name: analyzer-worker
image: ghcr.io/togethercrew/discord-analyzer:main
command: python3 worker.py
restart: unless-stopped
env_file:
- ./.env.analyzer.proc
depends_on:
mongodb:
condition: service_healthy
redis-analyzer:
condition: service_healthy
neo4j:
condition: service_healthy
networks:
- production
- monitoring
<<: [*xl-resources-common]
api:
container_name: api
image: ghcr.io/togethercrew/api:main
restart: unless-stopped
environment:
PORT: $PORT
ports:
- $HOST:$PORT:$PORT
env_file:
- ./.env.api
depends_on:
mongodb:
condition: service_healthy
neo4j:
condition: service_healthy
rabbitmq:
condition: service_healthy
redis-api:
condition: service_healthy
networks:
- production
- monitoring
<<: [*md-resources-common]
### ADMIN
admin-panel:
container_name: admin-panel
image: ghcr.io/togethercrew/admin-panel:main
restart: always
ports:
- 8501:8501
env_file:
- .env.admin-panel
depends_on:
mongodb:
condition: service_healthy
neo4j:
condition: service_healthy
networks:
- production
- monitoring
<<: [*md-resources-common]
### OTHER ###
volumes:
mongodb_data_container:
rmq_data_container:
neo4j_data:
neo4j_import:
neo4j_plugins:
neo4j_conf:
grafana_volume:
prometheus_volume:
loki_volume:
networks:
production:
driver: bridge
monitoring:
name: monitoring
external: true