services:
  app_proxy:
    environment:
      APP_HOST: dcrpulse_dashboard_1
      APP_PORT: 8735

  dcrd:
    image: ghcr.io/karamble/dcrpulse-dcrd:2.1.3@sha256:d5c6c04af574d949db5b32181e3d8f223707e019c7745b45424634f3af6714a3
    user: "1000:1000"
    restart: on-failure
    stop_grace_period: 5m
    volumes:
      - ${APP_DATA_DIR}/data:/app-data
    environment:
      DCRD_RPC_USER: ${APP_SEED}
      DCRD_RPC_PASS: ${APP_SEED}
      DCRD_EXTRA_ARGS: --txindex
      TOR_PROXY_IP: ${TOR_PROXY_IP}
      TOR_PROXY_PORT: ${TOR_PROXY_PORT}
    command: >
      --rpcuser=${APP_SEED}
      --rpcpass=${APP_SEED}
      --rpclisten=0.0.0.0:9109
      --rpccert=/app-data/dcrd/rpc.cert
      --rpckey=/app-data/dcrd/rpc.key
    healthcheck:
      test: ["CMD", "sh", "-c", "curl -k -u ${APP_SEED}:${APP_SEED} -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"1.0\",\"method\":\"getinfo\",\"params\":[],\"id\":1}' https://127.0.0.1:9109 || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 5
      start_period: 120s

  dcrwallet:
    image: ghcr.io/karamble/dcrpulse-dcrwallet:2.1.3@sha256:94caf7a6c57d49083dd73003f94e4dec804a85ed18c5413f489e4550ffb2f395
    user: "1000:1000"
    restart: on-failure
    stop_grace_period: 1m
    volumes:
      - ${APP_DATA_DIR}/data:/app-data
    environment:
      DCRWALLET_RPC_USER: ${APP_SEED}
      DCRWALLET_RPC_PASS: ${APP_SEED}
      DCRD_RPC_USER: ${APP_SEED}
      DCRD_RPC_PASS: ${APP_SEED}
      DCRD_RPC_HOST: dcrd
      DCRWALLET_GAP_LIMIT: 400
      TOR_PROXY_IP: ${TOR_PROXY_IP}
      TOR_PROXY_PORT: ${TOR_PROXY_PORT}
    command: >
      --gaplimit=400
    depends_on:
      dcrd:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "sh", "-c", "nc -z 127.0.0.1 9110 && nc -z 127.0.0.1 9111 || exit 1"]
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 10s

  dashboard:
    image: ghcr.io/karamble/dcrpulse-dashboard:1.0.3@sha256:d6d991150e570b3c473873f350a122f2cfc3ffd43e50b87e15821777c28d70dc
    user: "1000:1000"
    restart: on-failure
    volumes:
      - ${APP_DATA_DIR}/data:/app-data:ro
    environment:
      PORT: 8735
      DCRD_RPC_HOST: dcrd
      DCRD_RPC_PORT: 9109
      DCRD_RPC_USER: ${APP_SEED}
      DCRD_RPC_PASS: ${APP_SEED}
      DCRD_RPC_CERT: /app-data/dcrd/rpc.cert
      DCRWALLET_RPC_HOST: dcrwallet
      DCRWALLET_RPC_PORT: 9110
      DCRWALLET_GRPC_PORT: 9111
      DCRWALLET_RPC_USER: ${APP_SEED}
      DCRWALLET_RPC_PASS: ${APP_SEED}
      DCRWALLET_RPC_CERT: /app-data/dcrd/rpc.cert
    depends_on:
      dcrd:
        condition: service_healthy
      dcrwallet:
        condition: service_healthy
