# Cloudflare Tunnel Configuration for SMOM-DBIS-138
# Place this file at: /etc/cloudflared/config.yaml

tunnel: smom-dbis-138-tunnel
credentials-file: /etc/cloudflared/tunnel-credentials.json

ingress:
  # Nginx Proxy (main entry point)
  - hostname: nginx-proxy.sankofa.nexus
    service: http://nginx-proxy-vm:80
    originRequest:
      noHappyEyeballs: true
      connectTimeout: 30s
      tcpKeepAlive: 30s
      keepAliveConnections: 100
      keepAliveTimeout: 90s

  # SMOM-DBIS-138 API Services
  - hostname: smom-api.sankofa.nexus
    service: http://smom-services:8080
    originRequest:
      noHappyEyeballs: true
      connectTimeout: 30s
      tcpKeepAlive: 30s

  # Blockscout Explorer
  - hostname: smom-blockscout.sankofa.nexus
    service: http://smom-blockscout:4000
    originRequest:
      noHappyEyeballs: true
      connectTimeout: 30s

  # Monitoring Dashboard
  - hostname: smom-monitoring.sankofa.nexus
    service: http://smom-monitoring:3000
    originRequest:
      noHappyEyeballs: true
      connectTimeout: 30s

  # RPC Node 1
  - hostname: smom-rpc-01.sankofa.nexus
    service: http://smom-rpc-node-01:8545
    originRequest:
      noHappyEyeballs: true
      connectTimeout: 30s

  # RPC Node 2
  - hostname: smom-rpc-02.sankofa.nexus
    service: http://smom-rpc-node-02:8545
    originRequest:
      noHappyEyeballs: true
      connectTimeout: 30s

  # RPC Node 3
  - hostname: smom-rpc-03.sankofa.nexus
    service: http://smom-rpc-node-03:8545
    originRequest:
      noHappyEyeballs: true
      connectTimeout: 30s

  # RPC Node 4
  - hostname: smom-rpc-04.sankofa.nexus
    service: http://smom-rpc-node-04:8545
    originRequest:
      noHappyEyeballs: true
      connectTimeout: 30s

  # Catch-all rule (must be last)
  - service: http_status:404

# Logging
loglevel: info
logfile: /var/log/cloudflared/tunnel.log

# Metrics
metrics: 0.0.0.0:9090

# Health check
health-probe:
  enabled: true
  path: /health
  port: 8080

