Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgraded db-sync #885

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Check the [releases] for the latest version.
``` console
git clone \
--single-branch \
--branch 8.2.0 \
--branch 8.2.1 \
--recurse-submodules \
https://github.com/cardano-foundation/cardano-graphql.git \
&& cd cardano-graphql
Expand All @@ -53,9 +53,14 @@ Choose **one** of the following:
Boot the [docker compose stack] using a convention for container and volume scoping based on the network, as well as
optionally hitting the remote cache to speed up the build. The containers are detached, so you can terminate the log
console session freely. See [Docker Compose docs] to tailor for your use-case


##### Node snapshots
If you want to speed up the node syncing processes you can use a snapshot. The snapshot is a compressed file that contains the database of a node at a certain block.
You can download snapshots using Mithril, which are available for mainnet, preprod, and preview networks.
A detailed explanation can be found [here](https://mithril.network/doc/manual/getting-started/bootstrap-cardano-node)
<details open>
<summary><i>mainnet</i></summary>
Get the most recent weekly snapshot link [here](https://update-cardano-mainnet.iohk.io/cardano-db-sync/index.html#13.4/), and set it as `RESTORE_SNAPSHOT` below, or omit if you wish to sync from genesis.

> **Disclaimer:** The Chainfollower environment variables are currently mandatory.
> Otherwise the Token registry will get stuck.
Expand All @@ -65,8 +70,9 @@ console session freely. See [Docker Compose docs] to tailor for your use-case
DOCKER_BUILDKIT=1 \
COMPOSE_DOCKER_CLI_BUILD=1 \
CHAIN_FOLLOWER_START_SLOT=23068800 \
CHAIN_FOLLOWER_START_ID=a650a3f398ba4a9427ec8c293e9f7156d81fd2f7ca849014d8d2c1156c359b3a
</span>docker compose up -d --build &&\
CHAIN_FOLLOWER_START_ID=a650a3f398ba4a9427ec8c293e9f7156d81fd2f7ca849014d8d2c1156c359b3a \
RESTORE_SNAPSHOT=https://update-cardano-mainnet.iohk.io/cardano-db-sync/13.4/db-sync-snapshot-schema-13.4-block-10683068-x86_64.tgz \
docker compose up -d --build &&\
docker compose logs -f
```
</details>
Expand Down Expand Up @@ -206,12 +212,6 @@ For other networks:
METADATA_SERVER_URI="https://metadata.world.dev.cardano.org"
```

### Upgrade Database to Postgres 14
If you are upgrading from Postgres 11 to 14: A resync will be needed.
To speed up the process you can use the following snapshots:
- [DB-Sync](https://update-cardano-mainnet.iohk.io/cardano-db-sync/13.2/db-sync-snapshot-schema-13.2-block-10060706-x86_64.tgz)
- [Node](https://mithril.network/doc/manual/getting-started/bootstrap-cardano-node)

### Check Cardano DB sync progress
Use the GraphQL Playground in the browser at http://localhost:3100/graphql:
> **_Note_** This Query is not available in early Era's of Cardano. Check Points of Interest here: [Link](https://ogmios.dev/mini-protocols/local-chain-sync/#points-of-interest)
Expand Down
15 changes: 9 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ services:

cardano-db-sync:
platform: linux/x86_64
image: ghcr.io/intersectmbo/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-13.3.0.0}
image: ghcr.io/intersectmbo/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-13.4.0.0}
command: [
"--config", "/config/cardano-db-sync/config.json",
"--socket-path", "/node-ipc/node.socket"
Expand All @@ -66,8 +66,11 @@ services:
- RESTORE_SNAPSHOT=${RESTORE_SNAPSHOT:-}
- RESTORE_RECREATE_DB=N
depends_on:
- cardano-node
- postgres
# Depend on both services to be healthy before starting.
cardano-node:
condition: service_healthy
postgres:
condition: service_healthy

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kammerlo
healthcheck is not defined for cardano-node and postgres. Is this a problem?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this isn't a problem. We just need the container to be up and running.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, shouldn't we use service_started instead of service_healthy?
I am making such a change locally.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying it in a preprod environment right now and it wouldn't start otherwise.

Aug 14 13:13:51 ip-10-18-1-87.ap-northeast-1.compute.internal docker-compose[6159]: ERROR: for cardano-db-sync  Service "postgres" is missing a healthcheck configuration
Aug 14 13:13:51 ip-10-18-1-87.ap-northeast-1.compute.internal docker-compose[6159]: Encountered errors while bringing up the project.

secrets:
- postgres_password
- postgres_user
Expand All @@ -87,7 +90,7 @@ services:
hasura:
build:
context: ./packages/api-cardano-db-hasura/hasura
image: cardanofoundation/cardano-graphql-hasura:${CARDANO_GRAPHQL_VERSION:-8.2.0}
image: cardanofoundation/cardano-graphql-hasura:${CARDANO_GRAPHQL_VERSION:-8.2.1}
ports:
- ${HASURA_PORT:-8090}:8080
depends_on:
Expand All @@ -111,7 +114,7 @@ services:
build:
context: .
target: background
image: cardanofoundation/cardano-graphql-background:${CARDANO_GRAPHQL_VERSION:-8.2.0}-${NETWORK:-mainnet}
image: cardanofoundation/cardano-graphql-background:${CARDANO_GRAPHQL_VERSION:-8.2.1}-${NETWORK:-mainnet}
depends_on:
- "hasura"
- "postgres"
Expand Down Expand Up @@ -139,7 +142,7 @@ services:
- NETWORK=${NETWORK:-mainnet}
context: .
target: server
image: cardanofoundation/cardano-graphql-server:${CARDANO_GRAPHQL_VERSION:-8.2.0}-${NETWORK:-mainnet}
image: cardanofoundation/cardano-graphql-server:${CARDANO_GRAPHQL_VERSION:-8.2.1}-${NETWORK:-mainnet}
environment:
- ALLOW_INTROSPECTION=true
- CACHE_ENABLED=true
Expand Down
Loading