diff --git a/TestTestNet/bootnode/install.sh b/TestTestNet/bootnode/install.sh index 1f0fa46..5ca7589 100644 --- a/TestTestNet/bootnode/install.sh +++ b/TestTestNet/bootnode/install.sh @@ -3,9 +3,9 @@ set -e set -u set -x -EXT_IP="$(curl ifconfig.co)" +TEMPLATES_BRANCH="dev-mainnet" -echo "========== dev-mainnet/bootnode/install.sh starting ==========" +echo "========== ${TEMPLATES_BRANCH}/bootnode/install.sh starting ==========" echo "===== current time: $(date)" echo "===== username: $(whoami)" echo "===== working directory: $(pwd)" @@ -13,18 +13,23 @@ echo "===== operating system info:" lsb_release -a echo "===== memory usage info:" free -m + +echo "===== downloading common.vars" +curl -sLO "https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/common.vars" +source common.vars + +EXT_IP="$(curl ifconfig.co)" echo "===== external ip: ${EXT_IP}" + echo "===== environmental variables:" printenv -INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/bootnode" -GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/sokol/spec.json" +INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/TestTestNet/bootnode" +GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/${SCRIPTS_BRANCH}/spec.json" GENESIS_JSON="spec.json" NODE_TOML="node.toml" -BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/bootnodes.txt" -PARITY_DEB_LOC="https://parity-downloads-mirror.parity.io/v1.8.1/x86_64-unknown-linux-gnu/parity_1.8.1_amd64.deb" -PARITY_BIN_LOC="https://transfer.sh/PhhDc/parity" -NGINX_FILE_LOC="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/bootnode/nginx.default.site" +BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/TestTestNet/bootnodes.txt" +NGINX_FILE_LOC="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/TestTestNet/bootnode/nginx.default.site" echo "===== repo base path: ${INSTALL_CONFIG_REPO}" @@ -114,24 +119,23 @@ pull_image_and_configs() { [misc] log_file = "/home/${ADMIN_USERNAME}/logs/parity.log" EOF - mkdir -p parity/keys/OraclesPoA + mkdir -p parity_data/keys/OraclesPoA echo "<===== pull_image_and_configs" } clone_dapps() { echo "=====> clone_dapps" - mkdir -p parity/dapps - git clone https://github.com/oraclesorg/oracles-dapps-keys-generation.git parity/dapps/KeysGenerator - git clone https://github.com/oraclesorg/oracles-dapps-voting.git parity/dapps/Voting - git clone https://github.com/oraclesorg/oracles-dapps-validators.git parity/dapps/ValidatorsList + mkdir -p parity_data/dapps + git clone -b ${DAPPS_BRANCH} --single-branch https://github.com/oraclesorg/oracles-dapps-keys-generation.git parity_data/dapps/KeysGenerator + git clone -b ${DAPPS_BRANCH} --single-branch https://github.com/oraclesorg/oracles-dapps-voting.git parity_data/dapps/Voting + git clone -b ${DAPPS_BRANCH} --single-branch https://github.com/oraclesorg/oracles-dapps-validators.git parity_data/dapps/ValidatorsList echo "<===== clone_dapps" } install_nodejs() { echo "=====> install_nodejs" - # curl -sL https://deb.nodesource.com/setup_0.12 | bash - - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - + curl -sL ${NODE_SOURCE_DEB} | sudo -E bash - sudo apt-get update sudo apt-get install -y build-essential git unzip wget nodejs ntp cloud-utils @@ -244,8 +248,8 @@ EOF" use_bin_via_systemd() { echo "=====> use_bin_via_systemd" - curl -o parity-nouncles -L "${PARITY_BIN_LOC}" - chmod +x parity-nouncles + curl -o parity -L "${PARITY_BIN_LOC}" + chmod +x parity sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install -y libstdc++6 @@ -257,7 +261,7 @@ After=network.target User=${ADMIN_USERNAME} Group=${ADMIN_USERNAME} WorkingDirectory=/home/${ADMIN_USERNAME} -ExecStart=/home/${ADMIN_USERNAME}/parity-nouncles --config=node.toml +ExecStart=/home/${ADMIN_USERNAME}/parity --config=node.toml Restart=always [Install] WantedBy=multi-user.target @@ -303,15 +307,6 @@ EOF" echo "<===== configure_logrotate" } -download_initial_keys_script() { - echo "=====> download_initial_keys_script" - git clone https://github.com/oraclesorg/oracles-initial-keys - cd oracles-initial-keys - npm install - cd .. - echo "<===== download_initial_keys_script" -} - gen_certs() { echo "=====> gen_certs" mkdir certs @@ -342,8 +337,14 @@ main () { pull_image_and_configs clone_dapps - #use_deb_via_systemd - use_bin_via_systemd + if [ "${PARITY_INSTALLATION_MODE}" = "BIN" ]; then + use_bin_via_systemd + elif [ "${PARITY_INSTALLATION_MODE}" = "DEB" ]; then + use_deb_via_systemd + else + echo "===== invalid PARITY_INSTALLATION_MODE == ${PARITY_INSTALLATION_MODE}. Should be either BIN or DEB" + exit 1 + fi gen_certs install_nginx @@ -352,9 +353,7 @@ main () { install_netstats_via_systemd configure_logrotate - - #download_initial_keys_script } main -echo "========== dev-mainnet/bootnode/install.sh finished ==========" +echo "========== ${TEMPLATES_BRANCH}/bootnode/install.sh finished ==========" diff --git a/TestTestNet/bootnode/node.toml b/TestTestNet/bootnode/node.toml index c687972..95dc53d 100644 --- a/TestTestNet/bootnode/node.toml +++ b/TestTestNet/bootnode/node.toml @@ -1,7 +1,7 @@ # dev-mainnet branch [parity] chain = "spec.json" -base_path = "parity" +base_path = "parity_data" [network] port = 30303 [rpc] diff --git a/TestTestNet/common.vars b/TestTestNet/common.vars new file mode 100644 index 0000000..4e766e7 --- /dev/null +++ b/TestTestNet/common.vars @@ -0,0 +1,12 @@ +OWNER_ADDRESS="0xdd0bb0e2a1594240fed0c2f2c17c1e9ab4f87126" + +SCRIPTS_BRANCH="sokol" +DAPPS_BRANCH="sokol" +IKEYS_BRANCH="master" + +# either "BIN" or "DEB" +PARITY_INSTALLATION_MODE="BIN" +PARITY_BIN_LOC="https://transfer.sh/PhhDc/parity" +PARITY_DEB_LOC="https://parity-downloads-mirror.parity.io/v1.8.1/x86_64-unknown-linux-gnu/parity_1.8.1_amd64.deb" + +NODE_SOURCE_DEB="https://deb.nodesource.com/setup_6.x" diff --git a/TestTestNet/mining-node/install.sh b/TestTestNet/mining-node/install.sh index d84529d..2d61c54 100644 --- a/TestTestNet/mining-node/install.sh +++ b/TestTestNet/mining-node/install.sh @@ -3,9 +3,9 @@ set -e set -u set -x -EXT_IP="$(curl ifconfig.co)" +TEMPLATES_BRANCH="dev-mainnet" -echo "========== dev-mainnet/mining-node/install.sh starting ==========" +echo "========== ${TEMPLATES_BRANCH}/mining-node/install.sh starting ==========" echo "===== current time: $(date)" echo "===== username: $(whoami)" echo "===== working directory: $(pwd)" @@ -13,18 +13,24 @@ echo "===== operating system info:" lsb_release -a echo "===== memory usage info:" free -m + +echo "===== downloading common.vars" +curl -sLO "https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/common.vars" +source common.vars + +EXT_IP="$(curl ifconfig.co)" echo "===== external ip: ${EXT_IP}" + echo "===== environmental variables:" printenv # script parameters -INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/mining-node" -GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/sokol/spec.json" +INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/TestTestNet/mining-node" +GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/${SCRIPTS_BRANCH}/spec.json" GENESIS_JSON="spec.json" NODE_TOML="node.toml" NODE_PWD="node.pwd" -BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/bootnodes.txt" -PARITY_DEB_LOC="https://parity-downloads-mirror.parity.io/v1.8.1/x86_64-unknown-linux-gnu/parity_1.8.1_amd64.deb" +BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/TestTestNet/bootnodes.txt" export HOME="${HOME:-/home/${ADMIN_USERNAME}}" @@ -68,7 +74,6 @@ setup_ufw() { echo "=====> setup_ufw" sudo sudo ufw enable sudo ufw default deny incoming - sudo ufw allow 443 sudo ufw allow 8545 sudo ufw allow 22/tcp sudo ufw allow 30303/tcp @@ -122,8 +127,7 @@ allocate_swap() { install_nodejs() { echo "=====> install_nodejs" - # curl -sL https://deb.nodesource.com/setup_0.12 | bash - - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - + curl -sL ${NODE_SOURCE_DEB} | sudo -E bash - sudo apt-get update sudo apt-get install -y build-essential git unzip wget nodejs ntp cloud-utils @@ -132,7 +136,6 @@ install_nodejs() { echo "<===== install_nodejs" } - pull_image_and_configs() { echo "=====> pull_image_and_configs" @@ -155,8 +158,8 @@ engine_signer = "${MINING_ADDRESS}" reseal_on_txs = "none" EOF echo "${MINING_KEYPASS}" > "${NODE_PWD}" - mkdir -p parity/keys/OraclesPoA - echo ${MINING_KEYFILE} | base64 -d > parity/keys/OraclesPoA/mining.key.${MINING_ADDRESS} + mkdir -p parity_data/keys/OraclesPoA + echo ${MINING_KEYFILE} | base64 -d > parity_data/keys/OraclesPoA/mining.key.${MINING_ADDRESS} echo "<===== pull_image_and_configs" } @@ -269,9 +272,34 @@ EOF" echo "<===== use_deb_via_systemd" } +use_bin_via_systemd() { + echo "=====> use_bin_via_systemd" + curl -o parity -L "${PARITY_BIN_LOC}" + chmod +x parity + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install -y libstdc++6 + sudo bash -c "cat > /etc/systemd/system/oracles-parity.service < install_scripts" - git clone -b sokol --single-branch https://github.com/oraclesorg/oracles-scripts + git clone -b ${SCRIPTS_BRANCH} --single-branch https://github.com/oraclesorg/oracles-scripts ln -s ../node.toml oracles-scripts/node.toml cd oracles-scripts/scripts npm install @@ -340,7 +368,14 @@ main () { install_nodejs pull_image_and_configs - use_deb_via_systemd + if [ "${PARITY_INSTALLATION_MODE}" = "BIN" ]; then + use_bin_via_systemd + elif [ "${PARITY_INSTALLATION_MODE}" = "DEB" ]; then + use_deb_via_systemd + else + echo "===== invalid PARITY_INSTALLATION_MODE == ${PARITY_INSTALLATION_MODE}. Should be either BIN or DEB" + exit 1 + fi start_pm2_via_systemd install_netstats_via_systemd @@ -349,4 +384,4 @@ main () { } main -echo "========== dev-mainnet/mining-node/install.sh finished ==========" +echo "========== ${TEMPLATES_BRANCH}/mining-node/install.sh finished ==========" diff --git a/TestTestNet/mining-node/node.toml b/TestTestNet/mining-node/node.toml index 7b9f587..757c24b 100644 --- a/TestTestNet/mining-node/node.toml +++ b/TestTestNet/mining-node/node.toml @@ -1,7 +1,7 @@ # dev-mainnet branch [parity] chain = "spec.json" -base_path = "parity" +base_path = "parity_data" [network] port = 30303 [rpc] diff --git a/TestTestNet/mining-node/template.json b/TestTestNet/mining-node/template.json index 6f9d208..e9190ba 100644 --- a/TestTestNet/mining-node/template.json +++ b/TestTestNet/mining-node/template.json @@ -299,19 +299,6 @@ "destinationPortRange": "30303" } }, - { - "name": "allow-https", - "properties": { - "priority": 1300, - "direction": "Inbound", - "sourceAddressPrefix": "*", - "sourcePortRange": "*", - "protocol": "*", - "access": "Allow", - "destinationAddressPrefix": "*", - "destinationPortRange": "443" - } - }, { "name": "disallow-other", "properties": { diff --git a/TestTestNet/netstats-server/install.sh b/TestTestNet/netstats-server/install.sh index 8b56b9e..b629247 100644 --- a/TestTestNet/netstats-server/install.sh +++ b/TestTestNet/netstats-server/install.sh @@ -3,9 +3,9 @@ set -e set -u set -x -EXT_IP="$(curl ifconfig.co)" +TEMPLATES_BRANCH="dev-mainnet" -echo "========== dev-mainnet/netstats-server/install.sh starting ==========" +echo "========== ${TEMPLATES_BRANCH}/netstats-server/install.sh starting ==========" echo "===== current time: $(date)" echo "===== username: $(whoami)" echo "===== working directory: $(pwd)" @@ -13,16 +13,19 @@ echo "===== operating system info:" lsb_release -a echo "===== memory usage info:" free -m -echo "===== external ip: ${EXT_IP}" + +echo "===== downloading common.vars" +curl -sLO "https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/common.vars" +source common.vars + echo "===== environmental variables:" printenv -INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/bootnode" -GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/sokol/spec.json" +INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/TestTestNet/bootnode" +GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/${SCRIPTS_BRANCH}/spec.json" GENESIS_JSON="spec.json" NODE_TOML="node.toml" -BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/bootnodes.txt" -PARITY_DEB_LOC="https://parity-downloads-mirror.parity.io/v1.8.1/x86_64-unknown-linux-gnu/parity_1.8.1_amd64.deb" +BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/TestTestNet/bootnodes.txt" echo "===== repo base path: ${INSTALL_CONFIG_REPO}" @@ -111,24 +114,15 @@ pull_image_and_configs() { [misc] log_file = "/home/${ADMIN_USERNAME}/logs/parity.log" EOF - mkdir -p parity/keys/OraclesPoA + mkdir -p parity_data/keys/OraclesPoA echo "<===== pull_image_and_configs" } -clone_dapps() { - echo "=====> clone_dapps" - mkdir -p parity/dapps - git clone https://github.com/oraclesorg/oracles-dapps-keys-generation.git parity/dapps/KeysGenerator - git clone https://github.com/oraclesorg/oracles-dapps-voting.git parity/dapps/Voting - git clone https://github.com/oraclesorg/oracles-dapps-validators.git parity/dapps/ValidatorsList - echo "<===== clone_dapps" -} - install_nodejs() { echo "=====> install_nodejs" # curl -sL https://deb.nodesource.com/setup_0.12 | bash - - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - + curl -sL ${NODE_SOURCE_DEB} | sudo -E bash - sudo apt-get update sudo apt-get install -y build-essential git unzip wget nodejs ntp cloud-utils @@ -260,7 +254,7 @@ var net = require('net'); var config = function () { this.logFormat = "combined"; - this.ipcPath = "/home/${ADMIN_USERNAME}/parity/jsonrpc.ipc"; + this.ipcPath = "/home/${ADMIN_USERNAME}/parity_data/jsonrpc.ipc"; this.provider = new web3.providers.IpcProvider(this.ipcPath, net); this.bootstrapUrl = "https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/yeti/bootstrap.min.css"; this.names = { @@ -372,6 +366,31 @@ EOF" echo "<===== configure_logrotate" } +use_bin_via_systemd() { + echo "=====> use_bin_via_systemd" + curl -o parity -L "${PARITY_BIN_LOC}" + chmod +x parity + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install -y libstdc++6 + sudo bash -c "cat > /etc/systemd/system/oracles-parity.service < setup_ufw" sudo sudo ufw enable sudo ufw default deny incoming - sudo ufw allow 443 sudo ufw allow 8545 sudo ufw allow 22/tcp sudo ufw allow 30303/tcp @@ -114,27 +116,24 @@ pull_image_and_configs() { cat >> ${NODE_TOML} < "${NODE_PWD}" - mkdir -p parity/keys/OraclesPoA - echo ${OWNER_KEYFILE} | base64 -d > parity/keys/OraclesPoA/owner.key + mkdir -p parity_data/keys/OraclesPoA + echo ${OWNER_KEYFILE} | base64 -d > parity_data/keys/OraclesPoA/owner.key echo "<===== pull_image_and_configs" } -clone_dapps() { - echo "=====> clone_dapps" - mkdir -p parity/dapps - git clone https://github.com/oraclesorg/oracles-dapps-keys-generation.git parity/dapps/KeysGenerator - git clone https://github.com/oraclesorg/oracles-dapps-voting.git parity/dapps/Voting - git clone https://github.com/oraclesorg/oracles-dapps-validators.git parity/dapps/ValidatorsList - echo "<===== clone_dapps" -} - install_nodejs() { echo "=====> install_nodejs" - # curl -sL https://deb.nodesource.com/setup_0.12 | bash - - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - + curl -sL ${NODE_SOURCE_DEB} | sudo -E bash - sudo apt-get update sudo apt-get install -y build-essential git unzip wget nodejs ntp cloud-utils @@ -246,6 +245,31 @@ EOF" echo "<===== use_deb_via_systemd" } +use_bin_via_systemd() { + echo "=====> use_bin_via_systemd" + curl -o parity -L "${PARITY_BIN_LOC}" + chmod +x parity + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install -y libstdc++6 + sudo bash -c "cat > /etc/systemd/system/oracles-parity.service < configure_logrotate" @@ -284,7 +308,7 @@ EOF" download_initial_keys_script() { echo "=====> download_initial_keys_script" - git clone https://github.com/oraclesorg/oracles-initial-keys + git clone -b ${IKEYS_BRANCH} --single-branch https://github.com/oraclesorg/oracles-initial-keys cd oracles-initial-keys npm install cd .. @@ -304,9 +328,15 @@ main () { install_nodejs pull_image_and_configs - clone_dapps - use_deb_via_systemd + if [ "${PARITY_INSTALLATION_MODE}" = "BIN" ]; then + use_bin_via_systemd + elif [ "${PARITY_INSTALLATION_MODE}" = "DEB" ]; then + use_deb_via_systemd + else + echo "===== invalid PARITY_INSTALLATION_MODE == ${PARITY_INSTALLATION_MODE}. Should be either BIN or DEB" + exit 1 + fi start_pm2_via_systemd install_netstats_via_systemd @@ -317,4 +347,4 @@ main () { } main -echo "========== dev-mainnet/owner/install.sh finished ==========" +echo "========== ${TEMPLATES_BRANCH}/owner/install.sh finished ==========" diff --git a/TestTestNet/owner/node.toml b/TestTestNet/owner/node.toml index e000f3a..757c24b 100644 --- a/TestTestNet/owner/node.toml +++ b/TestTestNet/owner/node.toml @@ -1,14 +1,8 @@ # dev-mainnet branch [parity] chain = "spec.json" -base_path = "parity" +base_path = "parity_data" [network] port = 30303 [rpc] apis = ["web3", "eth", "parity", "parity_set", "net", "traces", "rpc"] -[account] -password = ["node.pwd"] -[mining] -force_sealing = true -engine_signer = "0xdd0bb0e2a1594240fed0c2f2c17c1e9ab4f87126" -reseal_on_txs = "none" diff --git a/TestTestNet/owner/template.json b/TestTestNet/owner/template.json index e940612..5025d0c 100644 --- a/TestTestNet/owner/template.json +++ b/TestTestNet/owner/template.json @@ -291,19 +291,6 @@ "destinationPortRange": "30303" } }, - { - "name": "allow-https", - "properties": { - "priority": 1300, - "direction": "Inbound", - "sourceAddressPrefix": "*", - "sourcePortRange": "*", - "protocol": "*", - "access": "Allow", - "destinationAddressPrefix": "*", - "destinationPortRange": "443" - } - }, { "name": "disallow-other", "properties": {