How to install Circuit Breaker on Umbrel

What is Circuit Breaker and why it is important:

Circuitbreaker is to Lightning what firewalls are to the internet. It allows nodes to protect themselves from being flooded with htlcs. With circuitbreaker a maximum to the number of in-flight htlcs can be set on a per-peer basis. Known and trusted peers for example can be assigned a higher maximum, while a new channel from a previously unseen node may be limited to only a few pending htlcs.

When looking for guides how to install Circuit Breaker (CB) I found the following:

This guide is especially for RaspiBolt and tech savvy people can probably use it to install CB on Umbrel as well. When I followed the guide, I stumbled when it came to permissions since RaspiBolt permissions are quite different.

I asked for support in various Umbrel Channels, but no one could help or seemed even interested. Since I considered having CB installed to protect my node I kept asking in various other channels until I found someone who was able and willing to help. In the process this guy was even going the extra mile with me and created a docker compose file and on top a systemd Service file to make the CB Docker Container automatically start on reboot.

To whole process included some trial and error and took a couple of days. I summarized all the steps into this little installation guide and hope you find it useful. Enjoy.

Installation Circuit Breaker Docker-Compose File

Follow the instructions step by step!

Download the Circuit Breaker docker-compose file to your computer:

and open the file in any text editor. Later on we want to copy the whole content to a new file on our Raspberry Pi.

Connect to your Umbrel node:

ssh umbrel@umbrel

change to Umbrel home directory

cd ~

create a new directory to create the docker-compose file in and keep it separate from other files:

mkdir circuitbreaker

change into the new directory

cd circuitbreaker

Now create a new file by starting the nano editor:

sudo nano docker-compose-circuitbreaker.yml

Now copy the whole content from the docker-compose.yml file on your computer and paste it into the new file (right click) and save and exit (Ctrl-K and Y).

The new CB docker compose file is ready to run.

docker-compose -f docker-compose-circuitbreaker.yml up -d

To check if the container was successfully started you can run

docker container ls -a

This command lists all docker container currently loaded and display some information and the status. As we can see CB is listed and the status is “Up”.

We can check it in the Web UI:

http://umbrel.local:9235/

CB is running and doing its service. The default settings should be fine.

In the next step we configure CB to auto start on reboot.

Configure CB auto start

Follow the instructions step by step!

Download the Circuit Breaker systemd service file to your computer:

and open the file in any text editor. Later on we want to copy the whole content to a new file on our Raspberry Pi.

Connect to your Umbrel node:

ssh umbrel@umbrel

change into the systemd system directory:

cd /etc/systemd/system

Now create a system file by starting the nano editor:

sudo nano docker-compose-circuitbreaker.service

Now copy the whole content from the docker-compose-umbrel.service file on your computer and paste it into the new file (right click) and save and exit (Ctrl-K and Y).

The following article describes the next steps:

https://wiki.debian.org/systemd/Services

Making it go

After creating or modifying any unit files, we must tell systemd that we want it to look for new things:

systemctl daemon-reload

Our new service should be recognized at this point, but it won’t run yet. We need to do two more things. First, tell systemd to enable it, so that it will start every time we boot:

systemctl enable myservice.service

Second, start it now:

systemctl start myservice.service

Note that you don’t get feedback from this command, because all it does it send a message to systemd telling it to start your service. The command you typed doesn’t hang around to see what happens next. You may use systemctl status myservice.service (or systemctl status myservice) to check on your service, to make sure it seems OK.

Also note that systemctl status myservice gives more information if you run it as root, compared to running it as a normal user.

On our Umbrel node we run the following:

sudo systemctl daemon-reload

sudo systemctl enable docker-compose-circuitbreaker.service

sudo systemctl start docker-compose-circuitbreaker.service

If we got everything right we don’t get any output:

We can check the status of the service:

sudo systemctl status docker-compose-circuitbreaker.service

Congratulations, you achieved the following:

  • CB is installed and protects your Umbrel from being flooded with htlcs
  • CB is getting started automatically after power on and reboot

Useful commands

In case anything goes wrong during this configuration here are some useful commands which I had to run a lot during testing.

Before applying changes to a docker container:

docker container ls -a

docker ps

docker ps | grep circuitbreakerd

to check the container is loaded and to get the container ID

sudo docker container stop [container ID]

to stop a running container to apply some changes

sudo docker container rm [container ID]

to remove a stopped container to apply some changes

sudo docker container start [container ID]

to start a stopped container

To change the service file:

sudo nano /etc/systemd/system/docker-compose-circuitbreaker.service

Apply changes and restart the service:

sudo systemctl stop docker-compose-circuitbreaker.service

sudo systemctl daemon-reload

sudo systemctl start docker-compose-circuitbreaker.service

sudo systemctl enable docker-compose-circuitbreaker.service

Useful links

Docker:

Articles and guides on systemd Services:

https://wiki.debian.org/systemd/Services

1 Like