Difference between revisions of "Relay Node"
Mochimowiki (talk | contribs) (→Deployment Steps) |
(user creation added rather than root usage) |
||
Line 16: | Line 16: | ||
2 GB RAM | 2 GB RAM | ||
10 GB Hard Disk | 10 GB Hard Disk | ||
+ | |||
+ | === Create a new user for Mochimo === | ||
+ | |||
+ | 1 Log into <code>root</code> user on your VPS. | ||
+ | |||
+ | 2. Create a new user specific for this Mochimo relay node. | ||
+ | |||
+ | <pre>adduser mochimoRelay</pre> | ||
+ | |||
+ | 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. | ||
+ | |||
+ | <pre>usermod -aG sudo mochimoRelay</pre> | ||
+ | |||
+ | 5. Switch to your new user. | ||
+ | |||
+ | <pre>su - mochimoRelay</pre> | ||
+ | |||
+ | If you've sucessfully created a new user with Sudo permissions your terminal should say something like: | ||
+ | |||
+ | <pre>To run a command as administrator (user "root"), use "sudo <command>". | ||
+ | See "man sudo_root" for details.</pre> | ||
+ | |||
+ | You are now ready to start your node deployment. | ||
== Deployment Steps == | == Deployment Steps == | ||
Line 40: | Line 66: | ||
<pre>apt-get install git | <pre>apt-get install git | ||
apt-get install build-essential | apt-get install build-essential | ||
− | cd / | + | cd /mochimoRelay |
git clone https://github.com/mochimodev/mochimo | git clone https://github.com/mochimodev/mochimo | ||
cd mochimo/src | cd mochimo/src | ||
Line 46: | Line 72: | ||
./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 /mochimo/bin.tgz |
cd .. | cd .. | ||
rm -rf mochimo</pre> | rm -rf mochimo</pre> | ||
Line 73: | Line 99: | ||
[Service] | [Service] | ||
− | ExecStart=/ | + | ExecStart=/mochimoRelay/start-mochimo.sh |
[Install] | [Install] | ||
Line 82: | Line 108: | ||
<pre>chmod 644 mochimo.service</pre> | <pre>chmod 644 mochimo.service</pre> | ||
− | 8. Create the startup script off of / | + | 8. Create the startup script off of /mochimoRelay |
− | <pre>nano / | + | <pre>nano /mochimoRelay/start-mochimo.sh |
#! /bin/bash | #! /bin/bash | ||
− | cp / | + | cp /mochimoRelay/bin.tgz /mnt/ramdisk |
cd /mnt/ramdisk | cd /mnt/ramdisk | ||
tar -xzvf bin.tgz | tar -xzvf bin.tgz | ||
Line 96: | Line 122: | ||
9. Make the startup script executable: | 9. Make the startup script executable: | ||
− | <pre>chmod +x / | + | <pre>chmod +x /mochimoRelay/start-mochimo.sh</pre> |
10. Start the service, and reboot to confirm: | 10. Start the service, and reboot to confirm: |
Revision as of 14:14, 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.
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.
apt-get install nano cd /etc crontab -e 1
File Contents:
0 6 * * 1 /sbin/shutdown -r
3. Install build tools, and build Mochimo
apt-get install git apt-get install build-essential cd /mochimoRelay 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 /mochimo/bin.tgz cd .. rm -rf mochimo
5. Set the fstab to load the ramdisk on reboot
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 nano mochimo.service
File Contents:
[Unit] Description=Mochimo Server [Service] ExecStart=/mochimoRelay/start-mochimo.sh [Install] WantedBy=default.target
7. Make the service privs 644:
chmod 644 mochimo.service
8. Create the startup script off of /mochimoRelay
nano /mochimoRelay/start-mochimo.sh #! /bin/bash cp /mochimoRelay/bin.tgz /mnt/ramdisk cd /mnt/ramdisk tar -xzvf bin.tgz cd bin cp maddr.mat maddr.dat ./gomochi d -n -D
9. Make the startup script executable:
chmod +x /mochimoRelay/start-mochimo.sh
10. Start the service, and reboot to confirm:
sudo systemctl enable mochimo.service sudo systemctl start mochimo.service sudo reboot