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.
Merge pull request o1-labs#1009 from MinaFoundation/add-docker-compos…
…e-for-rosetta Add Docker Compose example for Rosetta
- Loading branch information
Showing
2 changed files
with
126 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
--- | ||
title: Docker Compose Rosetta | ||
sidebar_label: Docker Compose example | ||
description: Example of how to run Mina Rosetta node using Docker Compose. | ||
keywords: | ||
- mina rosetta | ||
- docker compose | ||
- postgres | ||
- archive | ||
- daemon | ||
- graphQL | ||
--- | ||
|
||
# Docker Compose Rosetta | ||
|
||
This example demonstrates how to run the Mina Rosetta bundle using Docker Compose for the Mainnet network. This Docker Compose setup includes a Postgres database, a bootstrap database populated with the latest daily SQL dump available, an archive node, a Mina node, and a Missing Blocks Guardian which will fill in any missing blocks. | ||
|
||
Copy and paste the provided configuration into a `docker-compose.yaml` file. Then run `docker compose up -d` to start the services, and use `docker compose logs -f` to monitor the logs. | ||
|
||
```yaml | ||
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.0-93e0279-bullseye' | ||
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; | ||
' | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
missing_blocks_guardian: | ||
image: 'minaprotocol/mina-archive:3.0.0-93e0279-bullseye' | ||
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 | ||
' | ||
depends_on: | ||
bootstrap_db: | ||
condition: service_completed_successfully | ||
mina_archive: | ||
image: 'minaprotocol/mina-archive:3.0.0-93e0279-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.0-93e0279-bullseye-mainnet' | ||
restart: always | ||
environment: | ||
MINA_LIBP2P_PASS: PssW0rD | ||
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 | ||
' | ||
ports: | ||
- '3085:3085' | ||
- '8302:8302' | ||
depends_on: | ||
bootstrap_db: | ||
condition: service_completed_successfully | ||
mina_rosetta: | ||
image: 'minaprotocol/mina-rosetta:3.0.0-93e0279-bullseye' | ||
restart: always | ||
environment: | ||
MINA_ROSETTA_MAX_DB_POOL_SIZE: 80 | ||
MINA_ROSETTA_PG_DATA_INTERVAL: 30 | ||
entrypoint: [] | ||
command: > | ||
bash -c ' | ||
mina-rosetta --port 3087 \ | ||
--archive-uri postgres://postgres:postgres@postgres:5432/archive \ | ||
--graphql-uri mina_node:3085/graphql \ | ||
--log-level Info | ||
' | ||
ports: | ||
- '3087:3087' | ||
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`. | ||
You can also access the Rosetta API at `http://localhost:3087`. | ||
|
||
To retrieve the status of the Mina Node, run `docker compose exec mina_node mina client status` |
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