version: '3.1'

services:

  erigon-gnosis:
    image: thorax/erigon:v2.48.1
    user: root
    volumes:
      - "gnosis-archive_data:/datadir"
      - .jwtsecret:/jwtsecret
    expose:
      - "20947"
      - "9090"
      - "8545"
      - "8551"      
    ports:
      - "20947:20947"
      - "20947:20947/udp"
    restart: unless-stopped
    command: --chain=gnosis --authrpc.addr=0.0.0.0 --authrpc.vhosts=* --authrpc.jwtsecret=/jwtsecret --http --http.addr=0.0.0.0 --http.port=8545 --http.compression --http.vhosts='*' --http.corsdomain='*' --http.api=eth,debug,net,trace,web3,erigon --ws --ws.compression --rpc.gascap=300000000 --metrics --metrics.addr=0.0.0.0 --metrics.port=6060 --bodies.cache=5G --rpc.batch.limit=200000 --batchSize=2048MB --port=20947 --datadir=/datadir --ethash.dagdir=/datadir/ethash --rpc.returndata.limit=1000000
    stop_grace_period: 1m
    labels:
      - "prometheus-scrape.enabled=true"
      - "prometheus-scrape.port=6060"
      - "prometheus-scrape.job_name=erigon"
      - "prometheus-scrape.metrics_path=/debug/metrics/prometheus"
      - "traefik.enable=true"
      - "traefik.http.middlewares.erigon-gnosis-stripprefix.stripprefix.prefixes=/gnosis-archive"
      - "traefik.http.services.erigon-gnosis.loadbalancer.server.port=8545"
      - "traefik.http.routers.erigon-gnosis.entrypoints=websecure"
      - "traefik.http.routers.erigon-gnosis.tls.certresolver=myresolver"
      - "traefik.http.routers.erigon-gnosis.rule=Host(`$DOMAIN`) && PathPrefix(`/gnosis-archive`)"
      - "traefik.http.routers.erigon-gnosis.middlewares=erigon-gnosis-stripprefix, ipwhitelist"
    networks:
      - chains
    logging:
      options:
        max-file: '1'
        compress: 'false'
      driver: local

      
  lighthouse-gnosis:
    image: sigp/lighthouse:v4.3.0-modern
    restart: unless-stopped
    networks:
      - chains
    ports:
      - 46763:46763/tcp # p2p
      - 46763:46763/udp # p2p
    expose:
      - 5054 # metrics
      - 4000 # http
      - 46763 # p2p
    volumes:
      - gnosis_consensus:/data
      - .jwtsecret:/jwt.hex
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    command: |
      lighthouse
      beacon_node
      --network=gnosis
      --disable-upnp
      --datadir=/data
      --port=46763
      --http
      --http-address=0.0.0.0
      --http-port=4000
      --target-peers=50
      --execution-endpoint=http://erigon-gnosis:8551
      --execution-jwt=/jwt.hex
      --debug-level=info
      --validator-monitor-auto
      --subscribe-all-subnets
      --import-all-attestations
      --metrics
      --metrics-port=5054
      --metrics-address=0.0.0.0
      --checkpoint-sync-url=https://checkpoint.gnosischain.com/
    labels:
      - "prometheus-scrape.enabled=true"
      - "prometheus-scrape.port=5054"
      - "prometheus-scrape.job_name=lighthouse-gnosis"
      - "prometheus-scrape.metrics_path=/metrics"
      - "traefik.enable=true"
      - "traefik.http.middlewares.lighthouse-gnosis-stripprefix.stripprefix.prefixes=/lighthouse-gnosis"
      - "traefik.http.services.lighthouse-gnosis.loadbalancer.server.port=4000"
      - "traefik.http.routers.lighthouse-gnosis.entrypoints=websecure"
      - "traefik.http.routers.lighthouse-gnosis.tls.certresolver=myresolver"
      - "traefik.http.routers.lighthouse-gnosis.rule=Host(`$DOMAIN`) && PathPrefix(`/lighthouse-gnosis`)"
      - "traefik.http.routers.lighthouse-gnosis.middlewares=lighthouse-gnosis-stripprefix, ipwhitelist"
    logging:
      options:
        max-file: '1'
        compress: 'false'
      driver: local

      
volumes:
  gnosis-archive_data:
  gnosis_consensus:
