Docker example
You can follow these steps that can be copy-pasted directly into a OS running Docker.
This example performs a Mainnet initial migration following the debian-example
# Create a new directory for the migration data
mkdir $(pwd)/mainnet-migration && cd $(pwd)/mainnet-migration
# Create Network
docker network create mainnet
# Launch Local Postgres Database
docker run --name postgres -d -p 5432:5432 --network mainnet -v $(pwd)/mainnet-migration/postgresql/data:/var/lib/postgresql/data -e POSTGRES_USER=mina -e POSTGRES_PASSWORD=minamina -d postgres:13-bullseye
export PGHOST="localhost"
export PGPORT=5432
export PGUSER="mina"
export PGPASSWORD="minamina"
# Drop DBs if they exist
psql -c "DROP DATABASE IF EXISTS mainnet_balances_migrated;"
psql -c "DROP DATABASE IF EXISTS mainnet_really_migrated;"
# Create DBs
psql -c "CREATE DATABASE mainnet_balances_migrated;"
psql -c "CREATE DATABASE mainnet_really_migrated;"
# Retrieve Archive Node Backup
wget https://673156464838-mina-archive-node-backups.s3.us-west-2.amazonaws.com/mainnet/mainnet-archive-dump-2024-04-29_0000.sql.tar.gz
tar -xf mainnet-archive-dump-2024-04-29_0000.sql.tar.gz
# Replace the database name in the dump
sed -i -e s/archive_balances_migrated/mainnet_balances_migrated/g mainnet-archive-dump-2024-04-29_0000.sql
psql mainnet_balances_migrated -f mainnet-archive-dump-2024-04-29_0000.sql
# Prepare target
wget https://raw.githubusercontent.com/MinaProtocol/mina/berkeley/src/app/archive/create_schema.sql
wget https://raw.githubusercontent.com/MinaProtocol/mina/berkeley/src/app/archive/zkapp_tables.sql
psql mainnet_really_migrated -f create_schema.sql
# Start migration
docker create --name mainnet-db-migration \
-v $(pwd)/mainnet-migration:/data \
--network mainnet gcr.io/o1labs-192920/mina-archive-migration:3.0.1-e848ecb-bullseye -- bash -c '
wget http://673156464838-mina-genesis-ledgers.s3-website-us-west-2.amazonaws.com/mainnet/genesis_ledger.json; mina-berkeley-migration-script initial \
--genesis-ledger genesis_ledger.json \
--source-db postgres://mina:minamina@postgres:5432/mainnet_balances_migrated \
--target-db postgres://mina:minamina@postgres:5432/mainnet_really_migrated \
--blocks-batch-size 5000 \
--blocks-bucket mina_network_block_data \
--checkpoint-output-path /data/checkpoints/. \
--precomputed-blocks-local-path /data/precomputed_blocks/. \
--network mainnet'
docker start mainnet-db-migration
docker logs -f mainnet-db-migration