Create folders for the Docker containers (your node or nodes)
If you just want to create a single node, run the following command:
mkdir .streamrDocker1
In case you want to create 5 nodes, run the following command to create all 5 folders at once:
mkdir .streamrDocker1 ; mkdir .streamrDocker2 ; mkdir .streamrDocker3 ; mkdir .streamrDocker4 ; mkdir .streamrDocker5
Run the config wizard to create and configure a Streamr node
Preface: Plugins and ports
As a node runner, you only need the default plugin enabled. Do not enable any other plugins, since you are far more likely to run into problems if you do and the additional plugins are completely unnecessary, unless you want to stream data through a node (again, if you just want to run a node and stake DATA, there is absolutely no reason to enable additional plugins OR setting ports)
"Do you want to generate a new Ethereum private key or import an existing one": New / hit enter
"Select the plugins to enable": Just hit enter (don’t select any plugins)
"Do you want to participate in mining and staking?": Yes (hit enter, Yes is the default)
"Select a path to store the generated config in": Hit enter to use the default path
sudo docker run -it -v $(cd ~/.streamrDocker1; pwd):/home/streamr/.streamr streamr/broker-node:latest bin/config-wizard
sudo docker run -it -v $(cd ~/.streamrDocker2; pwd):/home/streamr/.streamr streamr/broker-node:latest bin/config-wizard
sudo docker run -it -v $(cd ~/.streamrDocker3; pwd):/home/streamr/.streamr streamr/broker-node:latest bin/config-wizard
sudo docker run -it -v $(cd ~/.streamrDocker4; pwd):/home/streamr/.streamr streamr/broker-node:latest bin/config-wizard
sudo docker run -it -v $(cd ~/.streamrDocker5; pwd):/home/streamr/.streamr streamr/broker-node:latest bin/config-wizard
Start your nodes
Run this multi-line command to start your newly configured nodes:
sudo docker run --name streamr1 --restart unless-stopped -d -v $(cd ~/.streamrDocker1; pwd):/home/streamr/.streamr streamr/broker-node:latest
sudo docker run --name streamr2 --restart unless-stopped -d -v $(cd ~/.streamrDocker2; pwd):/home/streamr/.streamr streamr/broker-node:latest
sudo docker run --name streamr3 --restart unless-stopped -d -v $(cd ~/.streamrDocker3; pwd):/home/streamr/.streamr streamr/broker-node:latest
sudo docker run --name streamr4 --restart unless-stopped -d -v $(cd ~/.streamrDocker4; pwd):/home/streamr/.streamr streamr/broker-node:latest
sudo docker run --name streamr5 --restart unless-stopped -d -v $(cd ~/.streamrDocker5; pwd):/home/streamr/.streamr streamr/broker-node:latest
Or, if you want to create 5 nodes, run this multi-line command to create all 5 folders at once:
sudo docker run --name streamr1 --restart unless-stopped -d -v $(cd ~/.streamrDocker1; pwd):/home/streamr/.streamr streamr/broker-node:latest && sudo docker run --name streamr2 --restart unless-stopped -d -v $(cd ~/.streamrDocker2; pwd):/home/streamr/.streamr streamr/broker-node:latest && sudo docker run --name streamr3 --restart unless-stopped -d -v $(cd ~/.streamrDocker3; pwd):/home/streamr/.streamr streamr/broker-node:latest && sudo docker run --name streamr4 --restart unless-stopped -d -v $(cd ~/.streamrDocker4; pwd):/home/streamr/.streamr streamr/broker-node:latest && sudo docker run --name streamr5 --restart unless-stopped -d -v $(cd ~/.streamrDocker5; pwd):/home/streamr/.streamr streamr/broker-node:latest
The command, deconstructed:
Naming containers (nodes)
--name
= Give the Docker container a name. This makes it easier to check in on your node later. If you end up with quite a few nodes, you’ll appreciate the ability to easily distinquish between them. If you don’t set a name, Docker will automatically give each container a funky name a la bewildered_maniac
If you have running nodes that you didn’t give a custom name, you can simply rename the containers. Example:
sudo docker rename OLDNAME NEWNAME
Replace OLDNAME with the current container name and NEWNAME with the name you want to give the container/node, such as:
sudo docker rename bewildered_maniac streamr1
--restart unless-stopped
This enables the restart policy ‘unless-stopped’, meaning if a nodes stops running due an error, it will start up again automatically. If you, however, stop a node manually, it won’t start again on its own. Using --restart always
instead will restart a node/container, regardless of why/how it stopped.
Maintaining your Streamr nodes
See the node running "live"
To print old log lines and print new lines to the screen ongoing (follow the log), use the following command:
sudo docker logs --follow <nodename>
Where streamr1
. If you used another article or the official Streamr documentation to setup your nodes, you node probably has a rather funky name automatically assigned by Docker. You can use those or decide to give them more meaningful names using the docker rename
command.
Example:
sudo docker logs --follow streamr1
If your node has been running for a while, you might want to use the --tail
flag, so you don’t print hundreds or even thousands of lines to the screen (if you want to enter the matrix, leave it out).
Example that shows the last 30 lines in a log plus prints new lines to screen (--follow
):
sudo docker logs --follow --tail 30 streamr1
Hit {CTRL}
+{Z}
to exit.
If you just want to see the last (say, 30) lines to see if your node is running as it should, you can leave out the --follow
flag.
sudo docker logs --tail 30 streamr1
See a list of running containers/nodes
sudo docker ps
See a list of all containers, including stopped/exited containers
sudo docker ps --all
If you are running 5 nodes and you see more containers in this list (usually with the status exited
), remove the redundant ones (prune).
Prune
Prune (remove) exited/non-running containers
sudo docker container prune
Docker list running containers + stopped containers (–all)
sudo docker container ls --all
Stop a single Docker container
sudo docker stop <name>
Replace
Stop all Docker containers:
sudo docker stop $(sudo docker ps -q)
Kill all Docker containers
Be careful if you are running non-Streamr nodes with Docker on the same device/server. This command will kill all running Docker containers.
sudo docker kill $(sudo docker ps -q)
Update the Streamr broker node to latest release
sudo docker pull streamr/broker-node:latest