Skip to content

Commit

Permalink
[FAB-3161] Enhance cluster-creation reporting
Browse files Browse the repository at this point in the history
It will likely be helpful to the user to display a more
obvious "success" message along with key details about
the created cluster (such as IP addresses).

This patch adds the following report:
========================================================================
Cluster ready!
========================================================================

172.18.0.2 ca
172.18.0.3 orderer
172.18.0.4 peer1
172.18.0.5 peer2
172.18.0.6 peer3
172.18.0.7 peer4

Change-Id: I8228b0d439ec5bd71f5ddb0774888b02b978955a
Signed-off-by: Gregory Haskins <gregory.haskins@gmail.com>
  • Loading branch information
ghaskins committed May 4, 2017
1 parent 31bce9c commit 6663dc0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/cluster/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ help:
@cat usage.txt

compose-up: nodes
@echo "Booting docker-compose environment"
$(COMPOSE) up -d ca $(PEERS)
$(DRUN) ./configure.sh $(CHANNEL_NAME) "$(CHANNEL_TXNS)" "$(PEERS)" $(TLS)
@./compose/report-env.sh "$(filter-out cli,$(NODES)")

compose-down:
$(COMPOSE) down
Expand Down
21 changes: 21 additions & 0 deletions examples/cluster/compose/report-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

NODES=$1

getip() {
HOST=$1

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $HOST
}

generate_hosts() {
for NODE in $NODES; do
echo "$(getip $NODE) $NODE"
done
}

echo "========================================================================"
echo "Cluster ready!"
echo "========================================================================"
echo
generate_hosts | sort

0 comments on commit 6663dc0

Please sign in to comment.