# quick start
-execute deploy.sh at the root of vapor repo
+execute ./docker/vapord/deploy.sh from the root of vapor repo.
-## usage
+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.
+
+## print usage
```bash
-bash deploy.sh --help
+bash ./docker/vapord/deploy.sh --help
```
-## build and run a 2-node vapor nodes
+## build and run 2 vapor nodes
```bash
-bash deploy.sh --scale=2
+bash ./docker/vapord/deploy.sh --scale=2
```
## list available node images and public keys
```bash
-bash deploy.sh --list
+bash ./docker/vapord/deploy.sh --list
```
## remove all node images
```bash
-bash deploy.sh --rm-all
+bash ./docker/vapord/deploy.sh --rm-all
```
-## remove 2 images
+## remove 2 node images
```bash
-bash deploy.sh --rm=vapord_test-ade32,vapord_test-342de
+bash ./docker/vapord/deploy.sh --rm=vapord_test-ade32,vapord_test-342de
```
-## build 2 vapord images (build only)
+## build 2 node images (build only)
```bash
-bash deploy.sh --build=2
+bash ./docker/vapord/deploy.sh --build=2
```
-## run 2 vapor nodes from existing images
+## run 2 vapor nodes instances from existing images
```bash
-bash deploy.sh --run=vapord_test-ade32,vapord_test-342de
+bash ./docker/vapord/deploy.sh --run=vapord_test-ade32,vapord_test-342de
```
-## run vapor node from all existing images
+## run vapor node instances from all existing images
```bash
-bash deploy.sh --run-all
+bash ./docker/vapord/deploy.sh --run-all
```
-## bring down running nodes
+## bring down running node instances
```bash
-bash deploy.sh --down
+bash ./docker/vapord/deploy.sh --down
```
## node naming
* wallet port : start from 9889, and increases by 1 every time a new node image is created.
* log location: ~/vapord/log/${node_name}
* docker-compose.yml location: ~/vapord/docker-compose.yml
+
+## customize
+
+* config.toml and federation.json are provided for reference only. They should be modified for your own test env.
cat << EOF
bash deploy.sh operation [options]
operation
- --build=num : build node images
+ --build=num : build node images only
--run=image1,image2,...: run selected node images
scale=1
# operation: build, run, run-all, all, list, remove, remove-all help
op="all"
-op_arg="vapord_test-2951a1"
-# Call getopt to validate the provided input.
-options=$(getopt -o brg --long build:run:run-all:list:rm:rm-all:scale:help:down -- "$@")
-[ $? -eq 0 ] || {
- echo "Incorrect options provided"
- exit 1
-}
-
-eval set -- "$options"
-while true; do
- case "$1" in
- --build)
- shift;
+for i in "$@"
+do
+case $i in
+ --scale=*)
+ op="all"
+ scale="${i#*=}"
+ shift # past argument=value
+ ;;
+ --build=*)
op="build"
- scale=$1
+ scale="${i#*=}"
+ shift # past argument=value
;;
- --run)
- shift;
+ --run=*)
op="run"
- op_arg=$1
+ op_arg="${i#*=}"
+ shift # past argument=value
;;
--run-all)
op="run-all"
+ shift
;;
- --list)
- op="list"
- ;;
- --rm)
- shift;
+ --rm=*)
op="remove"
- op_arg=$1
+ op_arg="${i#*=}"
+ shift # past argument=value
;;
--rm-all)
op="remove-all"
+ shift
;;
- --scale)
- shift; # The arg is next in position args
- op="all"
- scale=$1
- ;;
- --help)
- op="help"
+ --list)
+ op="list"
+ shift
;;
--down)
op="down"
- ;;
- --)
shift
- break
;;
- esac
- shift
+ --help)
+ op="help"
+ shift # past argument with no value
+ ;;
+ *)
+ echo "unknown option $i"
+ usage
+ exit 1
+ ;;
+esac
done
echo "options: scale:${scale}, op:${op} op_arg:${op_arg}"
echo -e "${GREEN}list all node images${NC}"
docker images --filter=reference="${IMG_PREFIX}-*:*"
echo
- echo "public keys"
+ printf "${CYAN}image name\t\tpublic key${NC}\n"
img_array=(`docker images --filter=reference="${IMG_PREFIX}-*:*" --format "{{.Repository}}"`)
for img in "${img_array[@]}"; do
pubkey=$( get_pubkey ${img} )
done
fi
-echo -e "image/node/pkey"
+printf "${CYAN}image name\t\tnode name\tpublic key${NC}\n"
for id in "${!img_array[@]}"; do
node=${node_array[id]}
-FROM registry.cn-hangzhou.aliyuncs.com/matpool/golang-gcc-gpp:1.11.2 as builder
+FROM bytom/golang-gcc-gpp:1.11.2 as builder
LABEL stage=vapord_builder
WORKDIR /go/src/github.com/vapor
COPY . .
-RUN go build -o /usr/local/vapord/vapord ./cmd/bytomd/main.go
+RUN go build -o /usr/local/vapord/vapord ./cmd/vapord/main.go
# save node public key in /usr/local/vapord/node_pubkey.txt
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
COPY ./docker/vapord/config.toml /usr/local/vapord/config.toml
COPY ./docker/vapord/federation.json /usr/local/vapord/federation.json
###
-FROM registry.cn-hangzhou.aliyuncs.com/matpool/alpine-ca-supervisord:latest
+FROM bytom/alpine-ca-supervisord:latest
COPY ./docker/vapord/supervisord.conf /etc/supervisor/conf.d/vapord.conf
COPY --from=builder /usr/local/vapord /usr/local/vapord
RUN mkdir -p /var/log/vapord