Subsquid Archives

Repository

GitHub - litentry/squid-archives
GitHub

Overview

The subsquid archives store substrate chain data (currently Polkadot, Kusama and Khala) in a postgres instance for efficient querying by the subsquid processors.

Preparing the server

1
wget -q -O - https://raw.githubusercontent.com/litentry/squid-archives/main/init.sh | bash
2
3
# reload terminal session here to enable new docker group for the current user
4
5
cd /srv/www/squid-archives
6
chain={chain} ./init-letsencrypt.sh
Copied!

Importing from backup

Replace {chain} and {file} below
1
sudo apt install pv postgresql-client-12 postgresql-client-common
2
sudo chown -R {user}:docker /data
3
mkdir /data/archive
4
cd /srv/www/squid-archives/
5
ln -s /data/archive {chain}/data/database
6
chain={chain} docker-compose up -d db
7
psql -h 0.0.0.0 -U postgres -c "CREATE DATABASE \"{chain}-archive\""
8
# run the next command from within tmux as it can take a long time
9
pv {file}.sql | psql -h 0.0.0.0 -U postgres -d {chain}-archive
Copied!

Running the archiver

1
chain={chain} docker-compose up -d
Copied!
Grab a coffee to celebrate!

Domains

You can check the status on the domain configured with nginx:
https://{chain}-squid-archive.litentry.io/ e.g. https://polkadot-squid-archive.litentry.io/