Closed Robinyo closed 2 years ago
Ok, so I want to Pull and Run via Docker Compose and connect to the testnet.
I created a local project:
- cardano-graphql
- config
- cardano-db-sync
config.json
- network
- testnet
config.json
topology.json
- placeholder-secrets
postgres_db
postgres_password
postgres_user
docker-compose.yml
I found the config files here: https://github.com/input-output-hk/cardano-configurations/tree/57ceb7f0e1118480d06f99cf3ad3e96803d78b46/network/testnet
I updated the startup script as follows:
export CARDANO_GRAPHQL_VERSION=6.1.0 && \
export CARDANO_NODE_OGMIOS_VERSION=v5.1.0 && \
export NETWORK=testnet && \
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} && \
RESTORE_SNAPSHOT=https://updates-cardano-testnet.s3.amazonaws.com/cardano-db-sync/12/db-sync-snapshot-schema-12-block-3298999-x86_64.tgz \
API_PORT=3101 \
HASURA_PORT=8091 \
OGMIOS_PORT=1338 \
POSTGRES_PORT=5433 \
docker-compose -p ${NETWORK} up -d && \
docker-compose -p ${NETWORK} logs -f
I used wget to obtain the placeholder secrets:
wget https://raw.githubusercontent.com/input-output-hk/cardano-graphql/master/placeholder-secrets/postgres_db
wget https://raw.githubusercontent.com/input-output-hk/cardano-graphql/master/placeholder-secrets/postgres_password
wget https://raw.githubusercontent.com/input-output-hk/cardano-graphql/master/placeholder-secrets/postgres_user
I updated the sample docker-compose.yml as follows (I removed the build: entries as I just want to Pull and Run via Docker Compose):
version: "3.5"
services:
postgres:
image: postgres:${POSTGRES_VERSION:-11.5-alpine}
environment:
- POSTGRES_LOGGING=true
- POSTGRES_DB_FILE=/run/secrets/postgres_db
- POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password
- POSTGRES_USER_FILE=/run/secrets/postgres_user
ports:
- ${POSTGRES_PORT:-5432}:5432
secrets:
- postgres_db
- postgres_password
- postgres_user
shm_size: '2gb'
volumes:
- postgres-data:/var/lib/postgresql/data
restart: on-failure
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
cardano-node-ogmios:
image: cardanosolutions/cardano-node-ogmios:${CARDANO_NODE_OGMIOS_VERSION:-v5.1.0}-${NETWORK:-mainnet}
logging:
driver: "json-file"
options:
max-size: "400k"
max-file: "20"
ports:
- ${OGMIOS_PORT:-1337}:1337
restart: on-failure
volumes:
- node-db:/db
- node-ipc:/ipc
cardano-db-sync-extended:
image: inputoutput/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-12.0.0}
command: [
"--config", "/config/cardano-db-sync/config.json",
"--socket-path", "/node-ipc/node.socket"
]
environment:
- EXTENDED=true
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- RESTORE_SNAPSHOT=${RESTORE_SNAPSHOT:-}
- RESTORE_RECREATE_DB=N
depends_on:
- cardano-node-ogmios
- postgres
secrets:
- postgres_password
- postgres_user
- postgres_db
volumes:
- ./config/network/${NETWORK:-mainnet}:/config
- db-sync-data:/var/lib/cdbsync
- node-ipc:/node-ipc
restart: on-failure
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
hasura:
image: inputoutput/cardano-graphql-hasura:${CARDANO_GRAPHQL_VERSION:-6.2.0}
ports:
- ${HASURA_PORT:-8090}:8080
depends_on:
- "postgres"
restart: on-failure
environment:
- HASURA_GRAPHQL_ENABLE_CONSOLE=true
- HASURA_GRAPHQL_CORS_DOMAIN=http://localhost:9695
secrets:
- postgres_db
- postgres_password
- postgres_user
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
cardano-graphql:
image: inputoutput/cardano-graphql:${CARDANO_GRAPHQL_VERSION:-6.2.0}-${NETWORK:-mainnet}
environment:
- ALLOW_INTROSPECTION=true
- CACHE_ENABLED=true
- LOGGER_MIN_SEVERITY=${LOGGER_MIN_SEVERITY:-info}
expose:
- ${API_PORT:-3100}
ports:
- ${API_PORT:-3100}:3100
restart: on-failure
secrets:
- postgres_db
- postgres_password
- postgres_user
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
secrets:
postgres_db:
file: ./placeholder-secrets/postgres_db
postgres_password:
file: ./placeholder-secrets/postgres_password
postgres_user:
file: ./placeholder-secrets/postgres_user
volumes:
db-sync-data:
node-db:
node-ipc:
postgres-data:
I navigated to: http://localhost:3101/graphql
And ran the following query:
query cardanoDbSyncProgress {
cardanoDbMeta {
initialized
syncPercentage
}
}
I received the following error:
{
"errors": [
{
"message": "QueryUnavailableInCurrentEra. ledgerTip",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"cardanoDbMeta"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"stacktrace": [
"Error: QueryUnavailableInCurrentEra. ledgerTip",
" at Object.<anonymous> (/app/packages/api-cardano-db-hasura/dist/executableSchema.js:233:39)",
" at Generator.throw (<anonymous>)",
" at rejected (/app/packages/api-cardano-db-hasura/dist/executableSchema.js:6:65)",
" at runMicrotasks (<anonymous>)",
" at processTicksAndRejections (internal/process/task_queues.js:95:5)"
]
}
}
}
],
"data": null
}
Hmmm
OK, its been up for a while so I ran the following query:
{ cardanoDbMeta { initialized syncPercentage }}
And, I received the following response:
{
"data": {
"cardanoDbMeta": {
"initialized": true,
"syncPercentage": 100
}
}
}
The master branch does not capture the state of the latest release so you were attempting to use an unreleased version. 6.2.0 was released 2 days ago.
Developers who navigate to: https://github.com/input-output-hk/cardano-graphql are shown the default branch (i.e., master).
They are going to assume that they should follow the steps outlined in the README.md. If this is not the case then why not make the most recent stable branch (i.e., 6-2-stable) the default branch.
The project README.md in the section Pull and Run via Docker Compose refers to a cardano-graphql image and a cardano-graphql-hasura image with 6.2.0 in the tag.
On DockerHub I could not find a cardano-graphql image or a cardano-graphql-hasura image with 6.2.0 in the tag:
The sample docker-compose.yml file also refers to 6.2.0:
Should I use the 6.1.0 images?