Table of Contents
TP-Node is the main module of The Power Ecosystem. In this manual, you'll learn how to start a node from the source code on Linux.
Before you start your TP-Node, you need to set up the environment:
-
Check if you have Git installed:
git version
-
If you don't have Git installed on your machine, run:
apt install git
-
Install Erlang. To do this, download the
kerl
scriptcurl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
Note
If you already have Erlang installed on your machine, we strongly recommend deleting it before the new installation, using the following command:
apt purge erlang*
-
Change script mode to executable by using the following command:
chmod a+x kerl
-
Create a new directory in
/opt
. You can choose any name for this directory. Noteworthy is that the name should be descriptive for you:mkdir erlang
-
Update the list of Erlang releases using the following command:
./kerl update releases
-
Build the release 22.3.4.25 using the following command:
./kerl build 22.3.4.25
Important
You need to install Erlang ver. 22.3.4.25. Other versions may not work correctly.
After installation is complete, you will see the following message in the console:
Erlang/OTP 22.3.4.25 (22.3.4.25) has been successfully built
-
Install Erlang using the following command:
./kerl install 22.3.4.25 /opt/erlang
-
Run the following command to activate the Erlang installation:
source /opt/erlang/activate
After setting up the working environment, you can download and build the node:
Note
Choose a project folder to clone your project into. Use this folder to build the node.
-
Download the node sources from Github into your working directory (
your_node
, for instance), using the following command:git clone https://github.com/thepower/tpnode.git
-
Delete the previous builds (if present) in
/tpnode
by running the following command:rm -rf _build/default/*
-
Compile the node source by running the following command:
./rebar3 compile
-
Pack the compiled node into a
tar
by running the following command:./rebar3 tar
Note
This step is optional.
tar
-package is needed to quickly transfer the compiled source code. However, it can be a good option if you need to download the source manifold.
Now you can start the node.
You can start a node in two different modes:
- Dev Mode. In this mode, you can start a node without building a release.
- Release Mode. In this mode, you must build the release before starting the node.
- Before starting the node in Dev Mode, start a
tmux
session:
tmux
To start the node in Dev Mode, run:
./rebar3 shell
-
Refer to section "Downloading and building the node" above to build the node.
-
To start the node, run:
./bin/thepower foreground