version: "3.9"

services:
  cryptor:
    image: 192.168.1.220:5000/cryptor:v0.0.2
    container_name: cryptor
    deploy:
      restart_policy:
        condition: on-failure
        delay: 15s
        max_attempts: 100
        window: 120s
    volumes:
      - ./cryptor/config.toml:/root/config.toml
    networks:
      - meta

  sentry:
    image: 192.168.1.220:5000/sentry:v0.0.1
    container_name: sentry
    deploy:
      restart_policy:
        condition: on-failure
        delay: 15s
        max_attempts: 100
        window: 120s
    volumes:
      - ./sentry/app.json:/root/app.json
    networks:
      - meta

  net:
    image: 192.168.1.220:5000/metanet:v0.0.1
    container_name: net
    entrypoint: /root/MetaNet --single-node --enable-prom --log-level debug --p2p-priv-key /root/default-priv-key --grpc-host 0.0.0.0 --grpc-port 38010 --p2p-host-ip 172.99.1.1
    deploy:
      restart_policy:
        condition: on-failure
        delay: 15s
        max_attempts: 100
        window: 120s
    ports:
      - "38010:38010"
      - "30333:30333"
    volumes:
      - ./data/net/:/root/data
    networks:
      meta:
        ipv4_address: 172.99.1.1

  nebula:
    image: 192.168.1.220:5000/nebula:v0.0.1
    container_name: nebula
    volumes:
      - ./data/nebula/:/root
    depends_on:
      - net
      - sentry

    deploy:
      resources:
        limits:
          cpus: "36.00"
          memory: 50G
        reservations:
          cpus: "30.00"
          memory: 50G
      restart_policy:
        condition: on-failure
        delay: 15s
        max_attempts: 100
        window: 120s
    ports:
      - 38004:38004
      - 28000:28080
    networks:
      - meta

  ring:
    image: 192.168.1.220:5000/ring:v0.0.1
    container_name: ring
    entrypoint: sh -c 'echo +ring+ && sleep 10 && ringd start  --ethconfig.httphost  0.0.0.0 --mempool.sentryurl  sentry:38003   --mempool.nebulaurl nebula:38004  --mempool.p2purl  net:38010  --mempool.cryptourl  cryptor:38001  --mempool.checkerurl txchecker:38002   --mempool.writeunreadytxs=false   --mempool.writerepeatedmsg=false     --mempool.batchconfirminittimeout=60   --mempool.batchconfirmtimeouti=1.5 --mempool.batchrepeatedqueuesize=0'
    volumes:
      - ./data/ring/:/data
    depends_on:
      - cryptor
      - net
      - sentry

    deploy:
      resources:
        limits:
          cpus: "36.00"
          memory: 50G
        reservations:
          cpus: "30.00"
          memory: 50G
      restart_policy:
        condition: on-failure
        delay: 15s
        max_attempts: 100
        window: 120s
    ports:
      - 18545:8545
      - 5001:5001
      - 38020:38020
      - 6060:6060
    networks:
      - meta
  cadvisor:
    image: google/cadvisor:latest
    container_name: cadvisor
    ports:
      - "8081:8080"
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro
    depends_on:
      - sentry
      - net
      - nebula
      - ring
    networks:
      - meta
  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    ports:
      - "9000:9090"
    command:
      - --config.file=/etc/prometheus/prometheus.yml
    volumes:
      - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
    depends_on:
      - cadvisor
    networks:
      - meta
networks:
  meta:
    driver: bridge
    ipam:
      config:
        - subnet: 172.99.0.0/16
