Refactor common vars
This commit is contained in:
parent
fb4b45ee48
commit
5d23009735
|
@ -3,9 +3,9 @@ set -e
|
||||||
set -u
|
set -u
|
||||||
set -x
|
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 "===== current time: $(date)"
|
||||||
echo "===== username: $(whoami)"
|
echo "===== username: $(whoami)"
|
||||||
echo "===== working directory: $(pwd)"
|
echo "===== working directory: $(pwd)"
|
||||||
|
@ -13,18 +13,23 @@ echo "===== operating system info:"
|
||||||
lsb_release -a
|
lsb_release -a
|
||||||
echo "===== memory usage info:"
|
echo "===== memory usage info:"
|
||||||
free -m
|
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 "===== external ip: ${EXT_IP}"
|
||||||
|
|
||||||
echo "===== environmental variables:"
|
echo "===== environmental variables:"
|
||||||
printenv
|
printenv
|
||||||
|
|
||||||
INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/bootnode"
|
INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/TestTestNet/bootnode"
|
||||||
GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/sokol/spec.json"
|
GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/${SCRIPTS_BRANCH}/spec.json"
|
||||||
GENESIS_JSON="spec.json"
|
GENESIS_JSON="spec.json"
|
||||||
NODE_TOML="node.toml"
|
NODE_TOML="node.toml"
|
||||||
BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/bootnodes.txt"
|
BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/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"
|
NGINX_FILE_LOC="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/TestTestNet/bootnode/nginx.default.site"
|
||||||
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"
|
|
||||||
|
|
||||||
echo "===== repo base path: ${INSTALL_CONFIG_REPO}"
|
echo "===== repo base path: ${INSTALL_CONFIG_REPO}"
|
||||||
|
|
||||||
|
@ -114,24 +119,23 @@ pull_image_and_configs() {
|
||||||
[misc]
|
[misc]
|
||||||
log_file = "/home/${ADMIN_USERNAME}/logs/parity.log"
|
log_file = "/home/${ADMIN_USERNAME}/logs/parity.log"
|
||||||
EOF
|
EOF
|
||||||
mkdir -p parity/keys/OraclesPoA
|
mkdir -p parity_data/keys/OraclesPoA
|
||||||
|
|
||||||
echo "<===== pull_image_and_configs"
|
echo "<===== pull_image_and_configs"
|
||||||
}
|
}
|
||||||
|
|
||||||
clone_dapps() {
|
clone_dapps() {
|
||||||
echo "=====> clone_dapps"
|
echo "=====> clone_dapps"
|
||||||
mkdir -p parity/dapps
|
mkdir -p parity_data/dapps
|
||||||
git clone https://github.com/oraclesorg/oracles-dapps-keys-generation.git parity/dapps/KeysGenerator
|
git clone -b ${DAPPS_BRANCH} --single-branch https://github.com/oraclesorg/oracles-dapps-keys-generation.git parity_data/dapps/KeysGenerator
|
||||||
git clone https://github.com/oraclesorg/oracles-dapps-voting.git parity/dapps/Voting
|
git clone -b ${DAPPS_BRANCH} --single-branch https://github.com/oraclesorg/oracles-dapps-voting.git parity_data/dapps/Voting
|
||||||
git clone https://github.com/oraclesorg/oracles-dapps-validators.git parity/dapps/ValidatorsList
|
git clone -b ${DAPPS_BRANCH} --single-branch https://github.com/oraclesorg/oracles-dapps-validators.git parity_data/dapps/ValidatorsList
|
||||||
echo "<===== clone_dapps"
|
echo "<===== clone_dapps"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_nodejs() {
|
install_nodejs() {
|
||||||
echo "=====> install_nodejs"
|
echo "=====> install_nodejs"
|
||||||
# curl -sL https://deb.nodesource.com/setup_0.12 | bash -
|
curl -sL ${NODE_SOURCE_DEB} | sudo -E bash -
|
||||||
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y build-essential git unzip wget nodejs ntp cloud-utils
|
sudo apt-get install -y build-essential git unzip wget nodejs ntp cloud-utils
|
||||||
|
|
||||||
|
@ -244,8 +248,8 @@ EOF"
|
||||||
|
|
||||||
use_bin_via_systemd() {
|
use_bin_via_systemd() {
|
||||||
echo "=====> use_bin_via_systemd"
|
echo "=====> use_bin_via_systemd"
|
||||||
curl -o parity-nouncles -L "${PARITY_BIN_LOC}"
|
curl -o parity -L "${PARITY_BIN_LOC}"
|
||||||
chmod +x parity-nouncles
|
chmod +x parity
|
||||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
|
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libstdc++6
|
sudo apt-get install -y libstdc++6
|
||||||
|
@ -257,7 +261,7 @@ After=network.target
|
||||||
User=${ADMIN_USERNAME}
|
User=${ADMIN_USERNAME}
|
||||||
Group=${ADMIN_USERNAME}
|
Group=${ADMIN_USERNAME}
|
||||||
WorkingDirectory=/home/${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
|
Restart=always
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
@ -303,15 +307,6 @@ EOF"
|
||||||
echo "<===== configure_logrotate"
|
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() {
|
gen_certs() {
|
||||||
echo "=====> gen_certs"
|
echo "=====> gen_certs"
|
||||||
mkdir certs
|
mkdir certs
|
||||||
|
@ -342,8 +337,14 @@ main () {
|
||||||
pull_image_and_configs
|
pull_image_and_configs
|
||||||
clone_dapps
|
clone_dapps
|
||||||
|
|
||||||
#use_deb_via_systemd
|
if [ "${PARITY_INSTALLATION_MODE}" = "BIN" ]; then
|
||||||
use_bin_via_systemd
|
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
|
gen_certs
|
||||||
install_nginx
|
install_nginx
|
||||||
|
@ -352,9 +353,7 @@ main () {
|
||||||
install_netstats_via_systemd
|
install_netstats_via_systemd
|
||||||
|
|
||||||
configure_logrotate
|
configure_logrotate
|
||||||
|
|
||||||
#download_initial_keys_script
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
echo "========== dev-mainnet/bootnode/install.sh finished =========="
|
echo "========== ${TEMPLATES_BRANCH}/bootnode/install.sh finished =========="
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# dev-mainnet branch
|
# dev-mainnet branch
|
||||||
[parity]
|
[parity]
|
||||||
chain = "spec.json"
|
chain = "spec.json"
|
||||||
base_path = "parity"
|
base_path = "parity_data"
|
||||||
[network]
|
[network]
|
||||||
port = 30303
|
port = 30303
|
||||||
[rpc]
|
[rpc]
|
||||||
|
|
|
@ -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"
|
|
@ -3,9 +3,9 @@ set -e
|
||||||
set -u
|
set -u
|
||||||
set -x
|
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 "===== current time: $(date)"
|
||||||
echo "===== username: $(whoami)"
|
echo "===== username: $(whoami)"
|
||||||
echo "===== working directory: $(pwd)"
|
echo "===== working directory: $(pwd)"
|
||||||
|
@ -13,18 +13,24 @@ echo "===== operating system info:"
|
||||||
lsb_release -a
|
lsb_release -a
|
||||||
echo "===== memory usage info:"
|
echo "===== memory usage info:"
|
||||||
free -m
|
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 "===== external ip: ${EXT_IP}"
|
||||||
|
|
||||||
echo "===== environmental variables:"
|
echo "===== environmental variables:"
|
||||||
printenv
|
printenv
|
||||||
|
|
||||||
# script parameters
|
# script parameters
|
||||||
INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/mining-node"
|
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/sokol/spec.json"
|
GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/${SCRIPTS_BRANCH}/spec.json"
|
||||||
GENESIS_JSON="spec.json"
|
GENESIS_JSON="spec.json"
|
||||||
NODE_TOML="node.toml"
|
NODE_TOML="node.toml"
|
||||||
NODE_PWD="node.pwd"
|
NODE_PWD="node.pwd"
|
||||||
BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/bootnodes.txt"
|
BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/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"
|
|
||||||
|
|
||||||
export HOME="${HOME:-/home/${ADMIN_USERNAME}}"
|
export HOME="${HOME:-/home/${ADMIN_USERNAME}}"
|
||||||
|
|
||||||
|
@ -68,7 +74,6 @@ setup_ufw() {
|
||||||
echo "=====> setup_ufw"
|
echo "=====> setup_ufw"
|
||||||
sudo sudo ufw enable
|
sudo sudo ufw enable
|
||||||
sudo ufw default deny incoming
|
sudo ufw default deny incoming
|
||||||
sudo ufw allow 443
|
|
||||||
sudo ufw allow 8545
|
sudo ufw allow 8545
|
||||||
sudo ufw allow 22/tcp
|
sudo ufw allow 22/tcp
|
||||||
sudo ufw allow 30303/tcp
|
sudo ufw allow 30303/tcp
|
||||||
|
@ -122,8 +127,7 @@ allocate_swap() {
|
||||||
|
|
||||||
install_nodejs() {
|
install_nodejs() {
|
||||||
echo "=====> install_nodejs"
|
echo "=====> install_nodejs"
|
||||||
# curl -sL https://deb.nodesource.com/setup_0.12 | bash -
|
curl -sL ${NODE_SOURCE_DEB} | sudo -E bash -
|
||||||
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y build-essential git unzip wget nodejs ntp cloud-utils
|
sudo apt-get install -y build-essential git unzip wget nodejs ntp cloud-utils
|
||||||
|
|
||||||
|
@ -132,7 +136,6 @@ install_nodejs() {
|
||||||
echo "<===== install_nodejs"
|
echo "<===== install_nodejs"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pull_image_and_configs() {
|
pull_image_and_configs() {
|
||||||
echo "=====> pull_image_and_configs"
|
echo "=====> pull_image_and_configs"
|
||||||
|
|
||||||
|
@ -155,8 +158,8 @@ engine_signer = "${MINING_ADDRESS}"
|
||||||
reseal_on_txs = "none"
|
reseal_on_txs = "none"
|
||||||
EOF
|
EOF
|
||||||
echo "${MINING_KEYPASS}" > "${NODE_PWD}"
|
echo "${MINING_KEYPASS}" > "${NODE_PWD}"
|
||||||
mkdir -p parity/keys/OraclesPoA
|
mkdir -p parity_data/keys/OraclesPoA
|
||||||
echo ${MINING_KEYFILE} | base64 -d > parity/keys/OraclesPoA/mining.key.${MINING_ADDRESS}
|
echo ${MINING_KEYFILE} | base64 -d > parity_data/keys/OraclesPoA/mining.key.${MINING_ADDRESS}
|
||||||
echo "<===== pull_image_and_configs"
|
echo "<===== pull_image_and_configs"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,9 +272,34 @@ EOF"
|
||||||
echo "<===== use_deb_via_systemd"
|
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 <<EOF
|
||||||
|
[Unit]
|
||||||
|
Description=oracles parity service
|
||||||
|
After=network.target
|
||||||
|
[Service]
|
||||||
|
User=${ADMIN_USERNAME}
|
||||||
|
Group=${ADMIN_USERNAME}
|
||||||
|
WorkingDirectory=/home/${ADMIN_USERNAME}
|
||||||
|
ExecStart=/home/${ADMIN_USERNAME}/parity --config=node.toml
|
||||||
|
Restart=always
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF"
|
||||||
|
sudo systemctl enable oracles-parity
|
||||||
|
sudo systemctl start oracles-parity
|
||||||
|
echo "<===== use_bin_via_systemd"
|
||||||
|
}
|
||||||
|
|
||||||
install_scripts() {
|
install_scripts() {
|
||||||
echo "=====> install_scripts"
|
echo "=====> 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
|
ln -s ../node.toml oracles-scripts/node.toml
|
||||||
cd oracles-scripts/scripts
|
cd oracles-scripts/scripts
|
||||||
npm install
|
npm install
|
||||||
|
@ -340,7 +368,14 @@ main () {
|
||||||
install_nodejs
|
install_nodejs
|
||||||
pull_image_and_configs
|
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
|
start_pm2_via_systemd
|
||||||
install_netstats_via_systemd
|
install_netstats_via_systemd
|
||||||
|
@ -349,4 +384,4 @@ main () {
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
echo "========== dev-mainnet/mining-node/install.sh finished =========="
|
echo "========== ${TEMPLATES_BRANCH}/mining-node/install.sh finished =========="
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# dev-mainnet branch
|
# dev-mainnet branch
|
||||||
[parity]
|
[parity]
|
||||||
chain = "spec.json"
|
chain = "spec.json"
|
||||||
base_path = "parity"
|
base_path = "parity_data"
|
||||||
[network]
|
[network]
|
||||||
port = 30303
|
port = 30303
|
||||||
[rpc]
|
[rpc]
|
||||||
|
|
|
@ -299,19 +299,6 @@
|
||||||
"destinationPortRange": "30303"
|
"destinationPortRange": "30303"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "allow-https",
|
|
||||||
"properties": {
|
|
||||||
"priority": 1300,
|
|
||||||
"direction": "Inbound",
|
|
||||||
"sourceAddressPrefix": "*",
|
|
||||||
"sourcePortRange": "*",
|
|
||||||
"protocol": "*",
|
|
||||||
"access": "Allow",
|
|
||||||
"destinationAddressPrefix": "*",
|
|
||||||
"destinationPortRange": "443"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "disallow-other",
|
"name": "disallow-other",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
@ -3,9 +3,9 @@ set -e
|
||||||
set -u
|
set -u
|
||||||
set -x
|
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 "===== current time: $(date)"
|
||||||
echo "===== username: $(whoami)"
|
echo "===== username: $(whoami)"
|
||||||
echo "===== working directory: $(pwd)"
|
echo "===== working directory: $(pwd)"
|
||||||
|
@ -13,16 +13,19 @@ echo "===== operating system info:"
|
||||||
lsb_release -a
|
lsb_release -a
|
||||||
echo "===== memory usage info:"
|
echo "===== memory usage info:"
|
||||||
free -m
|
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:"
|
echo "===== environmental variables:"
|
||||||
printenv
|
printenv
|
||||||
|
|
||||||
INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/bootnode"
|
INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/TestTestNet/bootnode"
|
||||||
GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/sokol/spec.json"
|
GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/${SCRIPTS_BRANCH}/spec.json"
|
||||||
GENESIS_JSON="spec.json"
|
GENESIS_JSON="spec.json"
|
||||||
NODE_TOML="node.toml"
|
NODE_TOML="node.toml"
|
||||||
BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/bootnodes.txt"
|
BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/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"
|
|
||||||
|
|
||||||
echo "===== repo base path: ${INSTALL_CONFIG_REPO}"
|
echo "===== repo base path: ${INSTALL_CONFIG_REPO}"
|
||||||
|
|
||||||
|
@ -111,24 +114,15 @@ pull_image_and_configs() {
|
||||||
[misc]
|
[misc]
|
||||||
log_file = "/home/${ADMIN_USERNAME}/logs/parity.log"
|
log_file = "/home/${ADMIN_USERNAME}/logs/parity.log"
|
||||||
EOF
|
EOF
|
||||||
mkdir -p parity/keys/OraclesPoA
|
mkdir -p parity_data/keys/OraclesPoA
|
||||||
|
|
||||||
echo "<===== pull_image_and_configs"
|
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() {
|
install_nodejs() {
|
||||||
echo "=====> install_nodejs"
|
echo "=====> install_nodejs"
|
||||||
# curl -sL https://deb.nodesource.com/setup_0.12 | bash -
|
# 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 update
|
||||||
sudo apt-get install -y build-essential git unzip wget nodejs ntp cloud-utils
|
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 () {
|
var config = function () {
|
||||||
this.logFormat = "combined";
|
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.provider = new web3.providers.IpcProvider(this.ipcPath, net);
|
||||||
this.bootstrapUrl = "https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/yeti/bootstrap.min.css";
|
this.bootstrapUrl = "https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/yeti/bootstrap.min.css";
|
||||||
this.names = {
|
this.names = {
|
||||||
|
@ -372,6 +366,31 @@ EOF"
|
||||||
echo "<===== configure_logrotate"
|
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 <<EOF
|
||||||
|
[Unit]
|
||||||
|
Description=oracles parity service
|
||||||
|
After=network.target
|
||||||
|
[Service]
|
||||||
|
User=${ADMIN_USERNAME}
|
||||||
|
Group=${ADMIN_USERNAME}
|
||||||
|
WorkingDirectory=/home/${ADMIN_USERNAME}
|
||||||
|
ExecStart=/home/${ADMIN_USERNAME}/parity --config=node.toml
|
||||||
|
Restart=always
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF"
|
||||||
|
sudo systemctl enable oracles-parity
|
||||||
|
sudo systemctl start oracles-parity
|
||||||
|
echo "<===== use_bin_via_systemd"
|
||||||
|
}
|
||||||
|
|
||||||
# MAIN
|
# MAIN
|
||||||
main () {
|
main () {
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
@ -385,9 +404,15 @@ main () {
|
||||||
|
|
||||||
install_nodejs
|
install_nodejs
|
||||||
pull_image_and_configs
|
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
|
start_pm2_via_systemd
|
||||||
|
|
||||||
|
@ -399,4 +424,4 @@ main () {
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
echo "========== dev-mainnet/netstats-server/install.sh finished =========="
|
echo "========== ${TEMPLATES_BRANCH}/netstats-server/install.sh finished =========="
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# dev-mainnet branch
|
# dev-mainnet branch
|
||||||
[parity]
|
[parity]
|
||||||
chain = "spec.json"
|
chain = "spec.json"
|
||||||
base_path = "parity"
|
base_path = "parity_data"
|
||||||
[network]
|
[network]
|
||||||
port = 30303
|
port = 30303
|
||||||
[footprint]
|
[footprint]
|
||||||
|
|
|
@ -3,9 +3,9 @@ set -e
|
||||||
set -u
|
set -u
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
EXT_IP="$(curl ifconfig.co)"
|
TEMPLATES_BRANCH="dev-mainnet"
|
||||||
|
|
||||||
echo "========== dev-mainnet/owner/install.sh starting =========="
|
echo "========== ${TEMPLATES_BRANCH}/owner/install.sh starting =========="
|
||||||
echo "===== current time: $(date)"
|
echo "===== current time: $(date)"
|
||||||
echo "===== username: $(whoami)"
|
echo "===== username: $(whoami)"
|
||||||
echo "===== working directory: $(pwd)"
|
echo "===== working directory: $(pwd)"
|
||||||
|
@ -13,17 +13,20 @@ echo "===== operating system info:"
|
||||||
lsb_release -a
|
lsb_release -a
|
||||||
echo "===== memory usage info:"
|
echo "===== memory usage info:"
|
||||||
free -m
|
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:"
|
echo "===== environmental variables:"
|
||||||
printenv
|
printenv
|
||||||
|
|
||||||
INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/owner"
|
INSTALL_CONFIG_REPO="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/TestTestNet/owner"
|
||||||
GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/sokol/spec.json"
|
GENESIS_REPO_LOC="https://raw.githubusercontent.com/oraclesorg/oracles-scripts/${SCRIPTS_BRANCH}/spec.json"
|
||||||
GENESIS_JSON="spec.json"
|
GENESIS_JSON="spec.json"
|
||||||
NODE_TOML="node.toml"
|
NODE_TOML="node.toml"
|
||||||
NODE_PWD="node.pwd"
|
NODE_PWD="node.pwd"
|
||||||
BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/dev-mainnet/TestTestNet/bootnodes.txt"
|
BOOTNODES_TXT="https://raw.githubusercontent.com/oraclesorg/test-templates/${TEMPLATES_BRANCH}/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"
|
|
||||||
|
|
||||||
export HOME="${HOME:-/home/${ADMIN_USERNAME}}"
|
export HOME="${HOME:-/home/${ADMIN_USERNAME}}"
|
||||||
|
|
||||||
|
@ -52,7 +55,6 @@ setup_ufw() {
|
||||||
echo "=====> setup_ufw"
|
echo "=====> setup_ufw"
|
||||||
sudo sudo ufw enable
|
sudo sudo ufw enable
|
||||||
sudo ufw default deny incoming
|
sudo ufw default deny incoming
|
||||||
sudo ufw allow 443
|
|
||||||
sudo ufw allow 8545
|
sudo ufw allow 8545
|
||||||
sudo ufw allow 22/tcp
|
sudo ufw allow 22/tcp
|
||||||
sudo ufw allow 30303/tcp
|
sudo ufw allow 30303/tcp
|
||||||
|
@ -114,27 +116,24 @@ pull_image_and_configs() {
|
||||||
cat >> ${NODE_TOML} <<EOF
|
cat >> ${NODE_TOML} <<EOF
|
||||||
[misc]
|
[misc]
|
||||||
log_file = "/home/${ADMIN_USERNAME}/logs/parity.log"
|
log_file = "/home/${ADMIN_USERNAME}/logs/parity.log"
|
||||||
|
[account]
|
||||||
|
password = ["${NODE_PWD}"]
|
||||||
|
unlock = ["${MINING_ADDRESS}"]
|
||||||
|
[mining]
|
||||||
|
force_sealing = true
|
||||||
|
engine_signer = "${OWNER_ADDRESS}"
|
||||||
|
reseal_on_txs = "none"
|
||||||
EOF
|
EOF
|
||||||
echo "${OWNER_KEYPASS}" > "${NODE_PWD}"
|
echo "${OWNER_KEYPASS}" > "${NODE_PWD}"
|
||||||
mkdir -p parity/keys/OraclesPoA
|
mkdir -p parity_data/keys/OraclesPoA
|
||||||
echo ${OWNER_KEYFILE} | base64 -d > parity/keys/OraclesPoA/owner.key
|
echo ${OWNER_KEYFILE} | base64 -d > parity_data/keys/OraclesPoA/owner.key
|
||||||
|
|
||||||
echo "<===== pull_image_and_configs"
|
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() {
|
install_nodejs() {
|
||||||
echo "=====> install_nodejs"
|
echo "=====> install_nodejs"
|
||||||
# curl -sL https://deb.nodesource.com/setup_0.12 | bash -
|
curl -sL ${NODE_SOURCE_DEB} | sudo -E bash -
|
||||||
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y build-essential git unzip wget nodejs ntp cloud-utils
|
sudo apt-get install -y build-essential git unzip wget nodejs ntp cloud-utils
|
||||||
|
|
||||||
|
@ -246,6 +245,31 @@ EOF"
|
||||||
echo "<===== use_deb_via_systemd"
|
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 <<EOF
|
||||||
|
[Unit]
|
||||||
|
Description=oracles parity service
|
||||||
|
After=network.target
|
||||||
|
[Service]
|
||||||
|
User=${ADMIN_USERNAME}
|
||||||
|
Group=${ADMIN_USERNAME}
|
||||||
|
WorkingDirectory=/home/${ADMIN_USERNAME}
|
||||||
|
ExecStart=/home/${ADMIN_USERNAME}/parity --config=node.toml
|
||||||
|
Restart=always
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF"
|
||||||
|
sudo systemctl enable oracles-parity
|
||||||
|
sudo systemctl start oracles-parity
|
||||||
|
echo "<===== use_bin_via_systemd"
|
||||||
|
}
|
||||||
|
|
||||||
configure_logrotate() {
|
configure_logrotate() {
|
||||||
echo "=====> configure_logrotate"
|
echo "=====> configure_logrotate"
|
||||||
|
|
||||||
|
@ -284,7 +308,7 @@ EOF"
|
||||||
|
|
||||||
download_initial_keys_script() {
|
download_initial_keys_script() {
|
||||||
echo "=====> 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
|
cd oracles-initial-keys
|
||||||
npm install
|
npm install
|
||||||
cd ..
|
cd ..
|
||||||
|
@ -304,9 +328,15 @@ main () {
|
||||||
|
|
||||||
install_nodejs
|
install_nodejs
|
||||||
pull_image_and_configs
|
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
|
start_pm2_via_systemd
|
||||||
install_netstats_via_systemd
|
install_netstats_via_systemd
|
||||||
|
@ -317,4 +347,4 @@ main () {
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
echo "========== dev-mainnet/owner/install.sh finished =========="
|
echo "========== ${TEMPLATES_BRANCH}/owner/install.sh finished =========="
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
# dev-mainnet branch
|
# dev-mainnet branch
|
||||||
[parity]
|
[parity]
|
||||||
chain = "spec.json"
|
chain = "spec.json"
|
||||||
base_path = "parity"
|
base_path = "parity_data"
|
||||||
[network]
|
[network]
|
||||||
port = 30303
|
port = 30303
|
||||||
[rpc]
|
[rpc]
|
||||||
apis = ["web3", "eth", "parity", "parity_set", "net", "traces", "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"
|
|
||||||
|
|
|
@ -291,19 +291,6 @@
|
||||||
"destinationPortRange": "30303"
|
"destinationPortRange": "30303"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "allow-https",
|
|
||||||
"properties": {
|
|
||||||
"priority": 1300,
|
|
||||||
"direction": "Inbound",
|
|
||||||
"sourceAddressPrefix": "*",
|
|
||||||
"sourcePortRange": "*",
|
|
||||||
"protocol": "*",
|
|
||||||
"access": "Allow",
|
|
||||||
"destinationAddressPrefix": "*",
|
|
||||||
"destinationPortRange": "443"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "disallow-other",
|
"name": "disallow-other",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
Loading…
Reference in New Issue