Skip to main content

Boot Sequence

Version 2.0

This documentation applies to Rosetta Java v2.0 and later.

The boot sequence solves three problems:

  1. Blockchain sync is slow: Syncing from genesis takes days. mithril downloads verified snapshots, reducing this to hours.

  2. Ingesting data into a moving target is wasteful: yaci-indexer parses blocks and ingests them into PostgreSQL. If it starts while the node is still syncing, it processes incomplete data. cardano-sync-waiter blocks until the node catches up.

  3. Indexes slow initial sync: Maintaining PostgreSQL indexes while ingesting data is expensive. index-applier creates them after ingestion completes.

Components

Core

These services are required to run Rosetta Java. One-shot services run once during startup; persistent services run continuously.

ServiceRolePortLifecycle
mithrilDownloads verified blockchain snapshots-One-shot: skips if /node/db exists
cardano-nodeValidates and relays blocks3001Persistent
cardano-submit-apiTransaction submission endpoint8090Persistent
cardano-sync-waiterBlocks until node is synced-One-shot: exits when synced
dbPostgreSQL database for blockchain data5432Persistent
yaci-indexerParses blocks into database tables9095Persistent
apiRosetta/Mesh API endpoints8082Persistent
index-applierAdds query optimization after data ingestion-One-shot (New in v2.0)

Monitoring (optional)

These services provide observability into system health and performance. Deploy them alongside the core stack for production environments.

ServiceRolePortLifecycle
prometheusMetrics collection9090Persistent
grafanaMetrics visualization3000Persistent
postgresql-exporterDatabase metrics for Prometheus9187Persistent
node-exporterSystem metrics for Prometheus9100Persistent

Startup Order

The core services must start in a specific order. Each service waits for its dependencies before proceeding.

Monitoring Stack

The monitoring services run independently from the core boot sequence. node-exporter collects host metrics (CPU, RAM, disk) and has no container dependencies. postgresql-exporter requires db to be healthy before it can scrape database metrics.

Sync Stages

The /network/status endpoint reports system state:

  • SYNCING: Data in PostgreSQL is behind the blockchain tip. This occurs during initial sync, or when the node or indexer falls behind. Queries may return incomplete data.
  • APPLYING_INDEXES: Data ingestion is complete. index-applier is creating database indexes using CREATE INDEX CONCURRENTLY. The API responds but queries may be slow until indexes are ready (~6 hours on mainnet).
  • LIVE: All data is ingested and all indexes are valid and ready. The system is fully operational for production queries.
curl -s http://localhost:8082/network/status \
-H "Content-Type: application/json" \
-d '{"network_identifier":{"blockchain":"cardano","network":"mainnet"}}' \
| jq -r '.sync_status.stage'

Shared Resources

These volumes must be persisted across container restarts to avoid re-syncing from scratch.

Env VarHost PathContainer PathPurpose
CARDANO_NODE_DIR/opt/rosetta-java-mainnet/node_datasame as hostNode socket and blockchain data
CARDANO_NODE_SOCKET_PATH${CARDANO_NODE_DIR}/node.socketsame as hostIPC socket for node communication
CARDANO_NODE_DB${CARDANO_NODE_DIR}/dbsame as hostBlockchain ledger
CARDANO_CONFIG./config/node/mainnet/configGenesis files, topology
DB_PATH/opt/rosetta-java-mainnet/sql_data/var/lib/postgresql/dataPostgreSQL data files
-./api/src/main/resources/config/db-indexes.yaml/config/db-indexes.yamlIndex definitions for index-applier

Health Checks

Use these methods to verify each service is running and responsive.

ServiceMethodCommand
dbPostgreSQL readypg_isready -U $DB_USER -d $DB_NAME
apiHTTP POSTcurl -X POST .../network/options
apiSync statuscurl -X POST .../network/status → check stage
yaci-indexerSpring actuatorcurl .../actuator/health
cardano-nodeCLI querycardano-cli query tip --mainnet or --testnet-magic <N>
cardano-submit-apiTCP portnc -zv localhost 8090
prometheusHTTP GETcurl .../-/healthy
grafanaHTTP GETcurl .../api/health