Skip to content

Latest commit

 

History

History

recompute-certificates-hash

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Recompute the certificates hashes of Mithril aggregator

Configure environment variables

Export the environment variables:

export MITHRIL_VM=**MITHRIL_VM**
export CARDANO_NETWORK=**CARDANO_NETWORK**
export MITHRIL_DISTRIBUTION=**MITHRIL_DISTRIBUTION**

Here is an example for the release-mainnet network:

export MITHRIL_VM=aggregator.release-mainnet.api.mithril.network
export CARDANO_NETWORK=mainnet
export MITHRIL_DISTRIBUTION=latest

Connect to the VM

Connect to the aggregator VM:

ssh curry@$MITHRIL_VM

Stop the aggregator

Stop the aggregator container:

docker stop mithril-aggregator

Make a backup of the aggregator database

Export the environment variables:

export CARDANO_NETWORK=**CARDANO_NETWORK**
export MITHRIL_DISTRIBUTION=**MITHRIL_DISTRIBUTION**

Truncate WAL and SHM files:

sqlite3 /home/curry/data/$CARDANO_NETWORK/mithril-aggregator/mithril/stores/aggregator.sqlite3 "PRAGMA wal_checkpoint(TRUNCATE);"

And copy the SQLite database file aggregator.sqlite3:

cp /home/curry/data/$CARDANO_NETWORK/mithril-aggregator/mithril/stores/aggregator.sqlite3 /home/curry/data/$CARDANO_NETWORK/mithril-aggregator/mithril/stores/aggregator.sqlite3.bak.$(date +%Y-%m-%d)

Create a temp directory

Create a temp directory:

rm -rf /home/curry/temp
mkdir -p /home/curry/temp/config
cd /home/curry/temp

And download the configuration file for tools:

wget https://raw.githubusercontent.com/input-output-hk/mithril/main/docs/runbook/recompute-certificates-hash/config/tools.json -O /home/curry/temp/config/tools.json

Download the pre-compiled aggregator binary

Download the mithril pre-compiled binaries package:

curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/input-output-hk/mithril/refs/heads/main/mithril-install.sh | sh -s -- -c mithril-aggregator -d $MITHRIL_DISTRIBUTION -p $(pwd)

Make sure you are running the expected version of the aggregator:

./mithril-aggregator --version

Run the migration

Once connected to the aggregator container, recompute the certificates hashes:

DATA_STORES_DIRECTORY=/home/curry/data/$CARDANO_NETWORK/mithril-aggregator/mithril/stores/ ./mithril-aggregator --run-mode tools -vvv tools recompute-certificates-hash

Restart the aggregator

Restart the aggregator to make sure that the certificate chain is valid:

docker start mithril-aggregator

Make sure that the certificate chain is valid (wait for the state machine to go into the READY state):

docker logs -f --tail 1000 mithril-aggregator

Cleanup the temp directory

Remove the temp directory:

rm -rf /home/curry/temp

Exit from the VM

Then disconnect from the aggregator VM:

exit

Database rollback procedure

If the recomputation fails, you can rollback the database,and try again the process.

First, stop the aggregator:

docker stop mithril-aggregator

Then, restore the backed up database:

cp /home/curry/data/$CARDANO_NETWORK/mithril-aggregator/mithril/stores/aggregator.sqlite3.bak.$(date +%Y-%m-%d) /home/curry/data/$CARDANO_NETWORK/mithril-aggregator/mithril/stores/aggregator.sqlite3

Then, start the aggregator:

docker start mithril-aggregator

Then disconnect from the aggregator VM:

exit