Skip to content

Initial Setup

Dependencies installation

First, you need to install all dependencies for the monorepo:

yarn install

Applications in the monorepo rely on HUMAN Protocol SDKs from the monorepo, so after installing dependencies they should be built:

yarn build:libs

Normally it's done once, but if the yarn.lock file changes, you might need to repeat these steps to get the latest changes.


Setting up environment variables#

All applications have .env.example with a minimum set of environment variables to run the application locally. To run an app you need to copy the example file:

cp .env.example .env.local

Then, for variables that have a replace_me value, replace that value with your own.

Info

For web3 testnet private keys and addresses, it's recommended to have your own set of valid values that you don't share, so you can be sure your dev env is not broken accidentally by anybody else.

For web3 localhost private keys use defaults provided by local hardhat node #what-are-hardhat-local-node-default-accounts

If you are not sure where/how to obtain a value for some variable, please check the FAQ page.


Spinning up infrastructure#

Almost all services depend on infrastructure components, such as a database and/or other external storage. To spin them up and get ready to use out of the box, we have a default setup of such components via Docker. To get it up and running just run the next command from the project root:

yarn docker:infra-up

Info

All .env.example files are preset to point to that predefined Docker infra.


DB migrations#

For services that rely on the DB, you will also need to run the initial DB migration. It can be done from the project root for all necessary services:

# Fortune Exchange Oracle
NODE_ENV=local yarn workspace @apps/fortune-exchange-oracle-server migration:run
# Job Launcher
NODE_ENV=local yarn workspace @apps/job-launcher-server migration:run
# Reputation Oracle
NODE_ENV=local yarn workspace @apps/reputation-oracle migration:run

Info

For CVAT services, migrations automatically run as part of the start script.


Creating network mappings#

In order to easily access some links from the applications in your browser, you should create network mappings in your /etc/hosts file:

  • 127.0.0.1 minio
  • 127.0.0.1 cvat-lb

After you save the changes, flush the DNS cache if needed ("how to clear the dns cache on my pc)


Once you are done with all the above, you are ready to run a specific service from its folder. If you want to run an "oracle," keep in mind that it needs some extra steps described on the Setting Up Oracles page.