Skip to main content

Docker Compose Rosetta

For production deployments, use Docker Compose to run each Rosetta component as a separate container. This gives you control over resource allocation, logging, and restarts.

The full Docker Compose configuration — including docker-compose.yml, example environment files for mainnet and devnet, a Makefile, and a README — is maintained in the Mina repository:

mina/src/app/rosetta/docker-compose/

Quick start​

tip

Before running the commands below, review the Configuration section to see all available options — including image tags, network selection, ports, and database settings.

git clone https://github.com/MinaProtocol/mina.git
cd mina/src/app/rosetta/docker-compose

# For mainnet
cp example.mainnet.env .env

# For devnet
cp example.devnet.env .env

# Edit .env — set MINA_LIBP2P_PASS and review POSTGRES_PASSWORD
vi .env

# Start all services
docker compose --env-file .env up -d

# Or use make shortcuts
make mainnet # copies mainnet env and starts services
make devnet # copies devnet env and starts services
note

Every docker compose command on this page passes --env-file .env. Docker Compose reads .env on its own, but other runtimes, such as Podman, do not.

info

The bootstrap_db service runs mina-provision: it downloads the newest hourly archive dump for MINA_NETWORK and loads it into PostgreSQL. A mainnet dump is about 1 GiB compressed and several times that after extraction, so the first start takes a while. The archive node, the Mina daemon and Rosetta start after the import completes. On later starts, the database already holds an archive, and bootstrap_db leaves it alone without downloading anything.

Services overview​

The Docker Compose setup includes six services:

ServiceDescriptionDefault Port
postgresPostgreSQL 17 with health checks5432 (container), configurable host port
bootstrap_dbOne-shot: mina-provision loads the newest hourly archive dump. Skipped when the database already holds an archive—
mina_archiveArchive process, stores block data in PostgreSQL3086
mina_nodeMina daemon with GraphQL API3085 (GraphQL), 8302 (P2P)
mina_rosettaRosetta API for exchange integration3087
missing_blocks_guardianFills in the blocks between the restored dump and the chain tip, and any later gaps, from the published precomputed blocks—

Configuration​

All configuration is done through a single .env file. Key variables:

Docker images​

VariableDescription
MINA_DAEMON_IMAGEMina daemon Docker image
MINA_ARCHIVE_IMAGEMina archive Docker image
MINA_ROSETTA_IMAGEMina Rosetta Docker image
MINA_PROVISION_IMAGEmina-provision image, used by bootstrap_db

All images, for mainnet and devnet, are pulled from Docker Hub (minaprotocol/mina-*). The example .env files pin a tested release of each.

Database​

VariableDefaultDescription
POSTGRES_DBarchiveDatabase the archive node writes to. Keep archive: the published dumps always restore into a database of that name
POSTGRES_USERpostgresPostgreSQL user
POSTGRES_PASSWORDpostgresPostgreSQL password. Change it before you expose POSTGRES_PORT

Network​

VariableDescription
MINA_NETWORKmainnet or devnet
MINA_PEERLIST_URLBootstrap peers URL
MINA_LIBP2P_PASSPassphrase for the libp2p key (required)

Ports​

VariableDefaultDescription
POSTGRES_PORT5433Host port mapped to PostgreSQL
MINA_REST_PORT3085GraphQL API port
MINA_P2P_PORT8302P2P networking port
MINA_ARCHIVE_PORT3086Archive server port
MINA_ROSETTA_PORT3087Rosetta API port

Rosetta​

VariableDefaultDescription
MINA_ROSETTA_MAX_DB_POOL_SIZE80Size of Rosetta's PostgreSQL connection pool. Required: Rosetta does not start without it
MINA_ROSETTA_PG_DATA_INTERVAL30Seconds between the log lines in which Rosetta reports the PostgreSQL connection and lock counts

Archive bootstrap​

VariableDescription
GUARDIAN_PRECOMPUTED_BLOCKS_URLWhere the missing blocks guardian reads precomputed blocks (the public mina_network_block_data bucket)
GUARDIAN_SLEEP_INTERVALSeconds between the guardian's checks (optional, default 600)

The dump location is not configured here: mina-provision derives it from MINA_NETWORK. To read dumps from a mirror instead, mount a provider file into the bootstrap_db service and set MINA_PROVISION_CONFIG to its path. See Writing a provider.

Data persistence​

Bind mounts preserve data across docker compose down / up:

Host pathContainer pathContents
./archive/postgresql/data/var/lib/postgresql/dataPostgreSQL data
./archive/data/dataArchive node data
./mina_node/.mina-config/root/.mina-configDaemon config, keys, peers
./mina_rosetta/.mina-config/root/.mina-configRosetta config

Make targets​

CommandDescription
make devnetCopy devnet env and start services
make mainnetCopy mainnet env and start services
make stopStop all services
make cleanStop services, remove volumes and all persisted data
make logsFollow logs for all services
make statusShow container status
make healthCheck health of Postgres, GraphQL, and Rosetta endpoints

Verifying the deployment​

Once services are running and the node is synced:

# Check container status
make status

# Run health checks
make health

# Check sync status
docker compose --env-file .env exec mina_node mina client status

# Query Rosetta API
curl -s http://localhost:3087/network/list \
-H 'Content-Type: application/json' -d '{}' | jq .

# Connect to archive database
psql postgres://postgres:postgres@localhost:5433/archive

Clean start​

To wipe all data and start fresh:

make clean
docker compose --env-file .env up -d