Skip to content

Commit

Permalink
feat(tools): docker-compose files for indy corresponding to issue #866
Browse files Browse the repository at this point in the history
Signed-off-by: Izuru Sato <sato.izuru@fujitsu.com>
  • Loading branch information
izuru0 authored and takeutak committed May 19, 2021
1 parent 992f1c9 commit 599acc0
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/docker/indy-testnet/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
INDY_SDK_ROOT=../../indy-sdk/ci/
HTTP_PROXY=
NO_PROXY=

79 changes: 79 additions & 0 deletions tools/docker/indy-testnet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Launching Hyperledger Indy pool and validator

## Abstract

scripts in this directory builds, starts indy node pool and the cactus validator for indy

## What will be built, run by using the scripts

One bridge network and three containers will be started by `docker-compse up` command (after building the images).

![Indy node pool and validator](./fig1.svg)

- Network
- name: indy_net
- subnet: 172.16.0.0/24
- Containers
- nginx container
- proxies requests from verifiers to the validator in the python container
- NOTE: At the moment, this container does nothing.
- TODO: Configure to proxy requests. Enable uWSGI (towards the python container).
- IP address: 172.16.0.3 on indy_net
- port 10080 is open to the world
- python container
- validator code in the container receives requests from validators, which requests are proxied by the nginx container, and interacts with indy nodes in the indy_pool container
- NOTE: At the moment, this container does nothing.
- TODO: write validator code.
- IP address: 172.16.0.4
- port 80 is open to containers on indy_net
- indy_pool container
- indy nodes run in this container and serves requests from validator in the python container
- it mounts sandbox directory of host environment to save the status of Indy nodes
- IP address: 172.16.0.2
- ports 9701-9708 are open to containers on indy_net

## How to build

- get a copy of indy-sdk
- edit `.env` to set environment variables
- run `docker-compose build`

### How to get a copy of indy-sdk

You can use the following command to get a copy of indy-sdk source tree.

```
git clone https://github.com/hyperledger/indy-sdk.git -b v1.16.0
```
### How to edit `.env` file

Edit `.env` file in this directory to set the environment variables.

```
INDY_SDK_ROOT=../../git/indy-sdk/ci
HTTP_PROXY=http://<proxy_host>:<proxy_port>
NO_PROXY=
```

`INDY_SDK_ROOT` is the location of a Dockerfile (`indy-pool.dockerfile`) in the indy-sdk source tree, which will be used by the docker-compose command in this build process.

Set `HTTP_PROXY` and `NO_PROXY` if your network requires HTTP proxy access to reach the internet.


### How to build docker images

Use this command to build images

```
docker-compose build
```
## How to start and stop containers

Use this command to start containers.

```
docker-compse up
```

Press CTRL-C to stop the containers.

76 changes: 76 additions & 0 deletions tools/docker/indy-testnet/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
version: '3'

services:
indy_pool:
container_name: indy_pool
image: indy_pool
build:
context: ${INDY_SDK_ROOT}
dockerfile: indy-pool.dockerfile
args:
- HTTP_PROXY=$HTTP_PROXY
- http_proxy=$HTTP_PROXY
- HTTPS_PROXY=$HTTP_PROXY
- https_proxy=$HTTP_PROXY
- FTP_PROXY=$HTTP_PROXY
- ftp_proxy=$HTTP_proxy
- NO_PROXY=$NO_PROXY
- no_proxy=$no_proxy
environment:
- HTTP_PROXY=$HTTP_PROXY
- http_proxy=$HTTP_PROXY
- HTTPS_PROXY=$HTTP_PROXY
- https_proxy=$HTTP_PROXY
- FTP_PROXY=$HTTP_PROXY
- ftp_proxy=$HTTP_proxy
- NO_PROXY=$NO_PROXY
- no_proxy=$no_proxy
ports:
- "9701:9701"
- "9702:9702"
- "9703:9703"
- "9704:9704"
- "9705:9705"
- "9706:9706"
- "9707:9707"
- "9708:9708"
networks:
indy_net:
ipv4_address: 172.16.0.2
volumes:
- ./sandbox:/var/lib/indy/sandbox/

nginx:
container_name: nginx
build:
context: ./nginx
dockerfile: custom-nginx.dockerfile
image: sfuji822/nginx
ports:
- "10080:80"
networks:
indy_net:
ipv4_address: 172.16.0.3

validator:
container_name: validator
build:
context: ./validator
dockerfile: valipy.dockerfile
image: valipy
ports:
- "80:80"
networks:
indy_net:
ipv4_address: 172.16.0.4


networks:
indy_net:
name: indy_net
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.0.0/24

1 change: 1 addition & 0 deletions tools/docker/indy-testnet/fig1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tools/docker/indy-testnet/nginx/custom-nginx.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM nginx:stable-alpine
42 changes: 42 additions & 0 deletions tools/docker/indy-testnet/validator/valipy.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM ubuntu:xenial

RUN apt-get update && apt-get install -y
RUN apt-get install -y \
apt-utils \
apt-transport-https \
software-properties-common \
wget \
curl \
telnet \
sudo \
build-essential \
libffi-dev \
libssl-dev \
zlib1g-dev \
liblzma-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
git \
gnupg

# install python 3.9.5
#RUN apt-get install -y python3 python3-pip
RUN git clone https://github.com/pyenv/pyenv.git ~/.pyenv
RUN echo 'export PATH="$HOME"/.pyenv/bin:$PATH' >> ~/.rc
RUN . ~/.rc && pyenv install 3.9.5
RUN echo 'eval "$(pyenv init -)"' >> ~/.rc
RUN echo 'eval "$(pyenv init --path)"' >> ~/.rc
RUN cat ~/.rc >> ~/.bashrc
RUN . ~/.rc && pyenv global 3.9.5

# install libindy. reference: https://github.com/hyperledger/indy-sdk#ubuntu-based-distributions-ubuntu-1604-and-1804
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88
RUN add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial stable"
RUN apt-get update
RUN apt-get install -y libindy libnullpay libvcx indy-cli

# indy wrapper for python3
RUN . ~/.rc && pip install python3-indy

CMD [ "tail", "-f", "/dev/null" ]

0 comments on commit 599acc0

Please sign in to comment.