cardano-foundation / cardano-graphql

GraphQL API for Cardano
Apache License 2.0
261 stars 103 forks source link

Cardano-graphql instance running in a kubernetes cluster returns blank error page at `http://localhost:3100/graphql` #738

Open Red3nzo opened 2 years ago

Red3nzo commented 2 years ago

Summary

I'm running a cardano stack inside a Kind kubernetes cluster. The stack consists of the following containers with these images

The error persists within the inputoutput/cardano-graphql:6.2.0-testnet container; the container logs this information at first launch & everything I restart it which seems normal to me

{"name":"cardano-graphql","hostname":"cardano-graphql-testnet-9dc5fb75b-zlsf9","pid":1,"level":30,"module":"Server","msg":"Initializing","time":"2022-07-15T23:03:45.457Z","v":0}
{"name":"cardano-graphql","hostname":"cardano-graphql-testnet-9dc5fb75b-zlsf9","pid":1,"level":30,"module":"HasuraClient","msg":"Initializing","time":"2022-07-15T23:03:45.575Z","v":0}

The pod.yml file looks like this for the cardano-graphql configuration

containers:
        - name: cardano-graphql-testnet
          image: inputoutput/cardano-graphql:6.2.0-testnet
          ports:
            - containerPort: 3100
          env:
            - name: NETWORK
              value: testnet
            - name: METADATA_SERVER_URI
              value: "https://tokens.cardano.org"
            - name: ALLOW_INTROSPECTION
              value: "true"
            - name: CACHE_ENABLED
              value: "true"
            - name: LOGGER_MIN_SEVERITY
              value: info
            - name: API_PORT
              value: "3100"
            - name: LISTEN_ADDRESS
              value: "0.0.0.0"
            - name: POSTGRES_HOST
              valueFrom:
                configMapKeyRef:
                  name: postgres-chaindb-config
                  key: ocs-postgres-chaindb-url
            - name: POSTGRES_PORT
              value: "5432"
            - name: POSTGRES_DB
              valueFrom:
                secretKeyRef:
                  name: postgres-chaindb-secrets
                  key: postgres_db
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: postgres-chaindb-secrets
                  key: postgres_password
            - name: POSTGRES_USER
              valueFrom:
                secretKeyRef:
                  name: postgres-chaindb-secrets
                  key: postgres_user
      volumes:
        - name: postgres-chaindb-secrets
          secret:
            items:
              - key: postgres_db
                path: postgres_db
              - key: postgres_user
                path: postgres_user
              - key: postgres_password
                path: postgres_password
            secretName: postgres-chaindb-secrets

Once I run said container & reach the browser I get nothing, blank page & infinite loading the browser tab at the top of the browser. The page shows this error This page isn’t working; localhost didn’t send any data. ERR_EMPTY_RESPONSE

EDIT: Running the following curl returns this message curl: (52) Empty reply from server

curl -X POST \                                                                                                           
         -H "Content-Type: application/json" \
         -d '{"query": "{ cardano { tip { number slotNo epoch { number } } } }"}' \
         http://localhost:3100/graphql

Steps to reproduce the bug

  1. Deploy inputoutput/cardano-graphql:6.2.0-testnet image into a kubernetes pod after cardano-node, cardano-db-sync & 'postgres' have been setup
  2. Go to http://localhost:3100/graphql and see a error page that says This page isn’t working; localhost didn’t send any data. ERR_EMPTY_RESPONSE

Actual Result

error page that says This page isn’t working; localhost didn’t send any data. ERR_EMPTY_RESPONSE & an infinite loading bar inside the tab in the browser

Expected Result

To see the graphql console at http://localhost:3100/graphql

Environment

  {
    os: {
      arch: 'x64',
      cpus: { count: 24, model: '12th Gen Intel(R) Core(TM) i9-12900KS' },
      release: '5.18.7-200.fc36.x86_64',
      totalMem: 67040788480,
      type: 'Linux'
    },
    version: '6.2.0'
  }

Platform

Platform version

Fedora Workstation 36

Runtime

Runtime version

v20.10.17

rhyslbw commented 2 years ago

It's getting stuck trying to apply the Hasura migrations or metadata. See if the debug logs reveal any more hints:

            - name: LOGGER_MIN_SEVERITY
              value: debug
Red3nzo commented 2 years ago

Just saw this sorry for late reply, I've built a custom image of the master branch due to the fact my cardano-node was at 1.35.0 & cardano-db-sync at 13.0.0. I added the LOGGER_MIN_SEVERITY env & I'm currently getting this error. Should I switch my graphql image back to 6.2.0-testnet instead of building from master?

================================
 Missing environment variables:
    loggerMinSeverity: undefined

 Exiting with error code 1
================================

I'm a but confused because I have added this env before