Difference between revisions of "Relay Node"
(user creation added rather than root usage) |
(→Verifying Deployment) |
||
(19 intermediate revisions by 3 users not shown) | |||
Line 23: | Line 23: | ||
2. Create a new user specific for this Mochimo relay node. | 2. Create a new user specific for this Mochimo relay node. | ||
− | <pre>adduser | + | <pre>adduser mochimorelay</pre> |
3. Enter a strong password. | 3. Enter a strong password. | ||
Line 30: | Line 30: | ||
4. Give your new user Sudo permissions. | 4. Give your new user Sudo permissions. | ||
− | <pre>usermod -aG sudo | + | <pre>usermod -aG sudo mochimorelay</pre> |
5. Switch to your new user. | 5. Switch to your new user. | ||
− | <pre>su - | + | <pre>su - mochimorelay</pre> |
If you've sucessfully created a new user with Sudo permissions your terminal should say something like: | If you've sucessfully created a new user with Sudo permissions your terminal should say something like: | ||
Line 47: | Line 47: | ||
1. Create ramdisk directory. | 1. Create ramdisk directory. | ||
− | <pre>mkdir /mnt/ramdisk</pre> | + | <pre>sudo mkdir /mnt/ramdisk</pre> |
2. Setup crontab to reboot daily. Below script selects nano with "1" and sets | 2. Setup crontab to reboot daily. Below script selects nano with "1" and sets | ||
the system to reboot weekly at 6 am. | the system to reboot weekly at 6 am. | ||
+ | <BR> | ||
+ | (you may be prompted to press Y when using apt-get) | ||
− | <pre>apt-get install nano | + | <pre>sudo apt-get install nano |
cd /etc | cd /etc | ||
− | crontab -e | + | sudo crontab -e |
− | |||
</pre> | </pre> | ||
File Contents: | File Contents: | ||
Line 63: | Line 64: | ||
3. Install build tools, and build Mochimo | 3. Install build tools, and build Mochimo | ||
+ | <BR> | ||
+ | (you may be prompted to press Y when using apt-get) | ||
− | <pre>apt-get install git | + | <pre>cd |
− | apt-get install build-essential | + | sudo apt-get install git |
− | + | sudo apt-get install build-essential | |
git clone https://github.com/mochimodev/mochimo | git clone https://github.com/mochimodev/mochimo | ||
cd mochimo/src | cd mochimo/src | ||
Line 72: | Line 75: | ||
./makeunx install</pre> | ./makeunx install</pre> | ||
− | 4. Tar the binary directory, and copy to / | + | 4. Tar the binary directory, and copy to /mochimorelay |
<pre>cd .. | <pre>cd .. | ||
tar -czvf bin.tgz bin | tar -czvf bin.tgz bin | ||
− | cp bin.tgz / | + | cp bin.tgz /home/mochimorelay/bin.tgz |
cd .. | cd .. | ||
rm -rf mochimo</pre> | rm -rf mochimo</pre> | ||
Line 82: | Line 85: | ||
5. Set the fstab to load the ramdisk on reboot | 5. Set the fstab to load the ramdisk on reboot | ||
− | <pre>nano /etc/fstab</pre> | + | <pre>sudo nano /etc/fstab</pre> |
File Contents (append to bottom of file): | File Contents (append to bottom of file): | ||
Line 91: | Line 94: | ||
<pre>cd /etc/systemd/system | <pre>cd /etc/systemd/system | ||
− | nano mochimo.service</pre> | + | sudo nano mochimo.service</pre> |
File Contents: | File Contents: | ||
Line 99: | Line 102: | ||
[Service] | [Service] | ||
− | ExecStart=/ | + | ExecStart=/bin/bash /home/mochimorelay/start-mochimo.sh |
[Install] | [Install] | ||
Line 106: | Line 109: | ||
7. Make the service privs 644: | 7. Make the service privs 644: | ||
− | <pre>chmod 644 mochimo.service</pre> | + | <pre>sudo chmod 644 mochimo.service</pre> |
− | 8. Create the startup script off of / | + | 8. Create the startup script off of /mochimorelay |
− | <pre>nano / | + | <pre>sudo nano /home/mochimorelay/start-mochimo.sh |
#! /bin/bash | #! /bin/bash | ||
− | cp / | + | sudo cp /home/mochimorelay/bin.tgz /mnt/ramdisk |
cd /mnt/ramdisk | cd /mnt/ramdisk | ||
− | tar -xzvf bin.tgz | + | sudo tar -xzvf bin.tgz |
cd bin | cd bin | ||
cp maddr.mat maddr.dat | cp maddr.mat maddr.dat | ||
Line 122: | Line 125: | ||
9. Make the startup script executable: | 9. Make the startup script executable: | ||
− | <pre>chmod +x / | + | <pre>sudo chmod +x /home/mochimorelay/start-mochimo.sh</pre> |
− | 10. | + | 10. Return to root user, start the service, and reboot to confirm: |
− | <pre> | + | <pre>su - |
− | + | systemctl enable mochimo.service | |
+ | systemctl start mochimo.service | ||
sudo reboot</pre> | sudo reboot</pre> | ||
+ | |||
+ | 11. (Optional) Log back into your VPS to validate the mochimo.service is running: | ||
+ | <pre>journalctl -u mochimo.service -f</pre> | ||
+ | |||
+ | == Verifying Deployment == | ||
+ | |||
+ | 1. Verify the Service is running: | ||
+ | |||
+ | <pre> ps -aux | grep /mochimo </pre> | ||
+ | |||
+ | The output will list the mochimo service followed by a status. | ||
+ | |||
+ | <pre>../mochimo %STATUS% </pre> | ||
+ | |||
+ | Status will start as 'quorum', then transition to 'tfval', and finally to 'Listen'. | ||
+ | <br> | ||
+ | |||
+ | In 'listen' mode (may take 10-15 minutes) the node is running and accessible for sending, receiving and relaying transactions. | ||
+ | <br><br> | ||
+ | 2. Verify your IP address on the Mochimap: | ||
+ | |||
+ | Find your node on [https://www.mochimap.net/ MochiMap.net], this is a good sign that it's operating correctly. | ||
+ | <br> | ||
+ | If you click your node on MochiMap, it will give you the apparent health status of your node. | ||
+ | <br><br> | ||
+ | 3. Query the API and verify your server is peered. | ||
+ | |||
+ | Complete an API call (in this example we show the URL for the Mochimo Public API, but you can maintain your own - and we recommend that you do.) To query the network nodes browse to: | ||
+ | <br> | ||
+ | http://api.mochimo.org:8888/net/nodes | ||
+ | <br> | ||
+ | Your node's IP address should display in the list of "peers":[] |
Latest revision as of 17:55, 8 February 2021
Contents
How to Deploy a Mochimo VPS Relay Node
Summary
The below steps will allow you to set up a VPS node that self-reboots weekly, installs the Mochimo server in a ramdisk (for high performance) creates a local mochimo service, and automatically restarts the Mochimo server as a non solving node upon reboot.
Audience
People who want to support the network by operating a node to relay transactions / blocks.
Minimum System Requirements
Ubuntu 16.04 LTS 1 vCPU 2 GB RAM 10 GB Hard Disk
Create a new user for Mochimo
1 Log into root
user on your VPS.
2. Create a new user specific for this Mochimo relay node.
adduser mochimorelay
3. Enter a strong password. (you can return through the prompts asking for user details, they can all be blank)
4. Give your new user Sudo permissions.
usermod -aG sudo mochimorelay
5. Switch to your new user.
su - mochimorelay
If you've sucessfully created a new user with Sudo permissions your terminal should say something like:
To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details.
You are now ready to start your node deployment.
Deployment Steps
1. Create ramdisk directory.
sudo mkdir /mnt/ramdisk
2. Setup crontab to reboot daily. Below script selects nano with "1" and sets
the system to reboot weekly at 6 am.
(you may be prompted to press Y when using apt-get)
sudo apt-get install nano cd /etc sudo crontab -e
File Contents:
0 6 * * 1 /sbin/shutdown -r
3. Install build tools, and build Mochimo
(you may be prompted to press Y when using apt-get)
cd sudo apt-get install git sudo apt-get install build-essential git clone https://github.com/mochimodev/mochimo cd mochimo/src ./makeunx bin -DCPU ./makeunx install
4. Tar the binary directory, and copy to /mochimorelay
cd .. tar -czvf bin.tgz bin cp bin.tgz /home/mochimorelay/bin.tgz cd .. rm -rf mochimo
5. Set the fstab to load the ramdisk on reboot
sudo nano /etc/fstab
File Contents (append to bottom of file):
tmpfs /mnt/ramdisk tmpfs nodev,nosuid,nodiratime,size=1024M
6. Create the systemd system service to start Mochimo on boot.
cd /etc/systemd/system sudo nano mochimo.service
File Contents:
[Unit] Description=Mochimo Server [Service] ExecStart=/bin/bash /home/mochimorelay/start-mochimo.sh [Install] WantedBy=default.target
7. Make the service privs 644:
sudo chmod 644 mochimo.service
8. Create the startup script off of /mochimorelay
sudo nano /home/mochimorelay/start-mochimo.sh #! /bin/bash sudo cp /home/mochimorelay/bin.tgz /mnt/ramdisk cd /mnt/ramdisk sudo tar -xzvf bin.tgz cd bin cp maddr.mat maddr.dat ./gomochi d -n -D
9. Make the startup script executable:
sudo chmod +x /home/mochimorelay/start-mochimo.sh
10. Return to root user, start the service, and reboot to confirm:
su - systemctl enable mochimo.service systemctl start mochimo.service sudo reboot
11. (Optional) Log back into your VPS to validate the mochimo.service is running:
journalctl -u mochimo.service -f
Verifying Deployment
1. Verify the Service is running:
ps -aux | grep /mochimo
The output will list the mochimo service followed by a status.
../mochimo %STATUS%
Status will start as 'quorum', then transition to 'tfval', and finally to 'Listen'.
In 'listen' mode (may take 10-15 minutes) the node is running and accessible for sending, receiving and relaying transactions.
2. Verify your IP address on the Mochimap:
Find your node on MochiMap.net, this is a good sign that it's operating correctly.
If you click your node on MochiMap, it will give you the apparent health status of your node.
3. Query the API and verify your server is peered.
Complete an API call (in this example we show the URL for the Mochimo Public API, but you can maintain your own - and we recommend that you do.) To query the network nodes browse to:
http://api.mochimo.org:8888/net/nodes
Your node's IP address should display in the list of "peers":[]