Docker Compose Archive
This example demonstrates how to run a Mina archive node using Docker Compose for the Mainnet network. This Docker Compose setup includes a Postgres database, a bootstrap database with the latest SQL Dump available, an archive node, a Mina node and a Missing Blocks Guardian script to monitor and populate the gaps in the archive database
Copy and paste the provided configuration into a docker-compose.yml
file. Then run docker compose up -d
to start the services, and use docker compose logs -f
to monitor the logs.
services:
postgres:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: archive
healthcheck:
test: ["CMD-SHELL", "psql -U postgres -d archive -tAc \"SELECT COUNT(*) FROM pg_database WHERE datname='archive';\" | grep -q '^1$'"]
interval: 5s
timeout: 10s
retries: 10
volumes:
- './archive/postgresql/data:/var/lib/postgresql/data'
ports:
- '5432:5432'
bootstrap_db:
image: 'minaprotocol/mina-archive:3.0.3-d800da8-bullseye'
# image: 'gcr.io/o1labs-192920/mina-archive:3.0.1-alpha1-0473756-bullseye' # Use this image for Devnet
command: >
bash -c '
curl -O https://673156464838-mina-archive-node-backups.s3.us-west-2.amazonaws.com/mainnet/mainnet-archive-dump-$(date +%F_0000).sql.tar.gz;
tar -zxvf mainnet-archive-dump-$(date +%F_0000).sql.tar.gz;
psql postgres://postgres:postgres@postgres:5432/archive -c "
ALTER SYSTEM SET max_connections = 500;
ALTER SYSTEM SET max_locks_per_transaction = 100;
ALTER SYSTEM SET max_pred_locks_per_relation = 100;
ALTER SYSTEM SET max_pred_locks_per_transaction = 5000;
"
psql postgres://postgres:postgres@postgres:5432/archive -f mainnet-archive-dump-$(date +%F_0000).sql;
'
# For Devnet Network, replace "mainnet" references with "devnet" in the block above
depends_on:
postgres:
condition: service_healthy
missing_blocks_guardian:
image: 'minaprotocol/mina-archive:3.0.3-d800da8-bullseye'
# image: 'gcr.io/o1labs-192920/mina-archive:3.0.1-alpha1-0473756-bullseye' # Use this image for Devnet
command: >
bash -c '
curl -O https://raw.githubusercontent.com/MinaFoundation/helm-charts/main/mina-archive/scripts/missing-blocks-guardian-command.sh;
export GUARDIAN_PRECOMPUTED_BLOCKS_URL=https://673156464838-mina-precomputed-blocks.s3.us-west-2.amazonaws.com/mainnet;
export MINA_NETWORK=mainnet;
export PG_CONN=postgres://postgres:postgres@postgres:5432/archive;
while true; do bash missing-blocks-guardian-command.sh; sleep 600; done
'
# For Devnet Network, replace "mainnet" references with "devnet" in the block above
depends_on:
bootstrap_db:
condition: service_completed_successfully
mina_archive:
image: 'minaprotocol/mina-archive:3.0.3-d800da8-bullseye'
restart: always
command:
- mina-archive
- run
- --postgres-uri
- postgres://postgres:postgres@postgres:5432/archive
- --server-port
- "3086"
volumes:
- './archive/data:/data'
depends_on:
bootstrap_db:
condition: service_completed_successfully
mina_node:
image: 'minaprotocol/mina-daemon:3.0.3-d800da8-bullseye-mainnet'
# image: 'gcr.io/o1labs-192920/mina-daemon:3.0.1-alpha1-0473756-bullseye-devnet' # Use this image for Devnet
restart: always
entrypoint: []
command: >
bash -c '
mina daemon --archive-address mina_archive:3086 \
--peer-list-url https://bootnodes.minaprotocol.com/networks/mainnet.txt \
--insecure-rest-server \
--rest-port 3085
'
# use --peer-list-url https://bootnodes.minaprotocol.com/networks/devnet.txt for Devnet
ports:
- '3085:3085'
- '8302:8302'
depends_on:
bootstrap_db:
condition: service_completed_successfully
Once the services are running, you can access the Mina node graphql endpoint at http://localhost:3085/graphql
and the postgres database using psql postgres://postgres:postgres@localhost:5432/archive
.
To retrieve the status of the Mina Node, run docker compose exec mina_node mina client status