Setting up the environment and starting the testnet using Vagrant
- Installation and setting up Vagrant
- Setting up the environment
- Compiling and starting the node
- Stopping the testnet
- Using Makefile targets
- Using API
As an option, you can use Vagrant to setup development environment.
Here is an example of setting up the development environment for MacOS.
Installation and setting up Vagrant
To set up Vagrant, follow the steps below:
-
Install vagrant:
brew install caskroom/cask/vagrant
-
If you use a VM:
-
For Parallels, add Parallels support to Vagrant:
vagrant plugin install vagrant-parallels
-
For VirtualBox (default option), modify the
PATH
variable to add the VirtualBox binary to Vagrant:export PATH=/Applications/VirtualBox.app/Contents/MacOS:$PATH
-
-
Install the hostmanager plugin to manage the
/etc/hosts
file:vagrant plugin install vagrant-hostmanager
Setting up the environment
To set up the environment, follow the steps below:
-
Clone the
tpnode
repository from Github and go totpnode
directory. -
Start the virtual machine using Vagrant:
vagrant up
Attention
When running the Vagrant command, provisioning will be started. During the provisioning, Vagrant downloads all the necessary libraries and compiles the proper versions of Erlang and other environment components.Reboot the virtual machine after successful provisioning using the following commands:
vagrant halt
vagrant up
-
Connect to virtual environment by running:
vagrant ssh -- -A
where:
-A
— key to ssh agent forwarding. You will be able to use ssh key from host machine to perform operations inside the virtual machine.
Compiling and starting the node
-
Go to the project directory:
cd /vagrant
-
Compile the testnet by running the following command:
make buildtest
-
Start the testnet by running the script:
./bin/testnet.sh
Stopping the testnet
To stop the testnet, run:
./bin/testnet.sh stop
Using Makefile targets
You can also use the Makefile targets as a reference on how to perform other tasks.
Using API
You can see the API ports by running:
netstat -an |grep 498
Note
After you've started testnet you should see 9 different ports. You can use these ports for The Power nodes API calls.
API call sample:
curl http://pwr.local:49841/api/node/status | jq .
Note: the domain
pwr.local
in URL is used to reference the node from virtual or host machine.