Skip to main content

Docker Compose Archive (Devnet)

This example demonstrates how to run a Mina archive node using Docker Compose for the Devnet network. This Docker Compose setup includes a Postgres database, a bootstrap database, an archive node, a Mina node, and a script to generate a libp2p key.

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: 'gcr.io/o1labs-192920/mina-archive:3.0.0-dc6bf78-bullseye'
command: >
bash -c '
curl -O https://raw.githubusercontent.com/MinaProtocol/mina/develop/src/app/archive/create_schema.sql;
curl -O https://raw.githubusercontent.com/MinaProtocol/mina/develop/src/app/archive/zkapp_tables.sql;
psql postgres://postgres:postgres@postgres:5432/archive -f create_schema.sql;
'
depends_on:
postgres:
condition: service_healthy
archive:
image: 'gcr.io/o1labs-192920/mina-archive:3.0.0-dc6bf78-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
generate_libp2p_key:
image: 'gcr.io/o1labs-192920/mina-daemon:3.0.0-dc6bf78-bullseye-devnet'
environment:
MINA_LIBP2P_PASS: PssW0rD
entrypoint: []
command: >
bash -c '
mina libp2p generate-keypair -privkey-path /data/.mina-config/keys/libp2p-key
chmod -R 0700 /data/.mina-config/keys
chmod -R 0600 /data/.mina-config/keys/libp2p-key
'
volumes:
- './node/mina-config:/data/.mina-config'
mina_node:
image: 'gcr.io/o1labs-192920/mina-daemon:3.0.0-dc6bf78-bullseye-devnet'
restart: always
environment:
MINA_LIBP2P_PASS: PssW0rD
entrypoint: []
command: >
bash -c '
mina daemon --archive-address archive:3086 \
--peer-list-url https://bootnodes.minaprotocol.com/networks/devnet.txt \
--libp2p-keypair /data/.mina-config/keys/libp2p-key \
--insecure-rest-server \
--rest-port 3085
'
volumes:
- './node/mina-config:/data/.mina-config'
ports:
- '3085:3085'
- '8302:8302'
depends_on:
generate_libp2p_key:
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