forked from o1-labs/docs2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
600 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
docs/berkeley-upgrade/archive-migration/docker-example.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
title: Example of Mainnet Archive Migration (Docker) | ||
sidebar_label: Docker example (Mainnet) | ||
hide_title: true | ||
description: A copy-paste example of how to do a Mainnet migration. | ||
keywords: | ||
- Berkeley | ||
- upgrade | ||
- archive migration | ||
- mina archive node | ||
- archive node | ||
--- | ||
|
||
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](/berkeley-upgrade/archive-migration/debian-example) | ||
|
||
```sh | ||
|
||
# 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 | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.