Skip to content

Instantly share code, notes, and snippets.

@nuxibyte
Last active January 21, 2018 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuxibyte/208326d6f7910a4fe2089fa515855411 to your computer and use it in GitHub Desktop.
Save nuxibyte/208326d6f7910a4fe2089fa515855411 to your computer and use it in GitHub Desktop.
How to set up an indy-node cluster using docker for the walkthrough.

Create docker image & start a container

Create a folder to store the dockerfile

$ mkdir my-indy-node

Change in to folder

$ cd my-indy-node 

Download, copy or create the Dockerfile in the folder

Build docker image and tag it with 'my-indy-node'

$ docker build -t my-indy-node .

Start a named docker container with an interactive shell

$ docker run -it --name my-indy-node my-indy-node

Setup & run indy-node cluster

You will need 8 terminal windows.

  • 1 terminal for running commands and later interacting with the cluster via indy cli.
  • 4 terminals for running the 4 nodes (Node1, Node2, Node2 and Node4).
  • 3 terminals for running the 3 agents (Faber, Acme and Thrift).

These notes are a summary of what is listed here.

Please refer to the original page for more info.

Terminal 1

Create terminal (on the host)

$ docker exec -it my-indy-node bash

Create nodes and generate initial transactions (in the terminal)

# generate_indy_pool_transactions --nodes 4 --clients 5 --nodeNum 1 2 3 4

Terminal 2

Create terminal (on the host)

$ docker exec -it my-indy-node bash

Start Node (in the terminal)

# start_indy_node Node1 9701 9702

Terminal 3

Create terminal (on the host)

$ docker exec -it my-indy-node bash

Start node (in the terminal)

# start_indy_node Node2 9703 9704

Terminal 4

Create terminal (on the host)

$ docker exec -it my-indy-node bash

Start node (in the terminal)

# start_indy_node Node3 9705 9706

Terminal 5

Create terminal (on the host)

$ docker exec -it my-indy-node bash

Start node (in the terminal)

# start_indy_node Node4 9707 9708

Terminal 1 (continued)

# indy
# new key with seed 000000000000000000000000Steward1
# connect sandbox
# send NYM dest=ULtgFQJe6bjiFbs7ke3NJD role=TRUST_ANCHOR verkey=~5kh3FB4H3NKq7tUDqeqHc1
# send NYM dest=CzkavE58zgX7rUMrzSinLr role=TRUST_ANCHOR verkey=~WjXEvZ9xj4Tz9sLtzf7HVP
# send NYM dest=H2aKRiDeq8aLZSydQMDbtf role=TRUST_ANCHOR verkey=~3sphzTb2itL2mwSeJ1Ji28
# new key with seed Faber000000000000000000000000000
# send ATTRIB dest=ULtgFQJe6bjiFbs7ke3NJD raw={"endpoint": {"ha": "127.0.0.1:5555", "pubkey": "5hmMA64DDQz5NzGJNVtRzNwpkZxktNQds21q3Wxxa62z"}}
# new key with seed Acme0000000000000000000000000000
# send ATTRIB dest=CzkavE58zgX7rUMrzSinLr raw={"endpoint": {"ha": "127.0.0.1:6666", "pubkey": "C5eqjU7NMVMGGfGfx2ubvX5H9X346bQt5qeziVAo3naQ"}}
# new key with seed Thrift00000000000000000000000000
# send ATTRIB dest=H2aKRiDeq8aLZSydQMDbtf raw={"endpoint": {"ha": "127.0.0.1:7777", "pubkey": "AGBjYvyM3SFnoiDGAEzkSLHvqyzVkXeMZfKDvdpEsC2x"}}

Terminal 6

Create terminal (on the host)

$ docker exec -it my-indy-node bash

Start agent (in the terminal)

# python3 /usr/local/lib/python3.5/dist-packages/indy_client/test/agent/faber.py --port 5555

Terminal 7

Create terminal (on the host)

$ docker exec -it my-indy-node bash

Start agent (in the terminal)

# python3 /usr/local/lib/python3.5/dist-packages/indy_client/test/agent/acme.py --port 6666

Terminal 8

Create terminal (on the host)

$ docker exec -it my-indy-node bash

Start agent (in the terminal)

$ python3 /usr/local/lib/python3.5/dist-packages/indy_client/test/agent/thrift.py --port 7777

You should now be ready to run through the walkthrough in Terminal 1 with all other terminals logging their output.

FROM ubuntu:16.04
ARG DEBIAN_FRONTEND=noninteractive
####################
## Python
####################
# Config apt
# Update apt
RUN apt-get update
# Install packages
RUN apt-get install -y apt-transport-https
RUN apt-get install -y software-properties-common
RUN apt-get install -y python-software-properties
RUN apt-get install -y python3.5
RUN apt-get install -y python3-pip
RUN apt-get install -y python3.5-dev
####################
## Apt
####################
# Config apt
RUN add-apt-repository -y ppa:deadsnakes/ppa
# Update apt
RUN apt-get update
# Install packages
RUN apt-get install -y ca-certificates
####################
## Libs
####################
# Config apt
RUN add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu xenial main universe"
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88
RUN add-apt-repository "deb https://repo.sovrin.org/deb xenial master"
RUN add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial stable"
# Update apt
RUN apt-get update
# Install packages
RUN apt-get install -y libsodium18
RUN apt-get install -y python3-charm-crypto
RUN apt-get install -y libindy
RUN apt-get install -y libindy-crypto
####################
## Indy
####################
# Config apt
# Update apt
RUN apt-get update
# Install packages
RUN apt-get install -y indy-node
@dwjohnston
Copy link

dwjohnston commented Jan 10, 2018

On line 12 you need:

RUN apt-get update && apt-get install -y apt-transport-https

to solve this issue:
https://stackoverflow.com/questions/38002543/apt-get-update-returned-a-non-zero-code-100

@dwjohnston
Copy link

You have a typo on Terminal 5 - that should be 9707 9708

@dwjohnston
Copy link

Very good tutorial btw - I really appreciate this.

@nuxibyte
Copy link
Author

@dwjohnston Thanks for the catches. Updated now. Glad it helped.

@nuxibyte
Copy link
Author

nuxibyte commented Jan 21, 2018

@dwjohnston
Moved RUN apt-get install -y apt-transport-https to line 14 to keep commands on separate lines.
Hopefully this is the equivalent.
Untested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment