Skip to content

Commit

Permalink
restore support for indy-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewwhitehead committed Sep 11, 2018
1 parent a6d0128 commit 7445f6d
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 158 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM bcgovimages/von-image:py35-1.6-1
FROM bcgovimages/von-image:py35-1.6-3

ADD --chown=indy:indy indy_config.py /etc/indy/

Expand Down
45 changes: 7 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A **Quick Start Guide** for a working set of applications is maintained here; [R

1. First, install Docker. Download the installer for your operating system [here](https://store.docker.com/search?type=edition&offering=community). Once it is installed, keep the Docker daemon running in the background.

2. Linux users will also need to [install docker-compose](https://github.com/docker/compose/releases). Mac and Windows users will have this already.
2. Linux users will also need to [install docker-compose](https://github.com/docker/compose/releases). Mac and Windows users will have this already.

3. Once Docker has been installed, open a terminal session and clone this repository:

Expand Down Expand Up @@ -63,7 +63,7 @@ Run 4 extra VMs as proxies (proxy_1, proxy_2, proxy_3, proxy4). Traffic should b
1. Install unzip utility:

```bash
# Requires root privileges
# Requires root privileges
apt install unzip
```

Expand All @@ -74,7 +74,7 @@ curl -fsSL get.docker.com -o get-docker.sh
```

```bash
# Requires root privileges
# Requires root privileges
sh get-docker.sh
```

Expand Down Expand Up @@ -124,7 +124,7 @@ to
./manage start proxy_1,proxy_2,proxy_3,proxy_4 &
```

## Connecting to the Network
## Connecting to the Network

### With the CLI
Once the nodes are all running and have connected to each other, you can run the Indy client to test the connection in a separate terminal window:
Expand Down Expand Up @@ -152,45 +152,14 @@ indy>
Now connect to our new Indy network to make sure network is running correctly:

```
connect sandbox
pool connect sandbox
```

What you should see is:

```
indy> connect sandbox
New wallet Default created
Active wallet set to "Default"
Active wallet set to "Default"
Client indy9f7060 initialized with the following node registry:
Node1C listens at 172.21.0.2 on port 9702
Node2C listens at 172.21.0.5 on port 9704
Node3C listens at 172.21.0.3 on port 9706
Node4C listens at 172.21.0.4 on port 9708
Active client set to indy9f7060
CONNECTION: iSLwBzaiCrnG5LBv4MmM18TGwY8RNquYwMMx2az6BNQ listening for other nodes at 0.0.0.0:6001
CONNECTION: iSLwBzaiCrnG5LBv4MmM18TGwY8RNquYwMMx2az6BNQ looking for Node1C at 172.21.0.2:9702
CONNECTION: iSLwBzaiCrnG5LBv4MmM18TGwY8RNquYwMMx2az6BNQ looking for Node2C at 172.21.0.5:9704
CONNECTION: iSLwBzaiCrnG5LBv4MmM18TGwY8RNquYwMMx2az6BNQ looking for Node3C at 172.21.0.3:9706
CONNECTION: iSLwBzaiCrnG5LBv4MmM18TGwY8RNquYwMMx2az6BNQ looking for Node4C at 172.21.0.4:9708
Connecting to test...
CONNECTION: iSLwBzaiCrnG5LBv4MmM18TGwY8RNquYwMMx2az6BNQ now connected to Node1C
CONNECTION: iSLwBzaiCrnG5LBv4MmM18TGwY8RNquYwMMx2az6BNQ now connected to Node2C
CONNECTION: iSLwBzaiCrnG5LBv4MmM18TGwY8RNquYwMMx2az6BNQ now connected to Node3C
CONNECTION: iSLwBzaiCrnG5LBv4MmM18TGwY8RNquYwMMx2az6BNQ now connected to Node4C
CATCH-UP: iSLwBzaiCrnG5LBv4MmM18TGwY8RNquYwMMx2az6BNQ completed catching up ledger 0, caught up 0 in total
Connected to test.
```

**Specifically**:

```
CONNECTION: iSLwBzaiCrnG5LBv4MmM18TGwY8RNquYwMMx2az6BNQ now connected to Node1C
CONNECTION: iSLwBzaiCrnG5LBv4MmM18TGwY8RNquYwMMx2az6BNQ now connected to Node2C
CONNECTION: iSLwBzaiCrnG5LBv4MmM18TGwY8RNquYwMMx2az6BNQ now connected to Node3C
CONNECTION: iSLwBzaiCrnG5LBv4MmM18TGwY8RNquYwMMx2az6BNQ now connected to Node4C
...
Connected to test.
indy> pool connect sandbox
Pool "sandbox" has been connected
```

If you see this, congratulations! Your nodes are running correctly and you have a connection to the network.
Expand Down
139 changes: 44 additions & 95 deletions bin/von_generate_transactions
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,39 @@ if [ ! -z "$nodeNum" ]; then
fi

if [ ! -z $ipAddresses ]; then
echo -e \\n\\n"================================================================================================"
echo -e "Generating genesis transaction file:"
echo -e "nodeArg: ${nodeArg}"
echo -e "ipAddresses: ${ipAddresses}"
echo -e "genesisFileTemplatePath: ${genesisFileTemplatePath}"
echo -e "genesisFilePath: ${genesisFilePath}"
echo -e "------------------------------------------------------------------------------------------------"
# Use supplied IP address
echo -e generate_indy_pool_transactions \
--nodes 4 \
--clients 0 \
$nodeArg \
--ips "$ipAddresses" \
\\n

generate_indy_pool_transactions \
--nodes 4 \
--clients 0 \
$nodeArg \
--ips "$ipAddresses"

echo -e \\n"------------------------------------------------------------------------------------------------"
echo -e "Generated genesis transaction file; ${genesisFileTemplatePath}"\\n
cat ${genesisFileTemplatePath}
ipsArg="$ipAddresses"
elif [ ! -z $ipAddress ]; then
ipsArg="$ipAddress","$ipAddress","$ipAddress","$ipAddress"
else
ipsArg="$DOCKERHOST","$DOCKERHOST","$DOCKERHOST","$DOCKERHOST"
fi

echo -e \\n\\n"================================================================================================"
echo -e "Generating genesis transaction file:"
echo -e "nodeArg: ${nodeArg}"
echo -e "ipAddresses: ${ipsArg}"
echo -e "genesisFileTemplatePath: ${genesisFileTemplatePath}"
echo -e "genesisFilePath: ${genesisFilePath}"
echo -e "------------------------------------------------------------------------------------------------"
# Use supplied IP address
echo -e generate_indy_pool_transactions \
--nodes 4 \
--clients 0 \
$nodeArg \
--ips "$ipsArg" \
\\n

generate_indy_pool_transactions \
--nodes 4 \
--clients 0 \
$nodeArg \
--ips "$ipsArg"

echo -e \\n"------------------------------------------------------------------------------------------------"
echo -e "Generated genesis transaction file; ${genesisFileTemplatePath}"\\n
cat ${genesisFileTemplatePath}

if [ ! -z "$remapPorts" ]; then
echo -e \\n"------------------------------------------------------------------------------------------------"
echo -e "Changing ports:"
echo -e "- client_port => 80"
Expand All @@ -102,78 +110,19 @@ if [ ! -z $ipAddresses ]; then
mv ${genesisFileTemplatePath} ${genesisFileTemplateBackupPath}
echo -e "cat ${genesisFileTemplateBackupPath} | sed 's~\(\"client_port\":\).\{4\}\(,\)~\180\2~g' | sed 's~\(\"node_port\":\).\{4\}\(,\)~\19418\2~g' > ${genesisFileTemplatePath}"
cat ${genesisFileTemplateBackupPath} | sed 's~\(\"client_port\":\).\{4\}\(,\)~\180\2~g' | sed 's~\(\"node_port\":\).\{4\}\(,\)~\19418\2~g' > ${genesisFileTemplatePath}
fi

echo -e \\n"------------------------------------------------------------------------------------------------"
echo -e "Initial state of ${genesisFilePath}"\\n
cat ${genesisFilePath}

echo -e \\n"------------------------------------------------------------------------------------------------"
echo -e "Overwriting ..."
echo -e "cat ${genesisFileTemplatePath} > ${genesisFilePath}"
cat ${genesisFileTemplatePath} > ${genesisFilePath}

echo -e \\n"------------------------------------------------------------------------------------------------"
echo -e "Final genesis transaction file; ${genesisFilePath}"\\n
cat ${genesisFilePath}
echo -e "================================================================================================"
elif [ ! -z $ipAddress ]; then
echo -e \\n\\n"================================================================================================"
echo -e "Generating genesis transaction file:"
echo -e "nodeArg: ${nodeArg}"
echo -e "ipAddress: ${ipAddress}"
echo -e "genesisFileTemplatePath: ${genesisFileTemplatePath}"
echo -e "genesisFilePath: ${genesisFilePath}"
echo -e "------------------------------------------------------------------------------------------------"
# Use supplied IP address
echo -e generate_indy_pool_transactions \
--nodes 4 \
--clients 0 \
$nodeArg \
--ips "$ipAddress","$ipAddress","$ipAddress","$ipAddress" \
\\n

generate_indy_pool_transactions \
--nodes 4 \
--clients 0 \
$nodeArg \
--ips "$ipAddress","$ipAddress","$ipAddress","$ipAddress"

echo -e \\n"------------------------------------------------------------------------------------------------"
echo -e "Generated genesis transaction file; ${genesisFileTemplatePath}"\\n
cat ${genesisFileTemplatePath}
#echo -e \\n"------------------------------------------------------------------------------------------------"
#echo -e "Initial state of ${genesisFilePath}"\\n
#cat ${genesisFilePath}

echo -e \\n"------------------------------------------------------------------------------------------------"
echo -e "Final genesis transaction file; ${genesisFilePath}"\\n
cat ${genesisFilePath}
echo -e "================================================================================================"
else
echo -e \\n\\n"================================================================================================"
echo -e "Generating genesis transaction file:"
echo -e "nodeArg: ${nodeArg}"
echo -e "DOCKERHOST: ${DOCKERHOST}"
echo -e "genesisFileTemplatePath: ${genesisFileTemplatePath}"
echo -e "genesisFilePath: ${genesisFilePath}"
echo -e "------------------------------------------------------------------------------------------------"
# If we don't explicitely set IP, then use host machine's loopback interface
echo -e generate_indy_pool_transactions \
--nodes 4 \
--clients 0 \
$nodeArg \
--ips "$DOCKERHOST","$DOCKERHOST","$DOCKERHOST","$DOCKERHOST" \
\\n

generate_indy_pool_transactions \
--nodes 4 \
--clients 0 \
$nodeArg \
--ips "$DOCKERHOST","$DOCKERHOST","$DOCKERHOST","$DOCKERHOST"
#echo -e \\n"------------------------------------------------------------------------------------------------"
#echo -e "Overwriting ..."
#echo -e "cat ${genesisFileTemplatePath} > ${genesisFilePath}"
#cat ${genesisFileTemplatePath} > ${genesisFilePath}

echo -e \\n"------------------------------------------------------------------------------------------------"
echo -e "Generated genesis transaction file; ${genesisFileTemplatePath}"\\n
cat ${genesisFileTemplatePath}
#echo -e \\n"------------------------------------------------------------------------------------------------"
#echo -e "Final genesis transaction file; ${genesisFilePath}"\\n
#cat ${genesisFilePath}

echo -e \\n"------------------------------------------------------------------------------------------------"
echo -e "Final genesis transaction file; ${genesisFilePath}"\\n
cat ${genesisFilePath}
echo -e "================================================================================================"
fi
echo -e "================================================================================================"\\n
41 changes: 18 additions & 23 deletions manage
Original file line number Diff line number Diff line change
Expand Up @@ -56,46 +56,41 @@ deleteVolumes() {
fi
}
# =================================================================================================================
initEnv() {
export RUST_LOG=${RUST_LOG:-warning}
IP=""
IPS=""
if [[ $1 == *","* ]]; then
IPS="$1"
else
IP="$1"
fi
export IP="$IP" IPS="$IPS"
}

pushd ${SCRIPT_HOME} >/dev/null

case "$1" in
start)
export RUST_LOG=${RUST_LOG:-warning}
if [ -z "$2" ]; then
docker-compose up webserver node1 node2 node3 node4
else
if [[ $2 == *","* ]]; then
# If arg contains comma, then it should be multiple IPS
IPS=$2 docker-compose up webserver node1 node2 node3 node4
else
IP=$2 docker-compose up webserver node1 node2 node3 node4
fi
fi
initEnv "$2"
docker-compose up webserver node1 node2 node3 node4
;;
cli)
if [ -z "$2" ]; then
docker-compose run client
else
docker-compose run -e IP="$2" client
fi
initEnv "$2"
docker-compose run client
;;
stop)
initEnv
docker-compose stop
;;
build)
docker build -t von-network-base .
;;
rebuild)
docker-compose build --no-cache
docker-compose build -t von-network-base --no-cache
;;
rm)
# =========================================================
# Suppress unnecessary messages
# ---------------------------------------------------------
export IP=0.0.0.0
export IPS=0.0.0.0
# =========================================================
initEnv
deleteVolumes
;;
*)
Expand Down
4 changes: 3 additions & 1 deletion scripts/start_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ else
von_generate_transactions
fi

mkdir -p .indy_client/pool/sandbox
cp .indy-cli/networks/sandbox/pool_transactions_genesis .indy_client/pool/sandbox/sandbox.txn

indy
indy-cli

0 comments on commit 7445f6d

Please sign in to comment.