If you want to reinstall your phase 1 nodes, please refer to my old article on https://www.publish0x.com/pramonoutomo/thepower-incentivized-testnet-installing-nodes-tutorial-xeezmjn
Prerequisites
if you are using ubuntu 20.04, please use step 1 to step 4 on https://www.how2shout.com/linux/how-to-install-erlang-on-ubuntu-20-04-lts-linux/ , if you are using ubuntu 22.04 you can follow this step below:
// download erlang
apt -y install erlang-base erlang-public-key erlang-ssl ufw
then install following software needed:
apt -y install docker-compose jq
Get ThePower Cli
// Download ThePower Cli
sudo wget https://tea.thepower.io/tp -O /usr/local/bin/tp
// makes file downloaded executable
sudo chmod a+x /usr/local/bin/tp
Create Folder
mkdir -p {/opt/thepower/db/cert,/opt/thepower/log}
Go To /opt/Thepower & Generate PrivateKey
// go to folder
cd /opt/thepower
// generate privatekey
tp --genkey --ed25519
example of privatekey (don't use this as your key):
cat tpcli.key
{privkey,"302E020100300506032B6570042204204B1F52826447066469E7DBCA4E95CB0A03A2998D268C27885364D4AD7B7B0A8E"}.
{pubkey,"302A300506032B6570032100667C84FB1195C73F97AE14430C2024490C0EA6490F6EC0C1DE3FAEB4B6B32251"}.
Download Config
// Download Config
wget https://doc.thepower.io/assets/files/node-84de68713380c52f14e48193c1bca537.config -O node.config
Edit Configuration
change your "replace_with_your_hostname" and "Insert_here_your_upstream_link1".
hostname is your domain/subdomain pointed to your server, upstream_link are links you got from power_bot https://t.me/thepowerio_bot
{tpic,#{peers => [],port => 1800}}.
% ====== [ here is an example of configuration ] ======
{discovery,#{addresses =>[
#{address => "replace_with_your_hostname", port => 1800, proto => tpic},
#{address => "replace_with_your_hostname", port => 1443, proto => apis},
#{address => "replace_with_your_hostname", port => 1080, proto => api}
]}}.
{replica, true}.
{hostname, "replace_with_your_hostname"}.
{upstream, [
"Insert_here_your_upstream_link1",
"Insert_here_your_upstream_link2"
]}.
% ======= [ end of example ] =========
{dbsuffix,""}.
{loglevel, info}.
{info_log, "log/info.log"}.
{error_log, "log/error.log"}.
{debug_log, "log/debug.log"}.
{rpcsport, 1443}.
{rpcport, 1080}.
The first upstream node in the link must be active. Otherwise, the node.config
will not work properly.
You can check the upstream node status by running the following command:
curl -s http://upstream_host:1080/api/node/status | jq .result
If the command returns ok
it means that no problems were discovered. If there is an error, then change the upstream links order in node.config
file.
Run the nodes
grep priv tpcli.key >> node.config
Set up SSL
make sure you change my@example.com and your_node.example.com
copy each line syntax, don't copy all at once.
// install socat
apt-get install socat
// change my@example.com to your own email address
curl https://get.acme.sh | sh -s email=my@example.com
// logout
logout
// then re-login again
// issue your ssl
acme.sh --issue --standalone -d your_node.example.com
Install certificate
change your_node.example.com to your domain name
acme.sh --install-cert -d your_node.example.com \
--cert-file /opt/thepower/db/cert/your_node.example.com.crt \
--key-file /opt/thepower/db/cert/your_node.example.com.key \
--ca-file /opt/thepower/db/cert/your_node.example.com.crt.ca.crt