Skip to content

Run Services in Docker

Everything you need to spin up services is located in the docker-setup folder, so let’s make it our working directory:

cd docker-setup/

This setup focuses on using the testnet instead of running web3 locally, so you can have persistent data on-chain and on the subgraph. It also uses a different set of Docker containers (and volumes) for storing DB-like data, so anything in human-protocol-local-setup is persistent for you (unless you remove it by pruning your local Docker environment).

Info

The above is not the case for docker-compose.dev.yml, which is expected to be used for local dev only and has a separate set of services and volumes that can be safely pruned.


Preparing .env files#

Before you build or run any services, you need to prepare an env file named .env for it and fill it with valid values (see #setting-up-environment-variables). Docker Compose will use the env file in the specific service folder as a base and override only necessary values.

Info

If you have multiple files, such as .env.{NODE_ENV}, .env.local, and .env, then they are resolved in the corresponding order. For example, for NODE_ENV=development env files are parsed from left to right: .env.development, .env.local, .env, and the first value set for a variable will win.


Creating infra and building images#

To make sure that all necessary infra is set up and services can be started, run the following command:

make check-env-file infra-up

This command:

  • Ensures that no environment variables are missing for the Docker Compose setup
  • Ensures that the human-cvat-bridge network (needed to have stable communication between HUMAN Protocol and CVAT) is created
  • Spins up necessary infrastructure containers (Postgres, Redis, Minio) with a pre-defined setup for all services

After the above command is successful, you can either build all services without running them:

make build-services

or build and run them:

# To build and run all services
make services-up
# To build and run specific services (use service names from docker-compose as args)
make services-up service1 service2

Warning

The first-time run can take some time to build Docker images for all services; don't expect it to be quick.