Skip to main content

Deploying with Docker

This guide provides instructions for deploying Cardano Rosetta Java using Docker.

Prerequisites

Before you begin, ensure you have the following installed:

  • Docker
  • Docker Compose
  • Java 21
  • For integration tests: Node 14+

Deployment Options

Using Docker Compose

  1. Clone the repository
  2. Use the provided environment files or modify them if necessary:
    • The default configuration is in .env.docker-compose
    • Choose a hardware profile from the available options (see Hardware Profiles for details):
# Entry level hardware profile
docker compose --env-file .env.docker-compose \
--env-file .env.docker-compose-profile-entry-level \
-f docker-compose.yaml up -d

# Mid-level hardware profile
docker compose --env-file .env.docker-compose \
--env-file .env.docker-compose-profile-mid-level \
-f docker-compose.yaml up -d
note

The first time you run the command, it will take significant time to build the cardano-node. On subsequent runs, it will use the cached version.

Syncing the Node First

If you want to sync the node first before starting other services:

# Start only the cardano-node
docker compose --env-file .env.docker-compose -f docker-compose.yaml up cardano-node

# Once the node reaches the tip, start the rest of the services
docker compose --env-file .env.docker-compose -f docker-compose.yaml up
Node Synchronization

To speed up the initial synchronization process, you can use Mithril snapshots by setting MITHRIL_SYNC=true in your environment file.

Mithril provides cryptographically certified blockchain snapshots for multiple Cardano networks (mainnet, preprod, preview, sanchonet) and is integrated directly into the Docker setup. This can reduce synchronization time from days to hours.

Running Modes

Cardano Rosetta Java supports several operating modes that can be configured based on your requirements:

Initial Sync Mode

For users who don't have a fully synced node and need to start from scratch without using a snapshot:

docker run -e SYNC=true --env-file ./docker/.env.dockerfile \
-p 8082:8082 --shm-size=4g -d {image_name}:latest

In this mode, the container will verify chunks and synchronize the node. When it reaches the tip, the API starts automatically.

Online and Offline Functionality

For information about running in online mode (default) or offline mode (for air-gapped environments), see the Operation Modes documentation.

Monitoring and Maintenance

Useful Commands

# Follow Docker container logs
docker logs rosetta -f

# Access node logs
docker exec rosetta tail -f /logs/node.log

# Access indexer logs
docker exec rosetta tail -f /logs/indexer.log

Troubleshooting Common Issues

Connection Issues

If you experience connection losses between yaci-store and the cardano node, you can fix it by running:

docker restart yaci-indexer

Important Container Paths

PathDescription
/node/dbCardano Node Data
/node/postgresPostgreSQL Data
/networksNetwork config location
/logsLog files for each service

Running Integration Tests

Start the test environment:

docker compose --env-file .env.IntegrationTest \
-f docker-integration-test-environment.yaml up --build -d --wait

Hardware Profiles

Cardano Rosetta Java offers different hardware profiles to optimize performance based on your available resources. These profiles configure PostgreSQL and connection pooling parameters.

For detailed information about available profiles and their configurations, see Hardware Profiles.