How to run a Totem Meccano Network Node using Docker

Michelle Leech
totem | live accounting
5 min readOct 13, 2020

We’ve recently added Docker to our stack, as we were looking for an easier way to manage, update and maintain our own nodes on the Totem Meccano Network.

This was also one of the major challenges we faced on the road to upgrading to version 2 of Parity Technology’s Substrate Blockchain Framework. The longer term vision for decentralisation on our network is to allow as many nodes as possible to offer open connections for our UI meaning that all users will not rely on a small number of connections to send transactions. Therefore, making it impossible to predict the nodes that a user can connect to.

In case you are “just visiting”, you can see our current master version of our UI in the Totem Live app. Note the container does not contain then UI code, but you can run the UI as a standalone nodejs app — download it from our repo.

tl;dr

Compiling code or keeping up with the latest binary can be painful 🤯 and Docker helps keep you up-to-date with the latest versions of Totem.

If you’re familiar with Docker, you can pull the latest official container image from Totem’s Docker hub. Otherwise, we’ve outlined how to get our Docker setup to get your Totem-Meccano testnet node running.👇

Getting started

In the following steps we’ll guide you through setting up Docker on your operating system and how to get your Totem-Meccano node running in under 15 mins. You’ll need some basic command-line knowledge.

Step 1: Install docker

Find the appropriate guide for your OS/distribution here: https://www.docker.com/get-started

This is the convenience script we use in Ubuntu 18.04:

sudo apt-get remove docker docker-engine docker.io containerd runc && \
sudo apt-get update && \
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && \
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable" && \
sudo apt-get update && \
sudo apt-get install docker-ce docker-ce-cli containerd.io && \
sudo docker run hello-world

The last line tests that docker is working by executing the “Hello World” command.

It is good practice to assign a non-root user with the following permissions so that user can execute docker commands without sudo. Change $USER to your login user name.

$ sudo groupadd docker
$ sudo usermod -aG docker $USER
$ sudo reboot # may be required depending on your OS

System Requirements

You can host a node from your local machine or use a remote host (eg: VPS). During the syncronization phase your node will probably run hot (at 100% CPU and Memory) so just bear this in mind because smaller installations could run the risk of failing to sync if processes are cancelled with the operating system reaches near maximum CPU or Memory usage. You can limit this impact using swap space or place limits in the docker run command.

* Disk space: 30GB minimum (will increase over time), 50GB recommended* RAM: 2GB minimum.How to setup SWAP? https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/CPU: Minimum 2CPUsNB: CPU and memory usage will be about 100% until node catches up to the latest. After that resource (excluding disk space) usage will go down. This is normal, no need to panic :)

Optional Step 2: Pull the docker image

Pulling the docker container image is an optional step. If you haven’t pulled it already, the Step 3 does it anyway hence it is optional, but this is the command you also need if you want to update your node.

docker pull totemlive/totem-meccano:latest

Step 3: Run the container

As mentioned above this will pull the container image if you haven’t already done so. It will also do some rather nifty stuff too, lets go through them:

  1. -dit — this will make your container run as a daemon, meaning it will run all the time. It will also mean that your container is removed if it stops, and this is handy because when your system restarts it will always pull the latest available Totem Meccano container image. That means you never have to manually update.
  2. using -v allows you to persist the blockchain data. Because of the way that docker works, everything — including the blockchain data — would normally be inside the container. So when that container stops for example if you restart the machine, everything is deleted. This would not be good for your node as it would have to continually download the blockchain data from the other nodes and play catch-up. Instead, you can specify a path to a directory outside of the container with this command and your data will remain intact even after restarting.
docker run \
-dit \
--restart unless-stopped \
--name <CONTAINER-NAME> \
-- network host \
-v </PATH/TO/DATA/DIRECTORY>:/data \
totemlive/totem-meccano:latest \
totem-meccano \
--name <NODE-NAME>

Important Notes:

Don’t forget to change the following placeholders with appropriate values in the Step 2 above:

<CONTAINER-NAME>: name (without space) for the local container.This allows you to refer to this container in other command line commands.

</PATH/TO/DATA/DIRECTORY>: absolute path to store all data related to the node you are running. You must create this beforehand, and it must have the permissions of your user (assuming your user is executing the docker commands).

<NODE-NAME>: a name for your node. This is visible publicly on Polkadot Telemetry.

Some other useful docker commands

Stop a container from running. This is useful if you do not want to restart your server when carrying out maintenance or running other containers.

docker container stop <CONTAINER-NAME>

docker container restart <CONTAINER-NAME>

Lists your containers

docker container ls

Removes a container. As long as the image image still exists this command is not as dangerous as it looks.

docker container rm <CONTAINER-NAME>

Running a docker container with an interactive shell:

docker run \
-it \
--interactive \
--tty \
--name <CONTAINER-NAME> \
-v </PATH/TO/DATA/DIRECTORY>:/data \
totemlive/totem-meccano:latest \
totem-meccano --help

Upgrades and other information

If you need any help, please reach out to our team either in the support channel app itself, or via Discord (usually gets the info first) and Twitter. You can also support the development by opening an issue on our Gitlab channel.

We will announce upgrades to Totem Live and the Docker container image in Discord.

About Totem Live

Totem’s technology is built on the idea that accounting ledgers should be able to communicate directly with each other, anywhere in the world, in real-time. Today, accounting still requires a manual process of gathering and sending information to an accountant.

Totem Live Accounting is a blockchain powered global accounting ledger. The peer-to-peer accountancy application has a full fledged real -time accounting network all under-the-hood of the modern, intuitive and easy-to-use front-end app. Unlike other apps, it requires zero-configuration to use and exchanging accounting information securely with any random party is simple.

Get connected with us! 🗣

--

--

Michelle Leech
totem | live accounting

Communication Manager @ Tendermint | Cosmos Contributor | Marketing advisor @ Totem Live