diff --git a/README.md b/README.md index fb0e480..7babd5a 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ ## DEV Network ### Mining node -*(Haven't you forgotten to change* `bootnodes`*?)* [![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Foraclesorg%2Ftest-templates%2Fdev%2Fdev-mainnet%2Fmining-node%2Ftemplate.json) ### Bootnode -NOTE: at this moment creating a new bootnode is equivalent to creating a separate network [![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Foraclesorg%2Ftest-templates%2Fdev%2Fdev-mainnet%2Fbootnode%2Ftemplate.json) + +### Netstats server diff --git a/TestTestNet/bootnode/install.sh b/TestTestNet/bootnode/install.sh index 25cf204..8fc11e1 100644 --- a/TestTestNet/bootnode/install.sh +++ b/TestTestNet/bootnode/install.sh @@ -80,7 +80,7 @@ start_logentries # */ -echo "========== dev/bootnode/install.sh starting ==========" +echo "========== dev-mainnet/bootnode/install.sh starting ==========" echo "===== current time: $(date)" echo "===== username: $(whoami)" echo "===== working directory: $(pwd)" @@ -99,40 +99,21 @@ set echo "===== declare -p:" declare -p -#echo "===== AFTER SUDO" -#echo "===== SUDO printenv:" -#sudo -u root -E -H bash -c "printenv" -#echo "===== SUDO env:" -#sudo -u root -E -H bash -c "env" -#echo "===== SUDO set:" -#sudo -u root -E -H bash -c "set" -#echo "===== SUDO declare -p:" -#sudo -u root -E -H bash -c "declare -p" - -# script parameters -#INSTALL_DOCKER_VERSION="17.03.1~ce-0~ubuntu-xenial" -#INSTALL_DOCKER_IMAGE="parity/parity:v1.6.8" INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/dev/dev-mainnet/bootnode" GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/master/spec.json" GENESIS_JSON="spec.json" NODE_TOML="node.toml" -NODE_PWD="node.pwd" -#echo "===== will use docker version: ${INSTALL_DOCKER_VERSION}" -#echo "===== will use parity docker image: ${INSTALL_DOCKER_IMAGE}" echo "===== repo base path: ${INSTALL_CONFIG_REPO}" # this should be provided through env by azure template +NETSTATS_SERVER="${NETSTATS_SERVER}" NETSTATS_SECRET="${NETSTATS_SECRET}" -OWNER_KEYFILE="${OWNER_KEYFILE}" -OWNER_KEYPASS="${OWNER_KEYPASS}" NODE_FULLNAME="${NODE_FULLNAME:-Bootnode}" NODE_ADMIN_EMAIL="${NODE_ADMIN_EMAIL:-somebody@somehere}" ADMIN_USERNAME="${ADMIN_USERNAME}" -#echo "===== HOME before: ${HOME:-NONE}" export HOME="${HOME:-/home/${ADMIN_USERNAME}}" -#echo "===== HOME after: ${HOME}" prepare_homedir() { echo "=====> prepare_homedir" @@ -144,24 +125,6 @@ prepare_homedir() { echo "<===== prepare_homedir" } -add_user_to_docker_group() { - # based on https://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo - echo "=====> add_user_to_docker_group" - sudo groupadd docker - #sudo gpasswd -a "${ADMIN_USERNAME}" docker - sudo usermod -aG docker "${ADMIN_USERNAME}" - # based on https://superuser.com/a/345051 - #orig_group_id=$(id -gn) - #echo "===== orig_group_id = ${orig_group_id}" - newgrp docker - newgrp - - #newgrp "${orig_group_id}" - - echo "===== Groups: " - groups - echo "<===== add_user_to_docker_group" -} - install_ntpd() { echo "=====> install_ntpd" sudo timedatectl set-ntp no @@ -199,17 +162,6 @@ allocate_swap() { echo "<===== allocate_swap" } -install_docker_ce() { - echo "=====> install_docker_ce" - sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - sudo apt-get update - sudo apt-get -y install docker-ce=${INSTALL_DOCKER_VERSION} - sudo docker pull ${INSTALL_DOCKER_IMAGE} - echo "<===== install_docker_ce" -} - pull_image_and_configs() { echo "=====> pull_image_and_configs" # curl -s -O "${INSTALL_CONFIG_REPO}/../${GENESIS_JSON}" @@ -221,9 +173,7 @@ pull_image_and_configs() { logging="engine=trace,network=trace,discovery=trace" log_file = "/home/${ADMIN_USERNAME}/logs/parity.log" EOF - echo "${OWNER_KEYPASS}" > "${NODE_PWD}" mkdir -p parity/keys/OraclesPoA - echo ${OWNER_KEYFILE} | base64 -d > parity/keys/OraclesPoA/owner.key echo "<===== pull_image_and_configs" } @@ -271,125 +221,7 @@ EOF" echo "<===== start_pm2_via_systemd" } -install_dashboard() { - echo "=====> install_dashboard" - git clone https://github.com/oraclesorg/eth-netstats - cd eth-netstats - npm install - sudo npm install -g grunt-cli - sudo npm install pm2 -g - grunt - -# cat > app.json << EOF -#[ -# { -# "name" : "netstats-dashboard", -# "script" : "bin/www", -# "log_date_format" : "YYYY-MM-DD HH:mm:SS Z", -# "error_file" : "/home/${ADMIN_USERNAME}/logs/dashboard.err", -# "out_file" : "/home/${ADMIN_USERNAME}/logs/dashboard.out", -# "merge_logs" : false, -# "watch" : false, -# "max_restarts" : 100, -# "exec_interpreter" : "node", -# "exec_mode" : "fork_mode", -# "env": -# { -# "NODE_ENV" : "production", -# "WS_SECRET" : "${NETSTATS_SECRET}" -# } -# } -#] -#EOF - echo "[\"${NETSTATS_SECRET}\"]" > ws_secret.json - cd .. - sudo apt-get install -y dtach - cat > dashboard.start <> ../logs/dashboard.out 2>> ../logs/dashboard.err" -EOF - chmod +x dashboard.start - ./dashboard.start - echo "<====== install_dashboard" -} - -install_dashboard_via_systemd() { - echo "=====> install_dashboard_via_systemd" - git clone https://github.com/oraclesorg/eth-netstats - cd eth-netstats - npm install - sudo npm install -g grunt-cli - sudo npm install pm2 -g - grunt - echo "[\"${NETSTATS_SECRET}\"]" > ws_secret.json - cd .. - - sudo bash -c "cat > /etc/systemd/system/oracles-dashboard.service < install_netstats" - git clone https://github.com/oraclesorg/eth-net-intelligence-api - cd eth-net-intelligence-api - #sed -i '/"web3"/c "web3": "0.19.x",' package.json - npm install - sudo npm install pm2 -g - - cat > app.json << EOF -[ - { - "name" : "netstats_daemon", - "script" : "app.js", - "log_date_format" : "YYYY-MM-DD HH:mm:SS Z", - "error_file" : "/home/${ADMIN_USERNAME}/logs/netstats_daemon.err", - "out_file" : "/home/${ADMIN_USERNAME}/logs/netstats_daemon.out", - "merge_logs" : false, - "watch" : false, - "max_restarts" : 100, - "exec_interpreter" : "node", - "exec_mode" : "fork_mode", - "env": - { - "NODE_ENV" : "production", - "RPC_HOST" : "localhost", - "RPC_PORT" : "8545", - "LISTENING_PORT" : "30300", - "INSTANCE_NAME" : "${NODE_FULLNAME}", - "CONTACT_DETAILS" : "${NODE_ADMIN_EMAIL}", - "WS_SERVER" : "http://localhost:3000", - "WS_SECRET" : "${NETSTATS_SECRET}", - "VERBOSITY" : 2 - } - } -] -EOF - cd .. - cat > netstats.start < install_netstats_via_systemd" git clone https://github.com/oraclesorg/eth-net-intelligence-api @@ -419,7 +251,7 @@ install_netstats_via_systemd() { "LISTENING_PORT" : "30300", "INSTANCE_NAME" : "${NODE_FULLNAME}", "CONTACT_DETAILS" : "${NODE_ADMIN_EMAIL}", - "WS_SERVER" : "http://localhost:3000", + "WS_SERVER" : "http://${NETSTATS_SERVER}:3000", "WS_SECRET" : "${NETSTATS_SECRET}", "VERBOSITY" : 2 } @@ -447,173 +279,6 @@ EOF" echo "<===== install_netstats_via_systemd" } -install_chain_explorer() { - echo "=====> install_chain_explorer" - git clone https://github.com/oraclesorg/chain-explorer - git clone https://github.com/ethereum/solc-bin chain-explorer/utils/solc-bin - cd chain-explorer - npm install - sudo npm install pm2 -g - cat > config.js < explorer.start < ../logs/explorer.out 2> ../logs/explorer.err" -#EOF - - cat > app.json << EOF -[ - { - "name" : "explorer", - "script" : "./bin/www", - "log_date_format" : "YYYY-MM-DD HH:mm:SS Z", - "error_file" : "/home/${ADMIN_USERNAME}/logs/explorer.err", - "out_file" : "/home/${ADMIN_USERNAME}/logs/explorer.out", - "merge_logs" : false, - "watch" : false, - "max_restarts" : 100, - "exec_interpreter" : "node", - "exec_mode" : "fork_mode", - "env": - { - "NODE_ENV" : "production", - "PORT" : 4000, - } - } -] -EOF - cd .. - cat > explorer.start < install_chain_explorer_via_systemd" - git clone https://github.com/oraclesorg/chain-explorer - git clone https://github.com/ethereum/solc-bin chain-explorer/utils/solc-bin - cd chain-explorer - npm install - sudo npm install pm2 -g - cat > config.js < explorer.start < ../logs/explorer.out 2> ../logs/explorer.err" -#EOF - - cat > app.json << EOF -[ - { - "name" : "explorer", - "script" : "./bin/www", - "log_date_format" : "YYYY-MM-DD HH:mm:SS Z", - "error_file" : "/home/${ADMIN_USERNAME}/logs/explorer.err", - "out_file" : "/home/${ADMIN_USERNAME}/logs/explorer.out", - "merge_logs" : false, - "watch" : false, - "max_restarts" : 100, - "exec_interpreter" : "node", - "exec_mode" : "fork_mode", - "env": - { - "NODE_ENV" : "production", - "PORT" : 4000, - } - } -] -EOF - cd .. - sudo bash -c "cat > /etc/systemd/system/oracles-chain-explorer.service < start_docker" - cat > docker.start << EOF -sudo docker run -d \\ - --name oracles-poa \\ - -p 30300:30300 \\ - -p 30300:30300/udp \\ - -p 8080:8080 \\ - -p 8180:8180 \\ - -p 8545:8545 \\ - -v "$(pwd)/${NODE_PWD}:/build/${NODE_PWD}" \\ - -v "$(pwd)/parity:/build/parity" \\ - -v "$(pwd)/${GENESIS_JSON}:/build/${GENESIS_JSON}" \\ - -v "$(pwd)/${NODE_TOML}:/build/${NODE_TOML}" \\ - ${INSTALL_DOCKER_IMAGE} -lengine=trace --config "${NODE_TOML}" --ui-no-validation > logs/docker.out 2> logs/docker.err -container_id="\$(cat logs/docker.out)" -sudo ln -sf "/var/lib/docker/containers/\${container_id}/\${container_id}-json.log" logs/parity.log -EOF - chmod +x docker.start - ./docker.start - echo "<===== start_docker" -} - -use_deb() { - echo "=====> use_deb" - curl -LO 'http://parity-downloads-mirror.parity.io/v1.7.0/x86_64-unknown-linux-gnu/parity_1.7.0_amd64.deb' - sudo dpkg -i parity_1.7.0_amd64.deb - sudo apt-get install dtach - - cat > parity.start << EOF -dtach -n parity.dtach bash -c "parity -l engine=trace,discovery=trace,network=trace --config ${NODE_TOML} --ui-no-validation >> logs/parity.out 2>> logs/parity.err" -EOF - chmod +x parity.start - ./parity.start - echo "<===== use_deb" -} - use_deb_via_systemd() { echo "=====> use_deb_via_systemd" curl -LO 'http://parity-downloads-mirror.parity.io/v1.7.0/x86_64-unknown-linux-gnu/parity_1.7.0_amd64.deb' @@ -640,60 +305,6 @@ EOF" echo "<===== use_deb_via_systemd" } -use_bin() { - echo "=====> use_bin" - sudo apt-get install -y dtach unzip - curl -L -o parity-bin-v1.7.0.zip 'https://gitlab.parity.io/parity/parity/-/jobs/61863/artifacts/download' - unzip parity-bin-v1.7.0.zip -d parity-bin-v1.7.0 - ln -s parity-bin-v1.7.0/target/release/parity parity-v1.7.0 - - cat > parity.start << EOF -dtach -n parity.dtach bash -c "./parity-v1.7.0 -l discovery=trace,network=trace --config ${NODE_TOML} --ui-no-validation >> logs/parity.out 2>> logs/parity.err" -EOF - chmod +x parity.start - ./parity.start - echo "<===== use_bin" -} - -compile_source() { - echo "=====> compile_source" - sudo apt-get -y install gcc g++ libssl-dev libudev-dev pkg-config - curl https://sh.rustup.rs -sSf | sh -s -- -y - source "/home/${ADMIN_USERNAME}/.cargo/env" - rustc --version - cargo --version - - git clone -b "v1.7.0" https://github.com/paritytech/parity parity-src-v1.7.0 - cd parity-src-v1.7.0 - cargo build --release - cd .. - ln -s parity-src-v1.7.0/target/release/parity parity-v1.7.0 - - cat > parity.start << EOF -./parity-v1.7.0 -l discovery=trace,network=trace --config "${NODE_TOML}" --ui-no-validation >> logs/parity.out 2>> logs/parity.err -EOF - chmod +x parity.start - dtach -n parity.dtach "./parity.start" - echo "<===== compile_source" -} - -setup_autoupdate() { - echo "=====> setup_autoupdate" - sudo docker pull oraclesorg/docker-run - sudo bash -c "cat > /etc/cron.daily/docker-autoupdate << EOF -#!/bin/sh -outlog='/home/${ADMIN_USERNAME}/logs/docker-autoupdate.out' -errlog='/home/${ADMIN_USERNAME}/logs/docker-autoupdate.err' -echo \"Starting: \\\$(date)\" >> \"\\\${outlog}\" -echo \"Starting: \\\$(date)\" >> \"\\\${errlog}\" -sudo docker run --rm -v /var/run/docker.sock:/tmp/docker.sock oraclesorg/docker-run update >> \"\\\${outlog}\" 2>> \"\\\${errlog}\" -echo \"\" >> \"\\\${outlog}\" -echo \"\" >> \"\\\${errlog}\" -EOF" - sudo chmod 755 /etc/cron.daily/docker-autoupdate - echo "<===== setup_autoupdate" -} - configure_logrotate() { echo "=====> configure_logrotate" @@ -736,32 +347,18 @@ main () { sudo apt-get update prepare_homedir - #add_user_to_docker_group install_ntpd install_haveged allocate_swap install_nodejs - #install_docker_ce pull_image_and_configs clone_dapps - #start_docker - #use_deb use_deb_via_systemd - #use_bin - #compile_source - - #setup_autoupdate - - #install_dashboard - install_dashboard_via_systemd start_pm2_via_systemd - #install_netstats install_netstats_via_systemd - #install_chain_explorer - install_chain_explorer_via_systemd configure_logrotate @@ -769,4 +366,4 @@ main () { } main -echo "========== dev/bootnode/install.sh finished ==========" +echo "========== dev-mainnet/bootnode/install.sh finished ==========" diff --git a/TestTestNet/bootnode/node.toml b/TestTestNet/bootnode/node.toml index 94840e6..c9b8d4b 100644 --- a/TestTestNet/bootnode/node.toml +++ b/TestTestNet/bootnode/node.toml @@ -1,4 +1,4 @@ -# dev branch +# dev-mainnet branch [parity] chain = "spec.json" base_path = "parity" @@ -26,12 +26,6 @@ cors = "all" interface = "0.0.0.0" hosts = ["all"] port = 8080 -[account] -password = ["node.pwd"] -[mining] -force_sealing = true -engine_signer = "0xDd0BB0e2a1594240fED0c2f2c17C1E9AB4F87126" -reseal_on_txs = "none" [footprint] tracing = "on" pruning = "archive" diff --git a/TestTestNet/bootnode/template.json b/TestTestNet/bootnode/template.json index 4353967..099b47d 100644 --- a/TestTestNet/bootnode/template.json +++ b/TestTestNet/bootnode/template.json @@ -14,18 +14,6 @@ "description": "Node admin email (publicly visible)" } }, - "ownerKeyFile": { - "type": "secureString", - "metadata": { - "description": "Content of the file with mining key (json string)" - } - }, - "ownerKeypass": { - "type": "secureString", - "metadata": { - "description": "Password for the mining key" - } - }, "adminUsername": { "type": "string", "metadata": { @@ -38,10 +26,16 @@ "description": "SSH public key for the Virtual Machine" } }, + "netstatsServer": { + "type": "string", + "metadata": { + "description": "NetStats server" + } + }, "netstatsSecret": { "type": "secureString", "metadata": { - "description": "NetStats net code" + "description": "NetStats secret code" } } }, @@ -62,13 +56,12 @@ "vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]", "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "ubuntuOSVersion": "16.04.0-LTS", - "dnsLabelPrefix": "[concat('musereum-bn-', uniqueString(parameters('nodeFullName')))]", + "dnsLabelPrefix": "[concat('oracles-bn-', uniqueString(parameters('nodeFullName')))]", "adminUsername": "[trim(toLower(parameters('adminUsername')))]", "sshPublicKey": "[trim(parameters('sshPublicKey'))]", "nodeFullName": "[trim(parameters('nodeFullName'))]", "nodeAdminEmail": "[trim(parameters('nodeAdminEmail'))]", - "ownerKeyFile": "[base64(trim(string(parameters('ownerKeyFile'))))]", - "ownerKeypass": "[trim(parameters('ownerKeypass'))]", + "netstatsServer": "[trim(parameters('netstatsServer'))]", "netstatsSecret": "[trim(parameters('netstatsSecret'))]" }, "resources": [ @@ -226,7 +219,7 @@ ] }, "protectedSettings": { - "commandToExecute": "[concat('cp install.sh /home/', variables('adminUsername'), '/; cd /home/', variables('adminUsername'), '; chown ', variables('adminUsername'), ':', variables('adminUsername'), ' install.sh; chmod +x install.sh; ADMIN_USERNAME=\"', variables('adminUsername'), '\" NETSTATS_SECRET=\"', variables('netstatsSecret'), '\" OWNER_KEYFILE=\"', variables('ownerKeyFile'), '\" OWNER_KEYPASS=\"', variables('ownerKeypass'), '\" NODE_FULLNAME=\"', variables('nodeFullName'), '\" NODE_ADMIN_EMAIL=\"', variables('nodeAdminEmail'), '\" sudo -u ', variables('adminUsername'), ' -E -H ./install.sh')]" + "commandToExecute": "[concat('cp install.sh /home/', variables('adminUsername'), '/; cd /home/', variables('adminUsername'), '; chown ', variables('adminUsername'), ':', variables('adminUsername'), ' install.sh; chmod +x install.sh; ADMIN_USERNAME=\"', variables('adminUsername'), '\" NETSTATS_SERVER=\"', variables('netstatsServer'), '\" NETSTATS_SECRET=\"', variables('netstatsSecret'), '\" NODE_FULLNAME=\"', variables('nodeFullName'), '\" NODE_ADMIN_EMAIL=\"', variables('nodeAdminEmail'), '\" sudo -u ', variables('adminUsername'), ' -E -H ./install.sh')]" } } } diff --git a/TestTestNet/bootnodes.txt b/TestTestNet/bootnodes.txt new file mode 100644 index 0000000..e69de29 diff --git a/TestTestNet/mining-node/install.sh b/TestTestNet/mining-node/install.sh index eccec4f..80c5387 100644 --- a/TestTestNet/mining-node/install.sh +++ b/TestTestNet/mining-node/install.sh @@ -61,7 +61,7 @@ start_logentries # */ -echo "========== dev/mining-node/install.sh starting ==========" +echo "========== dev-mainnet/mining-node/install.sh starting ==========" echo "===== current time: $(date)" echo "===== username: $(whoami)" echo "===== working directory: $(pwd)" @@ -74,18 +74,15 @@ echo "===== environmental variables:" printenv # script parameters -#INSTALL_DOCKER_VERSION="17.03.1~ce-0~ubuntu-xenial" -#INSTALL_DOCKER_IMAGE="parity/parity:v1.6.8" INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/dev/TestTestNet/mining-node" GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/master/spec.json" GENESIS_JSON="spec.json" NODE_TOML="node.toml" NODE_PWD="node.pwd" +BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/dev/TestTestNet/bootnodes.txt" export HOME="${HOME:-/home/${ADMIN_USERNAME}}" -#echo "===== will use docker version: ${INSTALL_DOCKER_VERSION}" -#echo "===== will use parity docker image: ${INSTALL_DOCKER_IMAGE}" echo "===== repo base path: ${INSTALL_CONFIG_REPO}" # this should be provided through env by azure template @@ -107,17 +104,6 @@ prepare_homedir() { echo "<===== prepare_homedir" } -add_user_to_docker_group() { - # based on https://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo - echo "=====> add_user_to_docker_group" - sudo groupadd docker - sudo gpasswd -a "${ADMIN_USERNAME}" docker - newgrp docker - echo "===== Groups: " - groups - echo "<===== add_user_to_docker_group" -} - install_ntpd() { echo "=====> install_ntpd" sudo timedatectl set-ntp no @@ -167,16 +153,6 @@ install_nodejs() { echo "<===== install_nodejs" } -install_docker_ce() { - echo "=====> install_docker_ce" - sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - sudo apt-get update - sudo apt-get -y install docker-ce=${INSTALL_DOCKER_VERSION} - sudo docker pull ${INSTALL_DOCKER_IMAGE} - echo "<===== install_docker_ce" -} pull_image_and_configs() { echo "=====> pull_image_and_configs" @@ -184,7 +160,9 @@ pull_image_and_configs() { # curl -s -O "${INSTALL_CONFIG_REPO}/../${GENESIS_JSON}" curl -s -o "${GENESIS_JSON}" "${GENESIS_REPO_LOC}" curl -s -O "${INSTALL_CONFIG_REPO}/${NODE_TOML}" + curl -s -O "bootnodes.txt" "${BOOTNODES_TXT}" sed -i "/\[network\]/a nat=\"extip:${EXT_IP}\"" ${NODE_TOML} + sed -i "/\[network\]/a bootnodes=\[$(cat bootnodes.txt | awk -F'#' '{ print $1 }' | awk '/.+/{ if ($1) print "\""$1"\"" }' | paste -sd "," -)\]" ${NODE_TOML} cat >> ${NODE_TOML} < install_netstats" - git clone https://github.com/oraclesorg/eth-net-intelligence-api - cd eth-net-intelligence-api - #sed -i '/"web3"/c "web3": "0.19.x",' package.json - npm install - sudo npm install pm2 -g - - cat > app.json << EOL -[ - { - "name" : "netstats_daemon", - "script" : "app.js", - "log_date_format" : "YYYY-MM-DD HH:mm:SS Z", - "error_file" : "/home/${ADMIN_USERNAME}/logs/netstats_daemon.err", - "out_file" : "/home/${ADMIN_USERNAME}/logs/netstats_daemon.out", - "merge_logs" : false, - "watch" : false, - "max_restarts" : 100, - "exec_interpreter" : "node", - "exec_mode" : "fork_mode", - "env": - { - "NODE_ENV" : "production", - "RPC_HOST" : "localhost", - "RPC_PORT" : "8545", - "LISTENING_PORT" : "30300", - "INSTANCE_NAME" : "${NODE_FULLNAME}", - "CONTACT_DETAILS" : "${NODE_ADMIN_EMAIL}", - "WS_SERVER" : "http://${NETSTATS_SERVER}:3000", - "WS_SECRET" : "${NETSTATS_SECRET}", - "VERBOSITY" : 2 - } - } -] -EOL - cd .. - cat > netstats.start < install_netstats_via_systemd" git clone https://github.com/oraclesorg/eth-net-intelligence-api @@ -311,43 +242,6 @@ EOF" echo "<===== install_netstats_via_systemd" } -start_docker() { - echo "=====> start_docker" - cat > docker.start < logs/docker.out 2> logs/docker.err -container_id="\$(cat logs/docker.out)" -sudo ln -sf "/var/lib/docker/containers/\${container_id}/\${container_id}-json.log" logs/parity.log -EOF - chmod +x docker.start - ./docker.start - echo "<===== start_docker" -} - -use_deb() { - echo "=====> use_deb" - curl -LO 'http://parity-downloads-mirror.parity.io/v1.7.0/x86_64-unknown-linux-gnu/parity_1.7.0_amd64.deb' - sudo dpkg -i parity_1.7.0_amd64.deb - sudo apt-get install dtach - - cat > parity.start << EOF -dtach -n parity.dtach bash -c "parity -l engine=trace,discovery=trace,network=trace --config ${NODE_TOML} >> logs/parity.out 2>> logs/parity.err" -EOF - chmod +x parity.start - ./parity.start - echo "<===== use_deb" -} - use_deb_via_systemd() { echo "=====> use_deb_via_systemd" curl -LO 'http://d1h4xl4cr1h0mo.cloudfront.net/nightly/x86_64-unknown-debian-gnu/parity_1.8.0_amd64.deb' @@ -373,43 +267,6 @@ EOF" echo "<===== use_deb_via_systemd" } -use_bin() { - echo "=====> use_bin" - sudo apt-get install -y dtach unzip - curl -L -o parity-bin-v1.7.0.zip 'https://gitlab.parity.io/parity/parity/-/jobs/61863/artifacts/download' - unzip parity-bin-v1.7.0.zip -d parity-bin-v1.7.0 - ln -s parity-bin-v1.7.0/target/release/parity parity-v1.7.0 - - cat > parity.start << EOF -dtach -n parity.dtach bash -c "./parity-v1.7.0 -l discovery=trace,network=trace --config ${NODE_TOML} >> logs/parity.out 2>> logs/parity.err" -EOF - chmod +x parity.start - ./parity.start - echo "<===== use_bin" -} - -compile_source() { - echo "=====> compile_source" - sudo apt-get -y install gcc g++ libssl-dev libudev-dev pkg-config - curl https://sh.rustup.rs -sSf | sh -s -- -y - source "/home/${ADMIN_USERNAME}/.cargo/env" - rustc --version - cargo --version - - git clone -b "v1.7.0" https://github.com/paritytech/parity parity-src-v1.7.0 - cd parity-src-v1.7.0 - cargo build --release - cd .. - ln -s parity-src-v1.7.0/target/release/parity parity-v1.7.0 - - cat > parity.start << EOF -./parity-v1.7.0 -l discovery=trace,network=trace --config "${NODE_TOML}" >> logs/parity.out 2>> logs/parity.err -EOF - chmod +x parity.start - dtach -n parity.dtach "./parity.start" - echo "<===== compile_source" -} - install_scripts() { echo "=====> install_scripts" git clone -b master --single-branch https://github.com/oraclesorg/oracles-scripts @@ -430,23 +287,6 @@ EOF" echo "<===== install_scripts" } -setup_autoupdate() { - echo "=====> setup_autoupdate" - sudo docker pull oraclesorg/docker-run - sudo bash -c "cat > /etc/cron.daily/docker-autoupdate << EOF -#!/bin/sh -outlog='/home/${ADMIN_USERNAME}/logs/docker-autoupdate.out' -errlog='/home/${ADMIN_USERNAME}/logs/docker-autoupdate.err' -echo \"Starting: \\\$(date)\" >> \"\\\${outlog}\" -echo \"Starting: \\\$(date)\" >> \"\\\${errlog}\" -sudo docker run --rm -v /var/run/docker.sock:/tmp/docker.sock oraclesorg/docker-run update >> \"\\\${outlog}\" 2>> \"\\\${errlog}\" -echo \"\" >> \"\\\${outlog}\" -echo \"\" >> \"\\\${errlog}\" -EOF" - sudo chmod 755 /etc/cron.daily/docker-autoupdate - echo "<===== setup_autoupdate" -} - configure_logrotate() { echo "=====> configure_logrotate" @@ -481,28 +321,20 @@ main () { sudo apt-get update prepare_homedir - #add_user_to_docker_group install_ntpd install_haveged allocate_swap install_nodejs - #install_docker_ce pull_image_and_configs - #start_docker - #use_deb use_deb_via_systemd - #use_bin - #setup_autoupdate - - #install_netstats install_netstats_via_systemd install_scripts configure_logrotate } main -echo "========== dev/mining-node/install.sh finished ==========" +echo "========== dev-mainnet/mining-node/install.sh finished ==========" diff --git a/TestTestNet/mining-node/node.toml b/TestTestNet/mining-node/node.toml index 798163d..cbc16d8 100644 --- a/TestTestNet/mining-node/node.toml +++ b/TestTestNet/mining-node/node.toml @@ -1,9 +1,8 @@ -# dev branch +# dev-mainnet branch [parity] chain = "spec.json" base_path = "parity" [network] -bootnodes=["enode://254f8ff247221e8355d5b5a03ad6523e88de1c89cb21fbb4ed42cc1d58be5f5f917c96b6d0bee69c756168c4e05fce11e68e1f65e8c6fcabd5c5d76763606b24@13.82.111.136:30300"] port = 30300 discovery=true [rpc] diff --git a/TestTestNet/netstats-server/install.sh b/TestTestNet/netstats-server/install.sh new file mode 100644 index 0000000..8c0720f --- /dev/null +++ b/TestTestNet/netstats-server/install.sh @@ -0,0 +1,458 @@ +#!/bin/bash +set -e +set -u +set -x + +EXT_IP="$(curl ifconfig.co)" + +# Install logentries daemon /* +start_logentries() { + echo "=====> start_logentries" + sudo bash -c "echo 'deb http://rep.logentries.com/ trusty main' > /etc/apt/sources.list.d/logentries.list" + sudo bash -c "gpg --keyserver pgp.mit.edu --recv-keys C43C79AD && gpg -a --export C43C79AD | apt-key add -" + sudo apt-get update + sudo apt-get install -y logentries + sudo le reinit --user-key=0665901a-e843-41c5-82c1-2cc4b39f0b21 --pull-server-side-config=False + + mkdir -p /home/${ADMIN_USERNAME}/logs + touch /home/${ADMIN_USERNAME}/logs/dashboard.err + touch /home/${ADMIN_USERNAME}/logs/dashboard.out + touch /home/${ADMIN_USERNAME}/logs/parity.log + touch /home/${ADMIN_USERNAME}/logs/netstats_daemon.err + touch /home/${ADMIN_USERNAME}/logs/netstats_daemon.out + touch /home/${ADMIN_USERNAME}/logs/explorer.err + touch /home/${ADMIN_USERNAME}/logs/explorer.out + touch /home/${ADMIN_USERNAME}/logs/parity.err + touch /home/${ADMIN_USERNAME}/logs/parity.out + + sudo bash -c "cat >> /etc/le/config << EOF +[install_err] +path = /var/lib/waagent/custom-script/download/0/stderr +destination = dev-mainnet/${EXT_IP} + +[install_out] +path = /var/lib/waagent/custom-script/download/0/stdout +destination = dev-mainnet/${EXT_IP} + +[dashboard_err] +path = /home/${ADMIN_USERNAME}/logs/dashboard.err +destination = dev-mainnet/${EXT_IP} + +[dashboard_out] +path = /home/${ADMIN_USERNAME}/logs/dashboard.out +destination = dev-mainnet/${EXT_IP} + +[parity_log] +path = /home/${ADMIN_USERNAME}/logs/parity.log +destination = dev-mainnet/${EXT_IP} + +[netstats_daemon_err] +path = /home/${ADMIN_USERNAME}/logs/netstats_daemon.err +destination = dev-mainnet/${EXT_IP} + +[netstats_daemon_out] +path = /home/${ADMIN_USERNAME}/logs/netstats_daemon.out +destination = dev-mainnet/${EXT_IP} + +[explorer_err] +path = /home/${ADMIN_USERNAME}/logs/explorer.err +destination = dev-mainnet/${EXT_IP} + +[explorer_out] +path = /home/${ADMIN_USERNAME}/logs/explorer.out +destination = dev-mainnet/${EXT_IP} + +[parity_err] +path = /home/${ADMIN_USERNAME}/logs/parity.err +destination = dev-mainnet/${EXT_IP} + +[parity_out] +path = /home/${ADMIN_USERNAME}/logs/parity.out +destination = dev-mainnet/${EXT_IP} + +EOF" + sudo apt-get install -y logentries-daemon + sudo service logentries start + echo "<===== start_logentries" +} + +start_logentries + +# */ + +echo "========== dev-mainnet/netstat-server/install.sh starting ==========" +echo "===== current time: $(date)" +echo "===== username: $(whoami)" +echo "===== working directory: $(pwd)" +echo "===== operating system info:" +lsb_release -a +echo "===== memory usage info:" +free -m +echo "===== external ip: ${EXT_IP}" + +echo "===== printenv:" +printenv +echo "===== env:" +env +echo "===== set:" +set +echo "===== declare -p:" +declare -p + +INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/dev/dev-mainnet/bootnode" +GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/master/spec.json" +GENESIS_JSON="spec.json" +NODE_TOML="node.toml" +NODE_PWD="node.pwd" + +echo "===== repo base path: ${INSTALL_CONFIG_REPO}" + +# this should be provided through env by azure template +NETSTATS_SECRET="${NETSTATS_SECRET}" +NODE_FULLNAME="${NODE_FULLNAME:-NetStat}" +NODE_ADMIN_EMAIL="${NODE_ADMIN_EMAIL:-somebody@somehere}" +ADMIN_USERNAME="${ADMIN_USERNAME}" + +export HOME="${HOME:-/home/${ADMIN_USERNAME}}" + +prepare_homedir() { + echo "=====> prepare_homedir" + # ln -s "$(pwd)" "/home/${ADMIN_USERNAME}/script-dir" + cd "/home/${ADMIN_USERNAME}" + echo "Now changed directory to: $(pwd)" + mkdir -p logs + mkdir -p logs/old + echo "<===== prepare_homedir" +} + +install_ntpd() { + echo "=====> install_ntpd" + sudo timedatectl set-ntp no + sudo apt-get -y install ntp + + sudo bash -c "cat > /etc/cron.hourly/ntpdate << EOF +#!/bin/sh +sudo service ntp stop +sudo ntpdate -s ntp.ubuntu.com +sudo service ntp start +EOF" + sudo chmod 755 /etc/cron.hourly/ntpdate + echo "<===== install_ntpd" +} + +install_haveged() { + echo "=====> install_haveged" + sudo apt-get -y install haveged + sudo update-rc.d haveged defaults + echo "<===== install_haveged" +} + +allocate_swap() { + echo "=====> allocate_swap" + sudo apt-get -y install bc + #sudo fallocate -l $(echo "$(free -b | awk '/Mem/{ print $2 }')*2" | bc -l) /swapfile + sudo fallocate -l 1G /swapfile + sudo chmod 600 /swapfile + sudo mkswap /swapfile + sudo swapon /swapfile + sudo sh -c "printf '/swapfile none swap sw 0 0\n' >> /etc/fstab" + sudo sh -c "printf 'vm.swappiness=10\n' >> /etc/sysctl.conf" + sudo sysctl vm.vfs_cache_pressure=50 + sudo sh -c "printf 'vm.vfs_cache_pressure = 50\n' >> /etc/sysctl.conf" + echo "<===== allocate_swap" +} + +pull_image_and_configs() { + echo "=====> pull_image_and_configs" + # curl -s -O "${INSTALL_CONFIG_REPO}/../${GENESIS_JSON}" + curl -s -o "${GENESIS_JSON}" "${GENESIS_REPO_LOC}" + curl -s -O "${INSTALL_CONFIG_REPO}/${NODE_TOML}" + sed -i "/\[network\]/a nat=\"extip:${EXT_IP}\"" ${NODE_TOML} + cat >> ${NODE_TOML} < 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 - + sudo apt-get update + sudo apt-get install -y build-essential git unzip wget nodejs ntp cloud-utils + + # add symlink if it doesn't exist + [[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node + echo "<===== install_nodejs" +} + +start_pm2_via_systemd() { + echo "=====> start_pm2_via_systemd" + sudo bash -c "cat > /etc/systemd/system/oracles-pm2.service < install_dashboard_via_systemd" + git clone https://github.com/oraclesorg/eth-netstats + cd eth-netstats + npm install + sudo npm install -g grunt-cli + sudo npm install pm2 -g + grunt + echo "[\"${NETSTATS_SECRET}\"]" > ws_secret.json + cd .. + + sudo bash -c "cat > /etc/systemd/system/oracles-dashboard.service < install_netstats_via_systemd" + git clone https://github.com/oraclesorg/eth-net-intelligence-api + cd eth-net-intelligence-api + #sed -i '/"web3"/c "web3": "0.19.x",' package.json + npm install + sudo npm install pm2 -g + + cat > app.json << EOL +[ + { + "name" : "netstats_daemon", + "script" : "app.js", + "log_date_format" : "YYYY-MM-DD HH:mm:SS Z", + "error_file" : "/home/${ADMIN_USERNAME}/logs/netstats_daemon.err", + "out_file" : "/home/${ADMIN_USERNAME}/logs/netstats_daemon.out", + "merge_logs" : false, + "watch" : false, + "max_restarts" : 100, + "exec_interpreter" : "node", + "exec_mode" : "fork_mode", + "env": + { + "NODE_ENV" : "production", + "RPC_HOST" : "localhost", + "RPC_PORT" : "8545", + "LISTENING_PORT" : "30300", + "INSTANCE_NAME" : "${NODE_FULLNAME}", + "CONTACT_DETAILS" : "${NODE_ADMIN_EMAIL}", + "WS_SERVER" : "http://localhost:3000", + "WS_SECRET" : "${NETSTATS_SECRET}", + "VERBOSITY" : 2 + } + } +] +EOL + cd .. + sudo bash -c "cat > /etc/systemd/system/oracles-netstats.service < install_chain_explorer_via_systemd" + git clone https://github.com/oraclesorg/chain-explorer + git clone https://github.com/ethereum/solc-bin chain-explorer/utils/solc-bin + cd chain-explorer + npm install + sudo npm install pm2 -g + cat > config.js < app.json << EOF +[ + { + "name" : "explorer", + "script" : "./bin/www", + "log_date_format" : "YYYY-MM-DD HH:mm:SS Z", + "error_file" : "/home/${ADMIN_USERNAME}/logs/explorer.err", + "out_file" : "/home/${ADMIN_USERNAME}/logs/explorer.out", + "merge_logs" : false, + "watch" : false, + "max_restarts" : 100, + "exec_interpreter" : "node", + "exec_mode" : "fork_mode", + "env": + { + "NODE_ENV" : "production", + "PORT" : 4000, + } + } +] +EOF + cd .. + sudo bash -c "cat > /etc/systemd/system/oracles-chain-explorer.service < use_deb_via_systemd" + curl -LO 'http://parity-downloads-mirror.parity.io/v1.7.0/x86_64-unknown-linux-gnu/parity_1.7.0_amd64.deb' + sudo dpkg -i parity_1.7.0_amd64.deb + + #curl -LO 'http://d1h4xl4cr1h0mo.cloudfront.net/nightly/x86_64-unknown-debian-gnu/parity_1.8.0_amd64.deb' + #sudo dpkg -i parity_1.8.0_amd64.deb + + sudo bash -c "cat > /etc/systemd/system/oracles-parity.service < configure_logrotate" + + sudo bash -c "cat > /etc/logrotate.d/oracles.conf << EOF +/home/${ADMIN_USERNAME}/logs/*.log { + rotate 10 + size 200M + missingok + compress + copytruncate + dateext + dateformat %Y-%m-%d-%s + olddir old +} +/home/${ADMIN_USERNAME}/.pm2/pm2.log { + su ${ADMIN_USERNAME} ${ADMIN_USERNAME} + rotate 10 + size 200M + missingok + compress + copytruncate + dateext + dateformat %Y-%m-%d-%s +} +EOF" + echo "<===== configure_logrotate" +} + +# MAIN +main () { + sudo apt-get update + + prepare_homedir + install_ntpd + install_haveged + allocate_swap + + install_nodejs + pull_image_and_configs + clone_dapps + + use_deb_via_systemd + install_dashboard_via_systemd + + start_pm2_via_systemd + install_netstats_via_systemd + install_chain_explorer_via_systemd + + configure_logrotate + + download_initial_keys_script +} + +main +echo "========== dev-mainnet/netstats-server/install.sh finished ==========" diff --git a/TestTestNet/netstats-server/node.toml b/TestTestNet/netstats-server/node.toml new file mode 100644 index 0000000..2a8b5e6 --- /dev/null +++ b/TestTestNet/netstats-server/node.toml @@ -0,0 +1,38 @@ +# dev-mainnet branch +[parity] +chain = "spec.json" +base_path = "parity" +[network] +port = 30300 +discovery=true +[rpc] +cors = "all" +interface = "all" +hosts = ["all"] +port = 8545 +apis = ["web3", "eth", "net", "personal", "parity", "parity_set", "traces", "rpc", "parity_accounts"] +[ui] +interface = "0.0.0.0" +port = 8180 +[websockets] +disable = false +port = 8546 +interface = "all" +origins = ["all"] +apis = ["web3", "eth", "net", "parity", "traces", "rpc", "secretstore"] +hosts = ["all"] +[dapps] +cors = "all" +interface = "0.0.0.0" +hosts = ["all"] +port = 8080 +[account] +password = ["node.pwd"] +[mining] +force_sealing = true +engine_signer = "0xDd0BB0e2a1594240fED0c2f2c17C1E9AB4F87126" +reseal_on_txs = "none" +[footprint] +tracing = "on" +pruning = "archive" +fat_db = "on" diff --git a/TestTestNet/netstats-server/template.json b/TestTestNet/netstats-server/template.json new file mode 100644 index 0000000..f2716f0 --- /dev/null +++ b/TestTestNet/netstats-server/template.json @@ -0,0 +1,232 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "nodeFullName": { + "type": "string", + "metadata": { + "description": "Node full name (publicly visible)" + } + }, + "nodeAdminEmail": { + "type": "string", + "metadata": { + "description": "Node admin email (publicly visible)" + } + }, + "adminUsername": { + "type": "string", + "metadata": { + "description": "Username for the Virtual Machine" + } + }, + "sshPublicKey": { + "type": "string", + "metadata": { + "description": "SSH public key for the Virtual Machine" + } + }, + "netstatsSecret": { + "type": "secureString", + "metadata": { + "description": "NetStats net code" + } + } + }, + "variables": { + "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'salinuxvm')]", + "imagePublisher": "Canonical", + "imageOffer": "UbuntuServer", + "nicName": "myVMNic", + "addressPrefix": "10.0.0.0/16", + "subnetName": "Subnet", + "subnetPrefix": "10.0.0.0/24", + "storageAccountType": "Standard_LRS", + "publicIPAddressName": "myPublicIP", + "publicIPAddressType": "Static", + "vmName": "MyUbuntuVM", + "vmSize": "Standard_A1", + "virtualNetworkName": "MyVNET", + "vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]", + "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", + "ubuntuOSVersion": "16.04.0-LTS", + "dnsLabelPrefix": "[concat('musereum-bn-', uniqueString(parameters('nodeFullName')))]", + "adminUsername": "[trim(toLower(parameters('adminUsername')))]", + "sshPublicKey": "[trim(parameters('sshPublicKey'))]", + "nodeFullName": "[trim(parameters('nodeFullName'))]", + "nodeAdminEmail": "[trim(parameters('nodeAdminEmail'))]", + "netstatsSecret": "[trim(parameters('netstatsSecret'))]" + }, + "resources": [ + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[variables('storageAccountName')]", + "apiVersion": "2017-06-01", + "location": "[resourceGroup().location]", + "sku": { + "name": "[variables('storageAccountType')]" + }, + "kind": "Storage", + "properties": {} + }, + { + "apiVersion": "2017-04-01", + "type": "Microsoft.Network/publicIPAddresses", + "name": "[variables('publicIPAddressName')]", + "location": "[resourceGroup().location]", + "properties": { + "publicIPAllocationMethod": "[variables('publicIPAddressType')]", + "dnsSettings": { + "domainNameLabel": "[variables('dnsLabelPrefix')]" + } + } + }, + { + "apiVersion": "2017-04-01", + "type": "Microsoft.Network/virtualNetworks", + "name": "[variables('virtualNetworkName')]", + "location": "[resourceGroup().location]", + "properties": { + "addressSpace": { + "addressPrefixes": [ + "[variables('addressPrefix')]" + ] + }, + "subnets": [ + { + "name": "[variables('subnetName')]", + "properties": { + "addressPrefix": "[variables('subnetPrefix')]" + } + } + ] + } + }, + { + "apiVersion": "2017-04-01", + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicName')]", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" + ], + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" + }, + "subnet": { + "id": "[variables('subnetRef')]" + } + } + } + ] + } + }, + { + "apiVersion": "2017-03-30", + "type": "Microsoft.Compute/virtualMachines", + "name": "[variables('vmName')]", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]", + "[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[variables('vmSize')]" + }, + "osProfile": { + "computerName": "[variables('vmName')]", + "adminUsername": "[variables('adminUsername')]", + "adminPassword": "", + "linuxConfiguration": { + "disablePasswordAuthentication": true, + "ssh": { + "publicKeys": [ + { + "path": "[concat('/home/', variables('adminUsername'), '/.ssh/authorized_keys')]", + "keyData": "[variables('sshPublicKey')]" + } + ] + } + } + }, + "storageProfile": { + "imageReference": { + "publisher": "[variables('imagePublisher')]", + "offer": "[variables('imageOffer')]", + "sku": "[variables('ubuntuOSVersion')]", + "version": "latest" + }, + "osDisk": { + "createOption": "FromImage" + }, + "dataDisks": [ + { + "diskSizeGB": "128", + "lun": 0, + "createOption": "Empty" + } + ] + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]" + } + ] + }, + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": "true", + "storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), '2016-01-01').primaryEndpoints.blob)]" + } + } + }, + "resources": [ + { + "apiVersion": "2015-06-15", + "type": "extensions", + "name": "config-app", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]" + ], + "tags": { + "displayName": "config-app" + }, + "properties": { + "publisher": "Microsoft.Azure.Extensions", + "type": "CustomScript", + "typeHandlerVersion": "2.0", + "autoUpgradeMinorVersion": true, + "settings": { + "fileUris": [ + "https://raw.githubusercontent.com/oraclesorg/test-templates/dev/dev-mainnet/bootnode/install.sh" + ] + }, + "protectedSettings": { + "commandToExecute": "[concat('cp install.sh /home/', variables('adminUsername'), '/; cd /home/', variables('adminUsername'), '; chown ', variables('adminUsername'), ':', variables('adminUsername'), ' install.sh; chmod +x install.sh; ADMIN_USERNAME=\"', variables('adminUsername'), '\" NETSTATS_SECRET=\"', variables('netstatsSecret'), '\" NODE_FULLNAME=\"', variables('nodeFullName'), '\" NODE_ADMIN_EMAIL=\"', variables('nodeAdminEmail'), '\" sudo -u ', variables('adminUsername'), ' -E -H ./install.sh')]" + } + } + } + ] + } + ], + "outputs": { + "hostname": { + "type": "string", + "value": "[reference(variables('publicIPAddressName')).dnsSettings.fqdn]" + }, + "sshCommand": { + "type": "string", + "value": "[concat('ssh ', variables('adminUsername'), '@', reference(variables('publicIPAddressName')).dnsSettings.fqdn)]" + } + } +}