Skip to content

Instantly share code, notes, and snippets.

@mkoura
Created August 31, 2021 12:59
Show Gist options
  • Save mkoura/991dd2ed412fd90e50ad781931777a85 to your computer and use it in GitHub Desktop.
Save mkoura/991dd2ed412fd90e50ad781931777a85 to your computer and use it in GitHub Desktop.
db-sync snapshots testing using docker-compose

Setup for testing db-sync snapshots:

  • start all services
cd cardano-db-sync
docker-compose up -d
docker-compose log -f
  • stop and remove db-sync and postgres services
docker-compose ps --services
docker-compose rm -s cardano-db-sync
docker-compose rm -s postgres
  • remove db-sync and postgres persistent volumes
docker volumes ls
docker volume rm cardano-db-sync_postgres
docker volume rm cardano-db-sync_db-sync-data
  • connect to node container and wait until node is synced
docker exec -it cardano-db-sync_cardano-node_1 bash
export CARDANO_NODE_SOCKET_PATH=/ipc/node.socket
cardano-cli query tip --mainnet
  • start db-sync and postgres services
export RESTORE_SNAPSHOT=https://update-cardano-mainnet.iohk.io/cardano-db-sync/11/db-sync-snapshot-schema-11-block-6151159-x86_64.tgz
docker-compose up -d
docker-compose logs -f -- cardano-db-sync
  • connect to postgres container and monitor syncing of db-sync
docker exec -it cardano-db-sync_postgres_1 bash
psql --username postgres --no-password --dbname cexplorer
SELECT epoch_no, slot_no, block_no FROM block ORDER BY ID DESC LIMIT 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment