diff --git a/scripts/DockerfileCi b/scripts/DockerfileCi deleted file mode 100644 index ae1475c18d..0000000000 --- a/scripts/DockerfileCi +++ /dev/null @@ -1,9 +0,0 @@ -# Only for starcoin ci -FROM ubuntu:18.04 -RUN apt update && apt install openssl -y -COPY starcoin /starcoin/ -COPY start.sh /starcoin/ -COPY starcoin_txfactory /starcoin/ -WORKDIR /starcoin -RUN ["chmod", "+x", "start.sh"] -ENTRYPOINT ["./start.sh"] diff --git a/scripts/chain_verify.sh b/scripts/chain_verify.sh deleted file mode 100755 index c1642d6736..0000000000 --- a/scripts/chain_verify.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -# rand function -function rand(){ - min=$1 - max=$(($2-$min+1)) - num=$(cat /dev/urandom | head -n 10 | cksum | awk -F ' ' '{print $1}') - echo $(($num%$max+$min)) -} -# get last header -#current_number=`~/kubectl --kubeconfig ~/.kube/starcoin_config -n starcoin-centauri exec starcoin-stress-2 -c starcoin --stdin --tty -- /starcoin/starcoin -c /sc-data/centauri/starcoin.ipc -o json chain info |grep -v INFO |jq .ok.head.number | sed 's/"//g'` -current_number=`target/debug/starcoin -c data/centauri/starcoin.ipc -ojson chain info |grep -v INFO |jq .ok.head.number | sed 's/"//g'` -echo "current number: $current_number" -rnd_block_num=$(rand 1 current_number) - -echo "chain verify node..." -target/debug/starcoin -c data/centauri/starcoin.ipc -ojson chain verify node -echo "verify node ok!" - -echo "chain verify block..." -target/debug/starcoin -c data/centauri/starcoin.ipc -ojson chain verify block -n $rnd_block_num -echo "verify block ok!" - -echo "chain verify epoch..." -target/debug/starcoin -c data/centauri/starcoin.ipc -ojson chain verify epoch -n $rnd_block_num -echo "verify epoch ok!" - -#while [ `echo ${TEMP} | awk -v tem=$block_num '{print(current_number>tem)? "1":"0"}'` -eq "0" ] -#do -# echo $block_num -## ~/kubectl --kubeconfig ~/.kube/starcoin_config -n starcoin-centauri exec starcoin-stress-2 -c starcoin --stdin --tty -- /starcoin/starcoin -c /sc-data/centauri/starcoin.ipc -o json chain verify epoch -n $block_num -# target/debug/starcoin -c data/centauri/starcoin.ipc -ojson chain verify epoch -n $block_num -# block_num=$((block_num+240)) -#done - - - - - diff --git a/scripts/prometheus_conf/prometheus.yml b/scripts/prometheus_conf/prometheus.yml index 3a289c90fa..85ffa38f3a 100644 --- a/scripts/prometheus_conf/prometheus.yml +++ b/scripts/prometheus_conf/prometheus.yml @@ -19,22 +19,15 @@ rule_files: # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape_configs: - - job_name: 'halley_1' + - job_name: 'halley' static_configs: - - targets: ['halley1.seed.starcoin.org:9101'] - - job_name: 'halley_2' + - targets: ['halley1.seed.starcoin.org:9101', 'halley2.seed.starcoin.org:9101', 'halley3.seed.starcoin.org:9101'] + - job_name: 'proxima' static_configs: - - targets: ['halley2.seed.starcoin.org:9101'] - - job_name: 'halley_3' + - targets: [ 'proxima1.seed.starcoin.org:9101', 'proxima2.seed.starcoin.org:9101', 'proxima3.seed.starcoin.org:9101' ] + - job_name: 'barnard' static_configs: - - targets: ['halley3.seed.starcoin.org:9101'] - - job_name: 'proxima_1' + - targets: [ 'barnard1.seed.starcoin.org:9101', 'barnard2.seed.starcoin.org:9101', 'barnard3.seed.starcoin.org:9101','barnard4.seed.starcoin.org:9101', 'barnard5.seed.starcoin.org:9101', 'barnard6.seed.starcoin.org:9101' ] + - job_name: 'main' static_configs: - - targets: ['proxima1.seed.starcoin.org:9101'] - - job_name: 'proxima_2' - static_configs: - - targets: ['proxima2.seed.starcoin.org:9101'] - - job_name: 'proxima_3' - static_configs: - - targets: ['proxima3.seed.starcoin.org:9101'] - + - targets: [ 'main1.seed.starcoin.org:9101', 'main2.seed.starcoin.org:9101', 'main3.seed.starcoin.org:9101','main4.seed.starcoin.org:9101', 'main5.seed.starcoin.org:9101', 'main6.seed.starcoin.org:9101','main7.seed.starcoin.org:9101', 'main8.seed.starcoin.org:9101', 'main9.seed.starcoin.org:9101' ] diff --git a/scripts/prometheus_conf/rule.yml b/scripts/prometheus_conf/rule.yml index 81a30c3549..e499cbab7c 100644 --- a/scripts/prometheus_conf/rule.yml +++ b/scripts/prometheus_conf/rule.yml @@ -17,12 +17,4 @@ groups: labels: severity: warning annotations: - description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes." - - - alert: centauriNodeDown - expr: up{job=~"centauri_.+"} == 0 - for: 5m - labels: - severity: warning - annotations: description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes." \ No newline at end of file diff --git a/scripts/prometheus_conf/run.sh b/scripts/prometheus_conf/run.sh new file mode 100755 index 0000000000..4c713fddfd --- /dev/null +++ b/scripts/prometheus_conf/run.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +SCRIPT_DIR="$( cd "$( dirname "$0" )" >/dev/null 2>&1 && pwd )"; +docker run -d \ + -p 9090:9090 \ + -v "${SCRIPT_DIR}"/prometheus.yml:/etc/prometheus/prometheus.yml \ + prom/prometheus \ No newline at end of file diff --git a/scripts/setup_cluster.sh b/scripts/setup_cluster.sh deleted file mode 100755 index 8a33b44a9e..0000000000 --- a/scripts/setup_cluster.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# use for init cluster - -cfg_root=/mnt/volume_01/starcoin_cfg - -create_node(){ - local node=$1 - local access_token=$2 - docker-machine create --driver digitalocean --digitalocean-region sgp1 --digitalocean-image "ubuntu-18-04-x64" --digitalocean-size "c-4" --digitalocean-private-networking --digitalocean-access-token $access_token $node -} - -create_nodes(){ - local cluster_name=$1 - local num=$2 - local token=$3 - for((c=0; c<$num; c++));do - create_node $cluster_name-$c $token - done -} - -stop_nodes(){ - local cluster_name=$1 - local num=$2 - for((c=0; c<$num;c++));do - docker-machine stop $cluster_name-$c - done -} - -remove_nodes(){ - local cluster_name=$1 - local num=$2 - for((c=0; c<$num;c++));do - docker-machine rm $cluster_name-$c -f -y - done -} - -clean_data(){ - local cluster_name=$1 - local num=$2 - for((c=0; c<$num;c++));do - docker-machine ssh $cluster_name-$c rm -rf $cfg_root - done -} - -clean_cfg(){ - local cluster_name=$1 - local num=$2 - for((c=0; c<$num;c++));do - docker-machine ssh $cluster_name-$c rm -rf $cfg_root/starcoin-$c/*/config.toml - done - -} - -usage(){ - echo "Usage $(basename $0) [stop, start, clean_data, clean_cfg] cluster_name nodes_number [access_token]" - exit -1 -} - - -if [ $# -lt 2 ]; then - usage; -fi - -case $1 in - start) - shift; - create_nodes $@ - ;; - stop) - shift; - remove_nodes $@ - ;; - clean_data) - shift; - clean_data $@ - ;; - clean_cfg) - shift; - clean_cfg $@ -esac diff --git a/scripts/starcoin_ci_docker.sh b/scripts/starcoin_ci_docker.sh deleted file mode 100755 index 6478ad1992..0000000000 --- a/scripts/starcoin_ci_docker.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash - -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" -cfg_root=/mnt/volume_01/starcoin_cfg - -check_errs() { - # Function. Parameter 1 is the return code - # Para. 2 is text to display on failure. - if [ "${1}" -ne "0" ]; then - echo "ERROR # ${1} : ${2}" - # as a bonus, make our script exit with the right error code. - exit ${1} - fi -} - -function docker_rebuild() { - echo -e "*\n"'!'"starcoin""\n!starcoin_txfactory\n"'!'"start.sh" >$DIR/../target/debug/.dockerignore - cp $DIR/start.sh $DIR/../target/debug/ - docker build -f $DIR/DockerfileCi -t starcoin:latest $DIR/../target/debug/ - check_errs $? "Docker build error" - docker image prune -f -} - -function start_starcoin() { - local host_name=$1 - local name=$2 - local port=$3 - local m_port=$4 - local net=$5 - shift 5 - eval $(docker-machine env $host_name) - docker_rebuild - docker rm -f $name 1>/dev/null - docker run -td --log-opt mode=non-blocking --log-opt max-size=1m --restart=on-failure:10 --network=host -p $port:9840 -p $m_port:9101 -p 9850:9850 -p 9860:9860 -p 9870:9870 -v $cfg_root/$name:/.starcoin --name $name starcoin $net $@ - check_errs $? "Docker run starcoin error" -} - -function start_txfactory() { - local host_name=$1 - local starcoin_name=$2 - local name=$3 - local net=$4 - shift 4 - eval $(docker-machine env $host_name) - docker_rebuild - docker rm -f $name 1>/dev/null - docker run -td --restart=on-failure:10 -v $cfg_root/$starcoin_name:/.starcoin --name $name --entrypoint "/starcoin/starcoin_txfactory" starcoin:latest --ipc-path /.starcoin/$net/starcoin.ipc $@ - check_errs $? "Docker run txfactory error" -} - -function start_cluster() { - local number=$1 - local cluster_name=$2 - local net=$3 - shift 3 - if [ -z "$NODE_KEYS" ]; then - exit -1 - fi - IFS=', ' read -r -a node_keys <<<$NODE_KEYS - seed_host=$(docker-machine ip $cluster_name-0) - rpc_address=$(docker-machine ssh $cluster_name-0 ifconfig eth1 | awk -F ' *|:' '/inet /{print $3}' | tr -d '\n') - if [ -z "$rpc_address" ]; then - rpc_address="127.0.0.1" - fi - - start_starcoin $cluster_name-0 starcoin-0 9840 9101 $net --node-key ${node_keys[0]} --rpc-address 0.0.0.0 --disable-seed=true - sleep 5 - seed_peer_id=$(docker-machine ssh $cluster_name-0 grep 'Local\ node\ identity\ is:\ ' $cfg_root/starcoin-0/$net/starcoin.log | awk '{print $8}' | tac | head -n 1) - seed=/ip4/$seed_host/tcp/9840/p2p/$seed_peer_id - for ((c = 1; c < $number; c++)); do - rpc_address=$(docker-machine ssh $cluster_name-$c ifconfig eth1 | awk -F ' *|:' '/inet /{print $3}' | tr -d '\n') - if [ -z "$rpc_address" ]; then - rpc_address="127.0.0.1" - fi - start_starcoin $cluster_name-$c starcoin-$c 9840 9101 $net --seed $seed --node-key ${node_keys[$c]} --rpc-address 0.0.0.0 - - done - start_txfactory $cluster_name-0 starcoin-0 txfactory-0 $net -} - -usage() { - echo "Usage $(basename $0) [number, cluster_name, network]" - exit -1 -} - -if [ $# -lt 3 ]; then - usage -fi - -start_cluster $1 $2 $3 diff --git a/scripts/start.sh b/scripts/start.sh deleted file mode 100755 index 0454b6fc92..0000000000 --- a/scripts/start.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -x -cfg_path="/.starcoin" -net="$1" -shift; -rm -f $cfg_path/$net/starcoin.ipc &>/dev/null -rm -f $cfg_path/$net/peers.json &>/dev/null -./starcoin -d /.starcoin -n $net $@ -ret=$? -if [ $ret -eq 120 ]; then - echo "Start failed with gensis mismatch code 120, clean data..." - rm -rf $cfg_path/$net/ &>/dev/null -fi -exit $ret