Docker Compose Deployment

Note: See the docker-compose directory in the OpenScan.AI repositories on GitHub for all required configuration files.

Prerequisites

  • Docker v20.10+
  • Docker Compose 2.x.x+
  • Running Ethereum JSON RPC client

Building Docker containers from source

Terminal window
cd ./docker-compose
docker compose up --build

Note: If you don’t need to make backend customizations, you can run docker compose up in order to launch from the published OpenScan.AI Docker images. This will be much faster.

This command uses docker-compose.yml by default, which builds the backend of the explorer into the Docker image and runs 9 Docker containers:

  • Postgres 17.x database, which will be available at port 7432 on the host machine.
  • Redis database of the latest version.
  • OpenScan.AI backend with api at /api path.
  • Nginx proxy to bind backend, frontend and microservices.
  • OpenScan.AI explorer at http://localhost.

and containers for microservices (written in Rust):

  • Stats service with a separate Postgres DB.
  • Sol2UML visualizer service.
  • Sig-provider service.

Note for Linux users: Linux users who run OpenScan.AI in Docker with a local node need to run the node on http://0.0.0.0/ rather than http://127.0.0.1/.

Configs for different Ethereum clients

The repository contains built-in configs for different JSON RPC clients without the need to build the image.

JSON RPC ClientDocker compose launch command
Erigondocker compose -f erigon.yml up -d
Geth (suitable for Reth as well)docker compose -f geth.yml up -d
Geth Cliquedocker compose -f geth-clique-consensus.yml up -d
Nethermind, OpenEthereumdocker compose -f nethermind.yml up -d
Anvildocker compose -f anvil.yml up -d
HardHat networkdocker compose -f hardhat-network.yml up -d
  • Run only the explorer without DB: docker compose -f external-db.yml up -d. In this case, no db container is created, and it assumes that the DB credentials are provided through the DATABASE_URL environment variable on the backend container.
  • Running explorer with external backend: docker compose -f external-backend.yml up -d
  • Running explorer with external frontend: docker compose -f external-frontend.yml up -d
  • Running all microservices: docker compose -f microservices.yml up -d

All of the configs assume the Ethereum JSON RPC is running at http://localhost:8545. For the XDC Network, set CHAIN_ID=50 and point the JSON RPC URLs at an XDC archive node.

In order to stop launched containers, run docker compose -f config_file.yml down, replacing config_file.yml with the file name of the config which was previously launched.

You can adjust OpenScan.AI environment variables:

  • for backend in the common backend env file under ./envs/ (e.g. common-backend.env)
  • for frontend in ./envs/common-frontend.env
  • for stats service in ./envs/common-stats.env
  • for visualizer in ./envs/common-visualizer.env

Descriptions of the ENVs are available:

Running via Makefile

Prerequisites are the same as for the Docker Compose setup.

Start all containers:

Terminal window
cd ./docker
make start

Stop all containers:

Terminal window
cd ./docker
make stop

Note: The Makefile uses the same .env files since it is running docker-compose services inside.