version: '3.1'

services:
  erigon-goerli:
    image: thorax/erigon:v2.42.0
    expose:
      - "21766"
      - "9090"
      - "8545"
    ports:
      - "21766:21766"
      - "21766:21766/udp"
    volumes:
      - erigon-goerli:/home/erigon/.local/share/erigon
      - .jwtsecret:/jwtsecret
    networks:
      - chains
    command: >
      --chain goerli
      --externalcl
      --port=21766
      --metrics --metrics.addr=0.0.0.0 --metrics.port=6060
      --private.api.addr=0.0.0.0:9090
      --torrent.upload.rate="1250mb"
      --torrent.download.rate="1250mb"
      --pprof
      --pprof.addr=0.0.0.0
      --pprof.port=6061
      --authrpc.addr=0.0.0.0
      --authrpc.vhosts=*
      --authrpc.jwtsecret=/jwtsecret
      --http.addr=0.0.0.0
      --http.vhosts=*
      --http.corsdomain=*
      --http.api=eth,erigon,web3,net,debug,trace,txpool
      --rpc.returndata.limit=1000000
      --rpc.gascap=5000000000
      --ws 
    restart: unless-stopped
    stop_grace_period: 1m
    labels:
      - "prometheus-scrape.enabled=true"
      - "prometheus-scrape.port=6060"
      - "prometheus-scrape.job_name=erigon-goerli"
      - "prometheus-scrape.metrics_path=/debug/metrics/prometheus"
      - "traefik.enable=true"
      - "traefik.http.middlewares.erigon-goerli-stripprefix.stripprefix.prefixes=/erigon-goerli"
      - "traefik.http.services.erigon-goerli.loadbalancer.server.port=8545"
      - "traefik.http.routers.erigon-goerli.entrypoints=websecure"
      - "traefik.http.routers.erigon-goerli.tls.certresolver=myresolver"
      - "traefik.http.routers.erigon-goerli.rule=Host(`$DOMAIN`) && PathPrefix(`/erigon-goerli`)"
      - "traefik.http.routers.erigon-goerli.middlewares=erigon-goerli-stripprefix, ipwhitelist"

  lighthouse-goerli:
    image: sigp/lighthouse:v4.0.1-rc.0-modern
    expose:
      - "5054" #metrics
      - "4000" #http
      - "63550" #p2p
    ports:
      - "63550:63550"
      - "63550:63550/udp"
    volumes:
      - .jwtsecret:/jwtsecret
      - lighthouse-goerli_data:/root/.lighthouse
    command: >
      lighthouse beacon_node
      --network prater
      --reconstruct-historic-states
      --execution-endpoint http://erigon-goerli:8551
      --execution-jwt /jwtsecret
      --port 63550
      --http
      --http-address=0.0.0.0
      --http-port=4000
      --metrics
      --metrics-port=5054
      --metrics-address=0.0.0.0
      --checkpoint-sync-url https://prater.checkpoint.sigp.io
    restart: unless-stopped
    stop_grace_period: 1m
    networks:
      - chains
    labels:
      - "prometheus-scrape.enabled=true"
      - "prometheus-scrape.port=5054"
      - "prometheus-scrape.job_name=lighthouse-goerli"
      - "prometheus-scrape.metrics_path=/metrics"
      - "traefik.enable=true"
      - "traefik.http.middlewares.lighthouse-goerli-stripprefix.stripprefix.prefixes=/lighthouse-goerli"
      - "traefik.http.services.lighthouse-goerli.loadbalancer.server.port=4000"
      - "traefik.http.routers.lighthouse-goerli.entrypoints=websecure"
      - "traefik.http.routers.lighthouse-goerli.tls.certresolver=myresolver"
      - "traefik.http.routers.lighthouse-goerli.rule=Host(`$DOMAIN`) && PathPrefix(`/lighthouse-goerli`)"
      - "traefik.http.routers.lighthouse-goerli.middlewares=lighthouse-goerli-stripprefix, ipwhitelist"


volumes:
    erigon-goerli:
    lighthouse-goerli_data:
