O
O
Otnode
Search…
Converting docker node to dockerless

Benefits:

  • Dockerless nodes require less resources and are aimed at advanced users who would like to min/max the efficiency of their nodes in terms of resources.
  • You would be saving around 4GB space
  • Ability to use one database across multiple nodes on one VPS (still work in progress), which should potentially save more space

Disadvantages:

  • Updates require some additional work as of now
  • the log is less friendly to read
  • autorestarts require additional tools (i.e. Ansible)
To perform the transformation, you need to utilize the scripts you can find in Calvin's Github. Always consult those first and the instructions on his Github as those would always be the most up-to-date ones. Should you have any questions, feel free to join the Advanced Node runners telegram group.
There are two ways to perform this process - using Smoothbrain backup, or using local backup.

Local backup conversion

Creating the backup

Easiest way is to attach a new Volume to the existing server, create the backup there, detach the volume and attach to the new server. Here are the steps to do it:
Create volume
On the existing server - get the id
1
df -h
Copied!
Copy on a notepad the number above as we will need it shortly.
On Hetzner and Digital Ocean you can add additional space to your VPS by adding a Volume space. I will walkthrough the process on Hetzner, it is the same on Digital Ocean too.
  • Login to your Hetzner Console at https://console.hetzner.cloud/
  • Select your Project (default is called Default)
  • Click on the server. This will bring up server settings.
  • Select Volumes:
  • Click on Create Volume button, put the name as vol1 and select manual. For size, select whatever is the size of the VPS's SSD at the moment.
  • After volume is created click on the 3 dots on the right side of volume you have just created. In the menu choose Show Configuration. This will bring up the commands you must use to make the space on the new volume available inside your VPS. You must run only the first command to format the Volume, while updaring $FILESYSTEM with ext4
NOTE: This are just example commands. Just MUST use the commands that are displayed on your Hetzner Console.
i.e. the command will be
sudo mkfs.ext4 -F /dev/disk/by-id/scsi-0HC_Volume_12872586
  • Copy, paste and run the first command in the terminal of your VPS.
Second, in most cases you would have a backup folder already created on your node. If for some reason you have never done backups run the following
1
docker exec it otnode mkdir -p ../backup
Copied!
  • Then you will need the path of your docker container which you saved at the beginning of the guide. If you did notm you must run df -h and save the path in the row overlay. It should look something like this: /var/lib/docker/overlay2/5b0720e1a89e407a48aa3be9112f6f531ec47d7ec5662a7dafcc98506968af8d/merged
  • You will use the value you got from the df -h on your node. Copy the third command MOUNT VOLUME from the Instructions, while updating the second part of the command where above it says /mnt/volume-fsn1. Should look similar to the below with the updated Volume number and the node folder (the XXXXXXX entries below).
1
mount -o discard,defaults /dev/disk/by-id/scsi-0HC_Volume_xxxxxxx /var/lib/docker/overlay2/xxxxxxxxxxxxxxxxxxxxxx/merged/ot-node/backup
Copied!
  • Next you run the command to perform the backup, which will go on the Volume space.
1
docker exec otnode node scripts/backup.js --config=/ot-node/.origintrail_noderc --configDir=/ot-node/data --backupDirectory=/ot-node/backup
Copied!
  • then unmount the volume space from the VPS with the below command, updating the folder we copied at the beginning (the xxxxxxx
1
umount /var/lib/docker/overlay2/xxxxxxxxxxxxxxxx/merged/ot-node/backup
Copied!
  • then you need to detach the volume from the Hetzner's control panel. Go to the Volume section for this server and click on the three red dots and select Detach Volume

Setting up the new server

Create a new VPS, selecting Ubuntu 18.04 as operating system. Dockerless nodes will not work on Ubuntu 20! Also make sure you create the server in the same datacenter as your current one, so the Volume will be accessible, otherwise it won't work.
Once you create the VPS, you need to attach the volume. Go to the Volume section on the new VPS and choose Attach, select the Volume from the dropdown and choose manual.
  • Once you attach the volume, login to the VPS as root and create the backup folder in the root directory
1
mkdir /root/backup
Copied!
  • Then mount the Volume with the command listed on the Instructions in the MOUNT VOLUME part (third command), while replacing the second part with the folder location, where it says /mnt/volume-fsn1 with /root/backup. Do not run commands one or two as those will wipe the backup.
i.e. should look like:
mount -o discard,defaults /dev/disk/by-id/scsi-0HC_Volume_12872586 /root/backup
The final step is to move the backup content to be restore ready:
1
mv -v /root/backup/20*/* /root/backup
Copied!
1
mv -v /root/backup/20*/.origintrail_noderc /root/backup
Copied!
1
rm -rf /root/backup/20*
Copied!

Updating the server and installing the scripts

Run the following commands on the new VPS:
Update the server and install Git:
1
apt update && apt upgrade -y && apt install git -y
Copied!
Install 1 GB SWAP
1
fallocate -l 1G /swapfile && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile
Copied!
1
cp /etc/fstab /etc/fstab.bak
Copied!
1
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Copied!
Install the scripts:
1
git clone https://github.com/calr0x/OT-Settings.git
Copied!
1
git clone https://github.com/calr0x/OT-DockSucker.git
Copied!
1
cd OT-DockSucker
Copied!
1
./install-from-existing-local-volume.sh
Copied!
The process will complete and your new dockerless would be setup. To start the node run:
1
systemctl start otnode
Copied!
To stop the node:
1
systemctl stop otnode
Copied!
To restart the node:
1
systemctl restart otnode
Copied!
To pull the log of the node:
1
journalctl -u otnode -f | ccze -A
Copied!
To pull the log of the node for the past 1 hour:
1
journalctl -u otnode -f --since "1 hour ago"
Copied!
To pull the log of the node of jobs won for the past 24 hours:
1
journalctl -u otnode -f --since "24 hours ago" |egrep 'cheap'\|'Accepting'\|'ve been chosen'
Copied!
Last modified 3mo ago