Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to stable #37

Open
wants to merge 8 commits into
base: stable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions StartIndyAgents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
Starting the Indy Agent Scripts on a Docker Indy Test Deployment
------

Once you have the Indy test nodes and client running, and before you run through the Indy tutorial script, you need to start the Indy Agents that represent the organizations in the scenario - Faber College, Acme Corp. and Thrift Bank. The steps to start the agents are outlined below.

## Open terminal and exec into the client docker container:
When you start up the Indy client for testing, you will be in a shell running the Indy CLI. Leave that command line as is (we'll return to it after these steps) and start up a new shell to carry out the series of steps here.

Within the new command line, log into the Indy Client docker container:

```docker exec -i -t sovrinclient bash```

### Start up Indy and carry out the next series of commands with Indy.

To start indy:

```indy```

Connect to the test network - the nodes that you are running on docker:

```connect test```

#### Create Steward

Create an initial Indy Steward for the test network. The Steward will be used to add the three organizations as Trust Anchors in the network.

_NOTE_: The commands in this script need to be copied and pasted exactly as specified here. There are many "magic strings" that must match exactly for the communication to work.

```new key with seed 000000000000000000000000Steward1```

#### Register the Faber Identity and Agent Endpoint

Create Faber College as an Identity and one that is a Trust Anchor.

```send NYM dest=ULtgFQJe6bjiFbs7ke3NJD role=TRUST_ANCHOR verkey=~5kh3FB4H3NKq7tUDqeqHc1```

NOTE: Be sure that the CLI responds with an "ADDED" response such as
```
Adding nym ULtgFQJe6bjiFbs7ke3NJD
Nym ULtgFQJe6bjiFbs7ke3NJD added
```

If you don't get the "ADDED" response then one of the Nodes may not have started and you likely have to restart the pool with the ./pool_start.sh command

```new key with seed Faber000000000000000000000000000```

In the next step to create the endpoint for the Faber Agent, we're using the IP address of the Indy client (10.0.0.6), and a unique port for the agent. If you used a different IP in starting up Indy, you need to replace your IP/Port in the following command:

```send ATTRIB dest=ULtgFQJe6bjiFbs7ke3NJD raw={"endpoint": {"ha": "10.0.0.6:5555", "pubkey": "5hmMA64DDQz5NzGJNVtRzNwpkZxktNQds21q3Wxxa62z"}}```

#### Register ACME Identity and Agent Endpoint
That's it for Faber...on to Acme. Before starting, we have to go back to using the Steward identity.

```use DID Th7MpTaRZVRYnPiabds81Y```

Once that's done, repeat the steps for Acme (with different parameters).

```send NYM dest=CzkavE58zgX7rUMrzSinLr role=TRUST_ANCHOR verkey=~WjXEvZ9xj4Tz9sLtzf7HVP```

```new key with seed Acme0000000000000000000000000000```

As with Faber, we're using the IP address of the Indy client (10.0.0.6), and a unique port for the agent in the next command. If you used different IPs in starting up Indy, you need to replace your IP/Port in the following command:

```send ATTRIB dest=CzkavE58zgX7rUMrzSinLr raw={"endpoint":{"ha": "10.0.0.6:6666", "pubkey": "C5eqjU7NMVMGGfGfx2ubvX5H9X346bQt5qeziVAo3naQ"}}```

#### Register Thrift Bank Identity and Agent Endpoint
And on to Thrift. Before starting, we have to go back to using the Steward identity.

```use DID Th7MpTaRZVRYnPiabds81Y```

Once that's done, repeat the steps, using different IDs.

```send NYM dest=H2aKRiDeq8aLZSydQMDbtf role=TRUST_ANCHOR verkey=~3sphzTb2itL2mwSeJ1Ji28```

```new key with seed Thrift00000000000000000000000000```

As with Faber and Acme, we're using the IP address of the Indy client (10.0.0.6), and a unique port for the agent in the next command. If you used different IPs in starting up Indy, you need to replace your IP/Port in the following command:

```send ATTRIB dest=H2aKRiDeq8aLZSydQMDbtf raw={"endpoint": {"ha": "10.0.0.6:7777", "pubkey":"AGBjYvyM3SFnoiDGAEzkSLHvqyzVkXeMZfKDvdpEsC2x"}}```

#### Indy steps complete - Exit
Exit from the Indy command line application, but stay in the bash shell in the docker container. To do that, just run at the 'indy' prompt:

```exit```

You should be back to the bash prompt within the indyclient container.

## Start the Indy Agents

We'll now invoke the Indy Agents from the same command line, redirecting the output to different files. We can then review the logs as commands are executed.

#### Invoke the clients
Use these commands to invoke each of the clients. Note the ports entered on the commands above for setting the endpoints are referenced below. If you used different ports above, adjust these commands below to match.

```python3 /usr/local/lib/python3.5/dist-packages/indy_client/test/agent/faber.py --port 5555 >faber.log &```

```python3 /usr/local/lib/python3.5/dist-packages/indy_client/test/agent/acme.py --port 6666 >acme.log &```

```python3 /usr/local/lib/python3.5/dist-packages/indy_client/test/agent/thrift.py --port 7777 >thrift.log &```

For those not familiar with Linux - the trailing "&" runs the command in the background.

If you want to monitor one of the logs while executing the rest of the tutorial, you can use a command such as:

```tail -f faber.log```

To stream the end of the (in the case) Faber College agent log. Ctrl-C to exit out of that.

That completes the process for starting the Agents. Leave this command line running while you complete the rest of the tutorial - the story of Alice, her transcripts, job, and banking - in the terminal window in which you ran the script to start the Indy Client. You should be at a "indy" prompt.

Note that when the indyclient container stops, the agents will stop automatically. That will happen when you "exit" from the indy command line in the other terminal window.
8 changes: 4 additions & 4 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ Defaults:
* IP address is the next in sequence of IP addresses read from pool data (e.g. 10.0.0.6)
* Number of clients is 10

Container is retained after sovrin shell is closed. Executing ```client_stop.sh``` removes the container.
Container is retained after indy shell is closed. Executing ```client_stop.sh``` removes the container.

# Start agents (optional)

If you are planning to run the Sovrin Tutorial (about Alice, her transcripts, job, and bank), start the organization Sovrin Agents using the instructions in [StartSovrinAgents.md](StartSovrinAgents.md) in this folder.
If you are planning to run the Indy Tutorial (about Alice, her transcripts, job, and bank), start the organization Indy Agents using the instructions in [StartSovrinAgents.md](StartSovrinAgents.md) in this folder.

# Stop pool
```
Expand All @@ -40,11 +40,11 @@ Defaults:
```
./client_stop.sh
```
Stopping the sovrin client removes the client container.
Stopping the indy client removes the client container.

# Running on Windows using git bash

Using the git bash shell is a productive command line for those familiar with Unix/Linux to run applications/environments on Windows. However, git bash can create problems with pathnames, and does so with this application. Specifcally, by default git bash converts absolute path names to a Windows equivalent path name (e.g. C:\\...), which is helpful if it is expected by an app, but not always - and rarely with Docker. In particular, [it's not helpful with Docker](https://github.com/moby/moby/issues/24029) volume mounting on docker run and build commands. The Sovrin test scripts - client_build.sh, node_build.sh, client_start.sh and node_start.sh are all affected by this. When just run, docker build/run commands error off with messages like:
Using the git bash shell is a productive command line for those familiar with Unix/Linux to run applications/environments on Windows. However, git bash can create problems with pathnames, and does so with this application. Specifcally, by default git bash converts absolute path names to a Windows equivalent path name (e.g. C:\\...), which is helpful if it is expected by an app, but not always - and rarely with Docker. In particular, [it's not helpful with Docker](https://github.com/moby/moby/issues/24029) volume mounting on docker run and build commands. The Indy test scripts - client_build.sh, node_build.sh, client_start.sh and node_start.sh are all affected by this. When just run, docker build/run commands error off with messages like:

```
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: invalid bind mount spec "/C/Program Files/Git/sys/fs/cgroup;C:\\Program Files\\Git\\sys\\fs\\cgroup;ro": invalid volume specification: '/C/Program Files/Git/sys/fs/cgroup;C:\Program Files\Git\sys\fs\cgroup;ro': invalid mount config for type "bind": invalid mount path: '\Program Files\Git\sys\fs\cgroup;ro' mount path must be absolute.
Expand Down
34 changes: 17 additions & 17 deletions docker/StartSovrinAgents.md → docker/StartIndyAgents.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
Starting the Sovrin Agent Scripts on a Docker Sovrin Test Deployment
Starting the Indy Agent Scripts on a Docker Indy Test Deployment
------

Once you have the Sovrin test nodes and client running, and before you run through the Sovrin tutorial script, you need to start the Sovrin Agents that represent the organizations in the scenario - Faber College, Acme Corp. and Thrift Bank. The steps to start the agents are outlined below.
Once you have the Indy test nodes and client running, and before you run through the Indy tutorial script, you need to start the Indy Agents that represent the organizations in the scenario - Faber College, Acme Corp. and Thrift Bank. The steps to start the agents are outlined below.

## Open terminal and exec into the client docker container:
When you start up the Sovrin client for testing, you will be in a shell running the Sovrin CLI. Leave that command line as is (we'll return to it after these steps) and start up a new shell to carry out the series of steps here.
When you start up the Indy client for testing, you will be in a shell running the Indy CLI. Leave that command line as is (we'll return to it after these steps) and start up a new shell to carry out the series of steps here.

Within the new command line, log into the Sovrin Client docker container:
Within the new command line, log into the Indy Client docker container:

```docker exec -i -t sovrinclient bash```

### Start up Sovrin and carry out the next series of commands with Sovrin.
### Start up Indy and carry out the next series of commands with Indy.

To start sovrin:
To start indy:

```sovrin```
```indy```

Connect to the test network - the nodes that you are running on docker:

```connect test```

#### Create Steward

Create an initial Sovrin Steward for the test network. The Steward will be used to add the three organizations as Trust Anchors in the network.
Create an initial Indy Steward for the test network. The Steward will be used to add the three organizations as Trust Anchors in the network.

_NOTE_: The commands in this script need to be copied and pasted exactly as specified here. There are many "magic strings" that must match exactly for the communication to work.

Expand All @@ -44,7 +44,7 @@ If you don't get the "ADDED" response then one of the Nodes may not have started

```new key with seed Faber000000000000000000000000000```

In the next step to create the endpoint for the Faber Agent, we're using the IP address of the Sovrin client (10.0.0.6), and a unique port for the agent. If you used a different IP in starting up Sovrin, you need to replace your IP/Port in the following command:
In the next step to create the endpoint for the Faber Agent, we're using the IP address of the Indy client (10.0.0.6), and a unique port for the agent. If you used a different IP in starting up Indy, you need to replace your IP/Port in the following command:

```send ATTRIB dest=ULtgFQJe6bjiFbs7ke3NJD raw={"endpoint": {"ha": "10.0.0.6:5555", "pubkey": "5hmMA64DDQz5NzGJNVtRzNwpkZxktNQds21q3Wxxa62z"}}```

Expand All @@ -59,7 +59,7 @@ Once that's done, repeat the steps for Acme (with different parameters).

```new key with seed Acme0000000000000000000000000000```

As with Faber, we're using the IP address of the Sovrin client (10.0.0.6), and a unique port for the agent in the next command. If you used different IPs in starting up Sovrin, you need to replace your IP/Port in the following command:
As with Faber, we're using the IP address of the Indy client (10.0.0.6), and a unique port for the agent in the next command. If you used different IPs in starting up Indy, you need to replace your IP/Port in the following command:

```send ATTRIB dest=CzkavE58zgX7rUMrzSinLr raw={"endpoint":{"ha": "10.0.0.6:6666", "pubkey": "C5eqjU7NMVMGGfGfx2ubvX5H9X346bQt5qeziVAo3naQ"}}```

Expand All @@ -74,20 +74,20 @@ Once that's done, repeat the steps, using different IDs.

```new key with seed Thrift00000000000000000000000000```

As with Faber and Acme, we're using the IP address of the Sovrin client (10.0.0.6), and a unique port for the agent in the next command. If you used different IPs in starting up Sovrin, you need to replace your IP/Port in the following command:
As with Faber and Acme, we're using the IP address of the Indy client (10.0.0.6), and a unique port for the agent in the next command. If you used different IPs in starting up Indy, you need to replace your IP/Port in the following command:

```send ATTRIB dest=H2aKRiDeq8aLZSydQMDbtf raw={"endpoint": {"ha": "10.0.0.6:7777", "pubkey":"AGBjYvyM3SFnoiDGAEzkSLHvqyzVkXeMZfKDvdpEsC2x"}}```

#### Sovrin steps complete - Exit
Exit from the Sovrin command line application, but stay in the bash shell in the docker container. To do that, just run at the 'sovrin' prompt:
#### Indy steps complete - Exit
Exit from the Indy command line application, but stay in the bash shell in the docker container. To do that, just run at the 'sovrin' prompt:

```exit```

You should be back to the bash prompt within the Sovrinclient container.
You should be back to the bash prompt within the Indy client container.

## Start the Sovrin Agents
## Start the Indy Agents

We'll now invoke the Sovrin Agents from the same command line, redirecting the output to different files. We can then review the logs as commands are executed.
We'll now invoke the Indy Agents from the same command line, redirecting the output to different files. We can then review the logs as commands are executed.

#### Invoke the clients
Use these commands to invoke each of the clients. Note the ports entered on the commands above for setting the endpoints are referenced below. If you used different ports above, adjust these commands below to match.
Expand All @@ -106,6 +106,6 @@ If you want to monitor one of the logs while executing the rest of the tutorial,

To stream the end of the (in the case) Faber College agent log. Ctrl-C to exit out of that.

That completes the process for starting the Agents. Leave this command line running while you complete the rest of the tutorial - the story of Alice, her transcripts, job, and banking - in the terminal window in which you ran the script to start the Sovrin Client. You should be at a "sovrin" prompt.
That completes the process for starting the Agents. Leave this command line running while you complete the rest of the tutorial - the story of Alice, her transcripts, job, and banking - in the terminal window in which you ran the script to start the Indy Client. You should be at a "sovrin" prompt.

Note that when the sovrinclient container stops, the agents will stop automatically. That will happen when you "exit" from the sovrin command line in the other terminal window.
2 changes: 1 addition & 1 deletion docker/client.ubuntu.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ ARG clicnt=10
EXPOSE 5000-9799
USER sovrin
# Init pool data
RUN if [ ! -z "$ips" ] && [ ! -z "$nodecnt" ]; then generate_sovrin_pool_transactions --nodes $nodecnt --clients $clicnt --ips "$ips"; fi
RUN if [ ! -z "$ips" ] && [ ! -z "$nodecnt" ]; then generate_indy_pool_transactions --nodes $nodecnt --clients $clicnt --ips "$ips"; fi
CMD /bin/bash
2 changes: 1 addition & 1 deletion docker/client_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ echo "Starting container $IMAGE_NAME at $IP"
docker run -itd --rm --memory="1512m" --name=$IMAGE_NAME --ip="${IP}" --network=$POOL_NETWORK_NAME --security-opt seccomp=unconfined --tmpfs /run --tmpfs /run/lock -v /sys/fs/cgroup:/sys/fs/cgroup:ro $IMAGE_NAME

echo "Starting sovrin client"
docker exec -it $IMAGE_NAME sovrin
docker exec -it $IMAGE_NAME indy
11 changes: 9 additions & 2 deletions docker/node.init.ubuntu.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ ARG nodecnt
ARG clicnt=10

# Init sovrin-node
RUN init_sovrin_node $nodename $nport $cport


USER indy
RUN mkdir -p /home/indy
RUN mkdir -p /home/indy/.indy
RUN chown indy:indy /home/indy -R
RUN init_indy_node $nodename $nport $cport
EXPOSE $nport $cport
RUN if [ ! -z "$ips" ] && [ ! -z "$nodenum" ] && [ ! -z "$nodecnt" ]; then generate_sovrin_pool_transactions --nodes $nodecnt --clients $clicnt --nodeNum $nodenum --ips "$ips"; fi
RUN if [ ! -z "$ips" ] && [ ! -z "$nodenum" ] && [ ! -z "$nodecnt" ]; then generate_indy_pool_transactions --nodes $nodecnt --clients $clicnt --nodeNum $nodenum --ips "$ips"; fi
USER root
CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"]
#CMD ["/bin/bash"]
2 changes: 1 addition & 1 deletion docker/node_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ fi

echo "Starting node $IMAGE_NAME $NODE_IP"
docker run -td -p $NODE_PORT:$NODE_PORT -p $CLI_PORT:$CLI_PORT --memory="1512m" --name=$IMAGE_NAME --ip="${NODE_IP}" --network=$POOL_NETWORK_NAME --security-opt seccomp=unconfined --tmpfs /run --tmpfs /run/lock -v /sys/fs/cgroup:/sys/fs/cgroup:ro $IMAGE_NAME
docker exec -td $IMAGE_NAME systemctl start sovrin-node
docker exec -td $IMAGE_NAME systemctl start indy-node
echo "Node $IMAGE_NAME started on $NODE_IP"