From c2603d0aadf63b3c32574b77b911475a7afbc0bc Mon Sep 17 00:00:00 2001 From: surugh <35753081+surugh@users.noreply.github.com> Date: Fri, 15 Oct 2021 05:16:08 +0300 Subject: [PATCH 01/15] Update installer.sh --- installer.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/installer.sh b/installer.sh index 1a677f9..8fddf2e 100644 --- a/installer.sh +++ b/installer.sh @@ -2,7 +2,6 @@ # REPLACE DEMO VALUES WITH YOUR VALUES NAME=DEMO_NODE_NAME -RPC_URL=DEMO_UNIQUE_RPC_URL NGROK_TOKEN=DEMO_NGROK_TOKEN echo "Setting up Humanode service..." @@ -10,7 +9,7 @@ apt install curl jq -y # Make Humanode startup script printf "exec 1> >(logger -t humanode) 2>&1 -exec /usr/local/bin/humanode-peer --name "$NAME" --validator --chain chainspec.json --rpc-url "$RPC_URL" --rpc-cors all" > $HOME/humanode/start.sh +exec /usr/local/bin/humanode-peer --name "$NAME" --validator --chain chainspec.json --rpc-url-ngrok-detect --rpc-cors all" > $HOME/humanode/start.sh chmod +x $HOME/humanode/start.sh # Create Humanode service From 49ddde0b68954fa0d3450f314500b7ee5d5da2ef Mon Sep 17 00:00:00 2001 From: surugh <35753081+surugh@users.noreply.github.com> Date: Fri, 15 Oct 2021 06:45:56 +0300 Subject: [PATCH 02/15] Update installer.sh --- installer.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/installer.sh b/installer.sh index 8fddf2e..180dc29 100644 --- a/installer.sh +++ b/installer.sh @@ -2,14 +2,22 @@ # REPLACE DEMO VALUES WITH YOUR VALUES NAME=DEMO_NODE_NAME +RPC_URL=DEMO_UNIQUE_RPC_URL NGROK_TOKEN=DEMO_NGROK_TOKEN +SECRET_PHRASE=DEMO_SECRET_PHRASE echo "Setting up Humanode service..." apt install curl jq -y +#move humanode folder to /root +cp humanode /root + +install -m 0755 "./binaries/$(uname -s)-$(uname -m)/humanode-peer" /usr/local/bin +humanode-peer key insert --key-type aura --suri "$SECRET_PHRASE" --chain chainspec.json + # Make Humanode startup script printf "exec 1> >(logger -t humanode) 2>&1 -exec /usr/local/bin/humanode-peer --name "$NAME" --validator --chain chainspec.json --rpc-url-ngrok-detect --rpc-cors all" > $HOME/humanode/start.sh +exec /usr/local/bin/humanode-peer --name "$NAME" --validator --chain chainspec.json --rpc-url "$RPC_URL" --rpc-cors all" > $HOME/humanode/start.sh chmod +x $HOME/humanode/start.sh # Create Humanode service @@ -18,10 +26,10 @@ Description=humanode After=network.service [Service] -type=simple +Type=simple User=$USER WorkingDirectory=$HOME/humanode -ExecStart=$HOME/humanode/start.sh +ExecStart=/bin/bash $HOME/humanode/start.sh Restart=on-failure [Install] @@ -39,6 +47,7 @@ journalctl -u humanode -n 50 | cat echo "Setting up Ngrok service..." # Make Ngrok config file +rm -rf /root/.ngrok2 mkdir $HOME/.ngrok2 printf "authtoken: $NGROK_TOKEN tunnels: @@ -63,9 +72,15 @@ Restart=on-failure WantedBy=multi-user.target" > /etc/systemd/system/ngrok.service # Enable & run Ngrok service +cmode +x /usr/bin/ngrok systemctl daemon-reload && \ systemctl enable ngrok && \ systemctl start ngrok # View Ngrok status curl localhost:4040/api/tunnels | jq + +systemctl status ngrok +systemctl status humanode + +journalctl -u humanode -f From 3c087dfc0b241a42af16d5c2ef2cec426eb2178f Mon Sep 17 00:00:00 2001 From: surugh <35753081+surugh@users.noreply.github.com> Date: Fri, 15 Oct 2021 06:48:58 +0300 Subject: [PATCH 03/15] Update installer.sh --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index 180dc29..fab0de2 100644 --- a/installer.sh +++ b/installer.sh @@ -9,7 +9,7 @@ SECRET_PHRASE=DEMO_SECRET_PHRASE echo "Setting up Humanode service..." apt install curl jq -y -#move humanode folder to /root +# move humanode folder to /root cp humanode /root install -m 0755 "./binaries/$(uname -s)-$(uname -m)/humanode-peer" /usr/local/bin From cd1ef38ed9e1a37c3db5a344b2ab77a52dc421dd Mon Sep 17 00:00:00 2001 From: surugh <35753081+surugh@users.noreply.github.com> Date: Fri, 15 Oct 2021 06:52:07 +0300 Subject: [PATCH 04/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 352ecb7..319dca5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
INSTALL AS A DAEMON (!!! Tested only on Ubuntu 20.04 !!!)
-
Prerequisites:
1. You should install humanode as in original manual (https://testnet.humanode.io/run-your-own-humanode)
2. Humanode files must be in $HOME/humanode
3. Ngrok binary file should be located in /usr/bin
Prerequisites:
1. !!! You should have secret phrase (i.e. mnemonic) !!!
2. Humanode files must be in $HOME/humanode
3. Ngrok binary file should be located in /usr/bin
To install humanode and ngrok as a daemon you should to edit installer.sh file and add your own variables:
NAME= Your node name, for example "SuPerValiDat0r"
RPC_URL= Your Ngrok url, you can see it on the ngrok website (https://dashboard.ngrok.com/endpoints/status)
NGROK_TOKEN= Your Ngrok authentification token
Then make this file executable (run a command chmod +x installer.sh) and run it AS ROOT!
From 92f0363fb65d548019ad53cc5c0dc491624291b8 Mon Sep 17 00:00:00 2001 From: surugh <35753081+surugh@users.noreply.github.com> Date: Fri, 15 Oct 2021 07:13:51 +0300 Subject: [PATCH 05/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 319dca5..1eb5a2e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@
INSTALL AS A DAEMON (!!! Tested only on Ubuntu 20.04 !!!)
Prerequisites:
1. !!! You should have secret phrase (i.e. mnemonic) !!!
2. Humanode files must be in $HOME/humanode
3. Ngrok binary file should be located in /usr/bin
To install humanode and ngrok as a daemon you should to edit installer.sh file and add your own variables:
NAME= Your node name, for example "SuPerValiDat0r"
RPC_URL= Your Ngrok url, you can see it on the ngrok website (https://dashboard.ngrok.com/endpoints/status)
NGROK_TOKEN= Your Ngrok authentification token
To install humanode and ngrok as a daemon you should to edit installer.sh file and add your own variables:
NAME= Your node name, for example "SuPerValiDat0r"
RPC_URL= Your Ngrok url, you can see it on the ngrok website (https://dashboard.ngrok.com/endpoints/status)
NGROK_TOKEN= Your Ngrok authentification token
SECRET_PHRASE= Your humanode secret phrase (i.e. mnemonic)
Then make this file executable (run a command chmod +x installer.sh) and run it AS ROOT!
TELEGRAM NOTIFICATIONS
From 96cc779404c2f6aea4a431916b830c411754cc49 Mon Sep 17 00:00:00 2001 From: surugh <35753081+surugh@users.noreply.github.com> Date: Fri, 15 Oct 2021 07:22:18 +0300 Subject: [PATCH 06/15] Update installer.sh --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index fab0de2..dfd6e46 100644 --- a/installer.sh +++ b/installer.sh @@ -72,7 +72,7 @@ Restart=on-failure WantedBy=multi-user.target" > /etc/systemd/system/ngrok.service # Enable & run Ngrok service -cmode +x /usr/bin/ngrok +chmod +x /usr/bin/ngrok systemctl daemon-reload && \ systemctl enable ngrok && \ systemctl start ngrok From 164240263634c3c2c8828125a762427f305bf3e9 Mon Sep 17 00:00:00 2001 From: surugh <35753081+surugh@users.noreply.github.com> Date: Fri, 15 Oct 2021 07:27:24 +0300 Subject: [PATCH 07/15] Update installer.sh --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index dfd6e46..458b8e7 100644 --- a/installer.sh +++ b/installer.sh @@ -62,7 +62,7 @@ Description=Ngrok After=network.service [Service] -type=simple +Type=simple User=$USER WorkingDirectory=$HOME/.ngrok2 ExecStart=/usr/bin/ngrok start --all --config="ngrok.yml" From cc102917c3cbd1bbf69a50aea3f8099643396511 Mon Sep 17 00:00:00 2001 From: surugh <35753081+surugh@users.noreply.github.com> Date: Sat, 16 Oct 2021 12:25:35 +0300 Subject: [PATCH 08/15] Update installer.sh --- installer.sh | 141 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 96 insertions(+), 45 deletions(-) diff --git a/installer.sh b/installer.sh index 458b8e7..c679b4a 100644 --- a/installer.sh +++ b/installer.sh @@ -2,24 +2,108 @@ # REPLACE DEMO VALUES WITH YOUR VALUES NAME=DEMO_NODE_NAME -RPC_URL=DEMO_UNIQUE_RPC_URL NGROK_TOKEN=DEMO_NGROK_TOKEN SECRET_PHRASE=DEMO_SECRET_PHRASE +USER_HOME="/home/your_user_name" + +echo "Check for humanode & ngrok services..." +if [ -f /etc/systemd/system/humanode.service ] + then + systemctl stop humanode&& \ + systemctl disable humanode + sleep 2 +fi + +if [ -f /etc/systemd/system/ngrok.service ] + then + systemctl stop ngrok&& \ + systemctl disable ngrok + sleep 2 +fi + +echo "Install packages ..." +apt install curl jq wget unzip -y +sleep 2 + +if [ -f /usr/bin/ngrok ] + then + echo "Found ngrok in /usr/bin ..." + else + wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip + unzip ngrok-stable-linux-amd64.zip + rm ngrok-stable-linux-amd64.zip + mv ./ngrok /usr/bin/ngrok + chmod +x /usr/bin/ngrok + sleep 2 +fi + +echo Copy new files from $USER_HOME/humanode to $HOME/humanode ... +#move humanode folder to /root +if [ -d $USER_HOME/humanode ] + then + echo Found $HOME/humanode ... + sleep 2 + mkdir $HOME/humanode + cp $USER_HOME/humanode/chainspec.json $HOME/humanode/chainspec.json + cp $USER_HOME/humanode/binaries/$(uname -s)-$(uname -m)/humanode-peer $HOME/humanode/humanode-peer + sleep 2 + else + echo TODO: unzip humanode-testnet1.zip $USER_HOME/humanode \ + then run that script again ... + exit +fi + +echo "Configure & run ngrok.service..." +# Make Ngrok config file +rm -rf $HOME/.ngrok2 +mkdir $HOME/.ngrok2 +printf "authtoken: $NGROK_TOKEN +tunnels: + default: + proto: http + addr: 9933 + bind_tls: true" > $HOME/.ngrok2/ngrok.yml -echo "Setting up Humanode service..." -apt install curl jq -y +# Create Ngrok service +printf "[Unit] +Description=Ngrok +After=network.service -# move humanode folder to /root -cp humanode /root +[Service] +Type=simple +User=$USER +WorkingDirectory=$HOME/.ngrok2 +ExecStart=/usr/bin/ngrok start --all --config="ngrok.yml" +Restart=on-failure -install -m 0755 "./binaries/$(uname -s)-$(uname -m)/humanode-peer" /usr/local/bin -humanode-peer key insert --key-type aura --suri "$SECRET_PHRASE" --chain chainspec.json +[Install] +WantedBy=multi-user.target" > /etc/systemd/system/ngrok.service + +systemctl daemon-reload +# Enable & run Ngrok service +systemctl enable ngrok && \ +systemctl start ngrok && \ +systemctl status ngrok +# View Ngrok status +# curl localhost:4040/api/tunnels | jq +curl localhost:4040/api/tunnels | jq > $HOME/humanode/ngrok_tunnels.json +RPC_URL=$(echo "$public_url" | jq '.tunnels[0].public_url' $HOME/humanode/ngrok_tunnels.json) +sleep 2 -# Make Humanode startup script +cd $HOME/humanode +install -m 0755 "humanode-peer" /usr/local/bin +humanode-peer key insert --key-type aura --suri "$SECRET_PHRASE" --chain chainspec.json +echo "Make Humanode startup script ..." printf "exec 1> >(logger -t humanode) 2>&1 exec /usr/local/bin/humanode-peer --name "$NAME" --validator --chain chainspec.json --rpc-url "$RPC_URL" --rpc-cors all" > $HOME/humanode/start.sh chmod +x $HOME/humanode/start.sh +ls +sleep 2 + +# View last 50 lines of Humanode log +# journalctl -u humanode -n 50 | cat +echo "Configure & run humanode.service..." # Create Humanode service printf "[Unit] Description=humanode @@ -35,47 +119,14 @@ Restart=on-failure [Install] WantedBy=multi-user.target" > /etc/systemd/system/humanode.service +systemctl daemon-reload # Enable & run Humanode service -systemctl daemon-reload && \ systemctl enable humanode && \ systemctl start humanode && \ -systemctl restart systemd-journald - -# View last 50 lines of Humanode log -journalctl -u humanode -n 50 | cat +systemctl restart systemd-journal -echo "Setting up Ngrok service..." - -# Make Ngrok config file -rm -rf /root/.ngrok2 -mkdir $HOME/.ngrok2 -printf "authtoken: $NGROK_TOKEN -tunnels: - default: - proto: http - addr: 9933 - bind_tls: true" > $HOME/.ngrok2/ngrok.yml - -# Create Ngrok service -printf "[Unit] -Description=Ngrok -After=network.service - -[Service] -Type=simple -User=$USER -WorkingDirectory=$HOME/.ngrok2 -ExecStart=/usr/bin/ngrok start --all --config="ngrok.yml" -Restart=on-failure - -[Install] -WantedBy=multi-user.target" > /etc/systemd/system/ngrok.service - -# Enable & run Ngrok service -chmod +x /usr/bin/ngrok -systemctl daemon-reload && \ -systemctl enable ngrok && \ -systemctl start ngrok +systemctl status humanode +journalctl -u humanode -f # View Ngrok status curl localhost:4040/api/tunnels | jq From 30d0246c2006f8662933bafb16d184dfe2ae3d40 Mon Sep 17 00:00:00 2001 From: surugh <35753081+surugh@users.noreply.github.com> Date: Sat, 16 Oct 2021 12:26:25 +0300 Subject: [PATCH 09/15] Update installer.sh --- installer.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/installer.sh b/installer.sh index c679b4a..c09dc8e 100644 --- a/installer.sh +++ b/installer.sh @@ -127,11 +127,3 @@ systemctl restart systemd-journal systemctl status humanode journalctl -u humanode -f - -# View Ngrok status -curl localhost:4040/api/tunnels | jq - -systemctl status ngrok -systemctl status humanode - -journalctl -u humanode -f From e2c37501a6557c7f56860c1f375d7cad896eb2eb Mon Sep 17 00:00:00 2001 From: surugh <35753081+surugh@users.noreply.github.com> Date: Sat, 16 Oct 2021 12:50:03 +0300 Subject: [PATCH 10/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1eb5a2e..a5b63a6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@INSTALL AS A DAEMON (!!! Tested only on Ubuntu 20.04 !!!)
Prerequisites:
1. !!! You should have secret phrase (i.e. mnemonic) !!!
2. Humanode files must be in $HOME/humanode
3. Ngrok binary file should be located in /usr/bin
To install humanode and ngrok as a daemon you should to edit installer.sh file and add your own variables:
NAME= Your node name, for example "SuPerValiDat0r"
RPC_URL= Your Ngrok url, you can see it on the ngrok website (https://dashboard.ngrok.com/endpoints/status)
NGROK_TOKEN= Your Ngrok authentification token
SECRET_PHRASE= Your humanode secret phrase (i.e. mnemonic)
To install humanode and ngrok as a daemon you should to edit installer.sh file and add your own variables:
NAME= Your node name, for example "SuPerValiDat0r"
NGROK_TOKEN= Your Ngrok authentification token
SECRET_PHRASE= Your humanode secret phrase (i.e. mnemonic)
Then make this file executable (run a command chmod +x installer.sh) and run it AS ROOT!
TELEGRAM NOTIFICATIONS
From 063506369bf59a080e293a1ae2472a6fa2a33371 Mon Sep 17 00:00:00 2001 From: surugh <35753081+surugh@users.noreply.github.com> Date: Mon, 18 Oct 2021 13:30:57 +0300 Subject: [PATCH 11/15] Update telegram-notify.sh --- telegram-notify.sh | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/telegram-notify.sh b/telegram-notify.sh index 2e937a0..8f934bd 100644 --- a/telegram-notify.sh +++ b/telegram-notify.sh @@ -1,15 +1,37 @@ #!/bin/bash - +# #Make telegram-send script and move it to /usr/bin folder printf "#!/bin/bash -GROUP_ID="TELEGRAM_GROUP_ID" -BOT_TOKEN="YOUR_TELEGRAM_TOKEN" -curl -s --data "text=$1" --data "chat_id=$GROUP_ID" 'https://api.telegram.org/bot'$BOT_TOKEN'/sendMessage' > /dev/null" > /usr/bin/telegram-send +# +# script for sending TEXT/FILE to Telegram +# +# Usage: telegram-send "INSTALL AS A DAEMON (!!! Tested only on Ubuntu 20.04 !!!)
-
Prerequisites:
1. !!! You should have secret phrase (i.e. mnemonic) !!!
2. Humanode files must be in $HOME/humanode
3. Ngrok binary file should be located in /usr/bin
Prerequisites:
1. !!! You should have secret phrase (i.e. mnemonic) !!!
2. Humanode files must be in $HOME/humanode
Ngrok binary now is auto install in /usr/bin
To install humanode and ngrok as a daemon you should to edit installer.sh file and add your own variables:
NAME= Your node name, for example "SuPerValiDat0r"
NGROK_TOKEN= Your Ngrok authentification token
SECRET_PHRASE= Your humanode secret phrase (i.e. mnemonic)
Then make this file executable (run a command chmod +x installer.sh) and run it AS ROOT!
From 025d226df9cef82f3c101b0fcad71f2a6098398b Mon Sep 17 00:00:00 2001 From: surugh <35753081+surugh@users.noreply.github.com> Date: Mon, 18 Oct 2021 13:59:44 +0300 Subject: [PATCH 15/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0892c5a..a2db8ca 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@
INSTALL AS A DAEMON (!!! Tested only on Ubuntu 20.04 !!!)
Prerequisites:
1. !!! You should have secret phrase (i.e. mnemonic) !!!
2. Humanode files must be in $HOME/humanode
Ngrok binary now is auto install in /usr/bin
To install humanode and ngrok as a daemon you should to edit installer.sh file and add your own variables:
NAME= Your node name, for example "SuPerValiDat0r"
NGROK_TOKEN= Your Ngrok authentification token
SECRET_PHRASE= Your humanode secret phrase (i.e. mnemonic)
Then make this file executable (run a command chmod +x installer.sh) and run it AS ROOT!
+RUN $ ./installer.sh
TELEGRAM NOTIFICATIONS
Prerequisites:
Humanode and Ngrok should run as a services (daemons)