Skip to content

Commit

Permalink
chore: upgraded db-sync (#885)
Browse files Browse the repository at this point in the history
* chore: upgraded db-sync

* docs: upgrading versions in doc
  • Loading branch information
Kammerlo authored Aug 12, 2024
1 parent cd11a5f commit 9394252
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
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
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

0 comments on commit 9394252

Please sign in to comment.