cardano-foundation / cardano-graphql

GraphQL API for Cardano
Apache License 2.0
262 stars 104 forks source link

ERROR: relation "ada_pots" does not exist at character 167 #680

Open Robinyo opened 2 years ago

Robinyo commented 2 years ago

I have been working to add support for prometheus and grafana (https://github.com/input-output-hk/cardano-graphql/issues/663#issuecomment-1039730626) to the project's sample docker-compose.yml.

However, when restoring from a snapshot:

export NETWORK=testnet && \
export POSTGRES_VERSION=11.5-alpine && \
export CARDANO_NODE_OGMIOS_VERSION=v5.1.0 && \
export CARDANO_DB_SYNC_VERSION=12.0.0 && \
export CARDANO_GRAPHQL_VERSION=6.2.0 && \
docker pull inputoutput/cardano-graphql:${CARDANO_GRAPHQL_VERSION}-${NETWORK} && \
docker pull inputoutput/cardano-graphql-hasura:${CARDANO_GRAPHQL_VERSION} && \
docker pull cardanosolutions/cardano-node-ogmios:${CARDANO_NODE_OGMIOS_VERSION}-${NETWORK} && \
export RESTORE_SNAPSHOT=https://updates-cardano-testnet.s3.amazonaws.com/cardano-db-sync/12/db-sync-snapshot-schema-12-block-3298999-x86_64.tgz && \
export API_PORT=3101 && \
export HASURA_PORT=8091 && \
export OGMIOS_PORT=1338 && \
export POSTGRES_PORT=5433 && \
export PROMETHEUS_PORT=9090 && \
export GRAFANA_PORT=3000 && \
docker-compose -p ${NETWORK} up -d

I am now encountering the following error:

ERROR: relation "ada_pots" does not exist at character 167

I found this (closed) issue: https://github.com/input-output-hk/cardano-graphql/issues/623#issue-1031181652

The provided logs are expected during the startup sequence since as all containers are booted simultaneously, so the initial attempts at applying metadata will likely fail. On your first attempt did you try restarting the stack without RESTORE_SNAPSHOT?

Can you describe which containers need to wait for other containers to be ready?

For example:

  cardano-node-ogmios:
    depends_on:
      - ???
    command: ???

  cardano-db-sync-extended:
    depends_on:
      - cardano-node-ogmios
      - postgres
    command: ["/wait-for-it.sh", "postgres:5432", "-t" , "30", "--", "/entrypoint.sh", "init"]

  cardano-graphql:
    depends_on:
      - postgres
    command: ["/wait-for-it.sh", "postgres:5432", "-t" , "30", "--", "/entrypoint.sh", "init"]

So that I can update the project's sample docker-compose.yml to use a tool like wait-for-it to poll a given host and port until it’s accepting TCP connections.

I have had some success utilising wait-for-it on previous projects, for example: docker-compose-jasperreports.yml

Robinyo commented 2 years ago

See: Getting started with Cardano GraphQL