• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revisionb49aa55f8f97cf92ae135295301dc90cfe131f21 (tree)
Time2019-06-21 13:36:18
Authorapolloww <32606824+apolloww@user...>
CommiterPaladz

Log Message

vapord docker: add missing options to deploy script (#216)

Change Summary

Incremental Difference

--- a/docker/vapord/README.md
+++ b/docker/vapord/README.md
@@ -1,59 +1,61 @@
11 # quick start
22
3-execute deploy.sh at the root of vapor repo
3+execute ./docker/vapord/deploy.sh from the root of vapor repo.
44
5-## usage
5+every vapord image has a unique public key, always create only one instance per image, otherwise you would end up with multiple nodes with same public key.
6+
7+## print usage
68
79 ```bash
8-bash deploy.sh --help
10+bash ./docker/vapord/deploy.sh --help
911 ```
1012
11-## build and run a 2-node vapor nodes
13+## build and run 2 vapor nodes
1214
1315 ```bash
14-bash deploy.sh --scale=2
16+bash ./docker/vapord/deploy.sh --scale=2
1517 ```
1618
1719 ## list available node images and public keys
1820
1921 ```bash
20-bash deploy.sh --list
22+bash ./docker/vapord/deploy.sh --list
2123 ```
2224
2325 ## remove all node images
2426
2527 ```bash
26-bash deploy.sh --rm-all
28+bash ./docker/vapord/deploy.sh --rm-all
2729 ```
2830
29-## remove 2 images
31+## remove 2 node images
3032
3133 ```bash
32-bash deploy.sh --rm=vapord_test-ade32,vapord_test-342de
34+bash ./docker/vapord/deploy.sh --rm=vapord_test-ade32,vapord_test-342de
3335 ```
3436
35-## build 2 vapord images (build only)
37+## build 2 node images (build only)
3638
3739 ```bash
38-bash deploy.sh --build=2
40+bash ./docker/vapord/deploy.sh --build=2
3941 ```
4042
41-## run 2 vapor nodes from existing images
43+## run 2 vapor nodes instances from existing images
4244
4345 ```bash
44-bash deploy.sh --run=vapord_test-ade32,vapord_test-342de
46+bash ./docker/vapord/deploy.sh --run=vapord_test-ade32,vapord_test-342de
4547 ```
4648
47-## run vapor node from all existing images
49+## run vapor node instances from all existing images
4850
4951 ```bash
50-bash deploy.sh --run-all
52+bash ./docker/vapord/deploy.sh --run-all
5153 ```
5254
53-## bring down running nodes
55+## bring down running node instances
5456
5557 ```bash
56-bash deploy.sh --down
58+bash ./docker/vapord/deploy.sh --down
5759 ```
5860
5961 ## node naming
@@ -64,3 +66,7 @@ bash deploy.sh --down
6466 * wallet port : start from 9889, and increases by 1 every time a new node image is created.
6567 * log location: ~/vapord/log/${node_name}
6668 * docker-compose.yml location: ~/vapord/docker-compose.yml
69+
70+## customize
71+
72+* config.toml and federation.json are provided for reference only. They should be modified for your own test env.
--- a/docker/vapord/deploy.sh
+++ b/docker/vapord/deploy.sh
@@ -6,7 +6,7 @@ usage() {
66 cat << EOF
77 bash deploy.sh operation [options]
88 operation
9- --build=num : build node images
9+ --build=num : build node images only
1010
1111 --run=image1,image2,...: run selected node images
1212
@@ -49,59 +49,56 @@ WALLET_PORT_BEGIN=9889
4949 scale=1
5050 # operation: build, run, run-all, all, list, remove, remove-all help
5151 op="all"
52-op_arg="vapord_test-2951a1"
5352
54-# Call getopt to validate the provided input.
55-options=$(getopt -o brg --long build:run:run-all:list:rm:rm-all:scale:help:down -- "$@")
56-[ $? -eq 0 ] || {
57- echo "Incorrect options provided"
58- exit 1
59-}
60-
61-eval set -- "$options"
62-while true; do
63- case "$1" in
64- --build)
65- shift;
53+for i in "$@"
54+do
55+case $i in
56+ --scale=*)
57+ op="all"
58+ scale="${i#*=}"
59+ shift # past argument=value
60+ ;;
61+ --build=*)
6662 op="build"
67- scale=$1
63+ scale="${i#*=}"
64+ shift # past argument=value
6865 ;;
69- --run)
70- shift;
66+ --run=*)
7167 op="run"
72- op_arg=$1
68+ op_arg="${i#*=}"
69+ shift # past argument=value
7370 ;;
7471 --run-all)
7572 op="run-all"
73+ shift
7674 ;;
77- --list)
78- op="list"
79- ;;
80- --rm)
81- shift;
75+ --rm=*)
8276 op="remove"
83- op_arg=$1
77+ op_arg="${i#*=}"
78+ shift # past argument=value
8479 ;;
8580 --rm-all)
8681 op="remove-all"
82+ shift
8783 ;;
88- --scale)
89- shift; # The arg is next in position args
90- op="all"
91- scale=$1
92- ;;
93- --help)
94- op="help"
84+ --list)
85+ op="list"
86+ shift
9587 ;;
9688 --down)
9789 op="down"
98- ;;
99- --)
10090 shift
101- break
10291 ;;
103- esac
104- shift
92+ --help)
93+ op="help"
94+ shift # past argument with no value
95+ ;;
96+ *)
97+ echo "unknown option $i"
98+ usage
99+ exit 1
100+ ;;
101+esac
105102 done
106103
107104 echo "options: scale:${scale}, op:${op} op_arg:${op_arg}"
@@ -157,7 +154,7 @@ if [ "${op}" == "list" ]; then
157154 echo -e "${GREEN}list all node images${NC}"
158155 docker images --filter=reference="${IMG_PREFIX}-*:*"
159156 echo
160- echo "public keys"
157+ printf "${CYAN}image name\t\tpublic key${NC}\n"
161158 img_array=(`docker images --filter=reference="${IMG_PREFIX}-*:*" --format "{{.Repository}}"`)
162159 for img in "${img_array[@]}"; do
163160 pubkey=$( get_pubkey ${img} )
@@ -235,7 +232,7 @@ elif [ "${op}" == "run-all" ]; then
235232 done
236233 fi
237234
238-echo -e "image/node/pkey"
235+printf "${CYAN}image name\t\tnode name\tpublic key${NC}\n"
239236
240237 for id in "${!img_array[@]}"; do
241238 node=${node_array[id]}
--- a/docker/vapord/vapord.Dockerfile
+++ b/docker/vapord/vapord.Dockerfile
@@ -1,15 +1,15 @@
1-FROM registry.cn-hangzhou.aliyuncs.com/matpool/golang-gcc-gpp:1.11.2 as builder
1+FROM bytom/golang-gcc-gpp:1.11.2 as builder
22 LABEL stage=vapord_builder
33 WORKDIR /go/src/github.com/vapor
44 COPY . .
5-RUN go build -o /usr/local/vapord/vapord ./cmd/bytomd/main.go
5+RUN go build -o /usr/local/vapord/vapord ./cmd/vapord/main.go
66 # save node public key in /usr/local/vapord/node_pubkey.txt
77 RUN /usr/local/vapord/vapord init --chain_id vapor -r /usr/local/vapord 2>&1 | grep -o 'pubkey=[a-z0-9]*' | cut -d'=' -f 2 > /usr/local/vapord/node_pubkey.txt
88 COPY ./docker/vapord/config.toml /usr/local/vapord/config.toml
99 COPY ./docker/vapord/federation.json /usr/local/vapord/federation.json
1010
1111 ###
12-FROM registry.cn-hangzhou.aliyuncs.com/matpool/alpine-ca-supervisord:latest
12+FROM bytom/alpine-ca-supervisord:latest
1313 COPY ./docker/vapord/supervisord.conf /etc/supervisor/conf.d/vapord.conf
1414 COPY --from=builder /usr/local/vapord /usr/local/vapord
1515 RUN mkdir -p /var/log/vapord
Show on old repository browser