version: '3.1'

services:
  erigon-lukso:
    build: ./lukso/erigon
    expose:
      - "51262"
      - "9090"
      - "8545"
      - "8551"
    ports:
      - "51262:51262"
      - "51262:51262/udp"
    volumes:
      - erigon-lukso:/root/.local/share/erigon
      - ./lukso/shared:/configs/mainnet/shared
      - .jwtsecret:/jwtsecret
    networks:
      - chains
    command: >
      --chain=mainnet
      --networkid=42
      --miner.gaslimit=42000000
      --snapshots=false
      --bootnodes=enode://c2bb19ce658cfdf1fecb45da599ee6c7bf36e5292efb3fb61303a0b2cd07f96c20ac9b376a464d687ac456675a2e4a44aec39a0509bcb4b6d8221eedec25aca2@34.147.73.193:30303,enode://276f14e4049840a0f5aa5e568b772ab6639251149a52ba244647277175b83f47b135f3b3d8d846cf81a8e681684e37e9fc10ec205a9841d3ae219aa08aa9717b@34.32.192.211:30303
      --port=51262
      --metrics --metrics.addr=0.0.0.0 --metrics.port=6060
      --private.api.addr=0.0.0.0:9090
      --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"
      - "prometheus-scrape.metrics_path=/debug/metrics/prometheus"
      - "traefik.enable=true"
      - "traefik.http.middlewares.erigon-lukso-stripprefix.stripprefix.prefixes=/lukso"
      - "traefik.http.services.erigon-lukso.loadbalancer.server.port=8545"
      - "traefik.http.routers.erigon-lukso.entrypoints=websecure"
      - "traefik.http.routers.erigon-lukso.tls.certresolver=myresolver"
      - "traefik.http.routers.erigon-lukso.rule=Host(`$DOMAIN`) && PathPrefix(`/lukso`)"
      - "traefik.http.routers.erigon-lukso.middlewares=erigon-lukso-stripprefix, ipwhitelist"

  lighthouse-lukso:
    image: sigp/lighthouse:v4.3.0-modern
    expose:
      - 17765
    ports:
      - "17765:17765"
      - "17765:17765/udp"      
    volumes:
      - .jwtsecret:/jwtsecret
      - lighthouse-lukso_data:/root/.lighthouse
      - ./lukso/shared:/configs/mainnet/shared
    command: >
      lighthouse beacon_node
      --testnet-dir /configs/mainnet/shared
      --eth1
      --execution-endpoint http://erigon-lukso:8551
      --execution-jwt /jwtsecret
      --subscribe-all-subnets
      --boot-nodes=enr:-MK4QJ-Bt9HATy4GQawPbDDTArtnt_phuWiVVoWKhS7-DSNjVzmGKBI9xKzpyRtpeCWd3qA9737FTdkKGDgtHfF4N-6GAYlzJCVRh2F0dG5ldHOIAAAAAAAAAACEZXRoMpA2ulfbQgAABP__________gmlkgnY0gmlwhCKTScGJc2VjcDI1NmsxoQJNpNUERqKhA8eDDC4tovG3a59NXVOW16JDFAWXoFFTEYhzeW5jbmV0cwCDdGNwgjLIg3VkcIIu4A,enr:-MK4QHcS3JeTtVjOuJyVXvO1E6XJWqiwmhLfodel6vARPI8ve_2q9vVn8LpIL964qBId7zGpSVKw6oOPAaRm2H7ywYiGAYmHDeBbh2F0dG5ldHOIAAAAAAAAAACEZXRoMpA2ulfbQgAABP__________gmlkgnY0gmlwhCIgwNOJc2VjcDI1NmsxoQNGVC8JPcsqsZPoohLP1ujAYpBfS0dBwiz4LeoUQ-k5OohzeW5jbmV0cwCDdGNwgjLIg3VkcIIu4A
      --http
      --http-address 0.0.0.0
      --port 17765
      --checkpoint-sync-url=https://checkpoints.mainnet.lukso.network
    restart: unless-stopped
    stop_grace_period: 1m
    networks:
      - chains
    labels:
      - "traefik.enable=true"
      - "traefik.http.middlewares.lighthouse-lukso-stripprefix.stripprefix.prefixes=/lighthouse-lukso"
      - "traefik.http.services.lighthouse-lukso.loadbalancer.server.port=5052"
      - "traefik.http.routers.lighthouse-lukso.entrypoints=websecure"
      - "traefik.http.routers.lighthouse-lukso.tls.certresolver=myresolver"
      - "traefik.http.routers.lighthouse-lukso.rule=Host(`$DOMAIN`) && PathPrefix(`/lighthouse-lukso`)"
      - "traefik.http.routers.lighthouse-lukso.middlewares=lighthouse-lukso-stripprefix, ipwhitelist"

volumes:
    erigon-lukso:
    geth-lukso_data:
    lighthouse-lukso_data:
