scrtlabs / docker-environment

Docker Environment for the Discovery release of the Enigma Protocol
https://enigma.co
6 stars 6 forks source link
blockchain docker docker-compose secret-contracts

Develop:

Master:

Welcome to the new docker environment!

What's new?

Major changes

Minor changes

Building images

Just use the makefile to clone the repos from github:

make clone-all

clone-all can take the following arguments:

Example:

make clone-all BRANCH=master

And build all the images:

make build

Build can take the following arguments:

Example:

make build SGX_MODE=SW DEBUG=0

The following make targets also exist:

Installation

Copy .env.template to .env and adjust any values as needed:

cp .env.template .env

Software mode:

docker-compose up

Hardware mode:

docker-compose -f docker-compose.yml -f docker-compose.hw.yml up

** Current develop is still kind of bugged, so it won't actually run all the tests successfully

Client Usage

The compose by default comes with a client you can use to run tests on the cluster. To use, just exec make test in the client

docker-compose exec client make test

Set the number of workers

docker-compose scale worker=X

Be careful you have enough memory to run all those workers though!

Manual build

Worker

  1. Clone from github both core and p2p:
    docker build -f gitclone_core.Dockerfile -t gitclone_core .
    docker build -f gitclone_p2p.Dockerfile -t gitclone_p2p .

Note: it's possible to change each image to pull from a branch, for example develop:

docker build -f gitclone_core.Dockerfile -t gitclone_core --build-arg branch=develop .
docker build -f gitclone_p2p.Dockerfile -t gitclone_p2p --build-arg branch=develop .
  1. (Optional) Build base image:

    docker build --build-arg DEBUG=1 --build-arg SGX_MODE=SW -f 01_core_base.Dockerfile -t enigmampc/core-base:latest .
  2. Build worker image:

    docker build --build-arg SGX_MODE=SW -f 02_core_and_p2p.Dockerfile -t enigmampc/worker-minimal:latest .

Optional steps

Key Management

  1. Clone from github:
    docker build -f gitclone_km.Dockerfile -t gitclone_km .

Note: it's possible to change each image to pull from a branch, for example develop:

docker build -f gitclone_km.Dockerfile -t gitclone_km --build-arg branch=develop .
  1. (Optional) Build base image:

    docker build --build-arg SGX_MODE=SW -f 01_core_base.Dockerfile -t enigmampc/core-base:latest .
  2. Build Key Management image:

    docker build --build-arg SGX_MODE=SW -f km.Dockerfile -t enigmampc/key_management:latest .

Contract

  1. Clone from github:
    docker build -f gitclone_contract.Dockerfile -t gitclone_contract .

Note: it's possible to change each image to pull from a branch, for example develop:

docker build -f gitclone_contract.Dockerfile -t gitclone_contract --build-arg branch=develop .
  1. Build Enigma-Contract image:
    docker build --build-arg SGX_MODE=SW -f contract.Dockerfile -t enigmampc/contract:latest .

Client

  1. Build enigma_common Docker image:

    cd common_scripts/
    docker build -f common.Dockerfile -t enigma_common .
    cd ..
  2. Clone integration-tests from Github:

    cd client
    docker build -f gitclone_integration.Dockerfile -t gitclone_integration .

Note: it's possible to change each image to pull from a branch, for example develop:

docker build -f gitclone_integration.Dockerfile -t gitclone_integration --build-arg branch=develop .
  1. Build Client image:
    docker build -f client.Dockerfile -t enigmampc/client:latest .

Development

Clone this repository. If cloned into Pycharm you should get all the build configurations for free

Each image uses the following:

  1. Dockerfile
  2. Devops folder -- containing docker-level configuration
  3. Scripts folder -- containing all the start-up scripts
  4. Config folder -- configuration defaults, per environment

TODO

  1. More documentation on environment variables