Umbrel - Installing BoS

From PlebNet Wiki
Jump to navigation Jump to search

Installing BOS

These are the commands to enter in a command-line interface for Umbrel - (once you have ssh'd into your umbrel, you can follow these steps):

These instructions are from bos installation instructions.

curl -sL | sudo -E bash -

sudo apt-get install -y nodejs

Avoid using sudo with NPM

mkdir ~/.npm-global

npm config set prefix '~/.npm-global'

Update path

nano ~/.profile

Add a new line to the end:


This line should be by itself, literally at the end. Outside of any "if then" code.

Save and exit ctrl + x
y enter

update shell:

. ~/.profile

Install balanceofsatoshis. This command also works for upgrade

npm i -g balanceofsatoshis

Upgrading bos

Skip this step if you are installing BoS for the first time. Go down to next section, "Validate..."

If you already have bos and want to upgrade:

kill running telegram bot process

ps -ef | grep bos | grep -v grep does it show the running process for bos telegram? if yes terminate that session with kill -9 processid process id the is the first number in ps -ef outout (see below - the process id is 32605)

umbrel@umbrel:~ $ ps -ef |grep bos | grep -v grep
umbrel   32605 10432  0 20:58 pts/2    00:00:11 node /usr/bin/bos telegram --connect

upgrade using (you may have to use sudo if you previously installed bos with sudo)

npm i -g balanceofsatoshis

however, there could be some checks you can make before upgrade to make sure you do not run into trouble.

  1. if you have previously installed bos with sudo npm i -g balanceofsatoshis please upgrade also with sudo or else you might run into version issues.
  2. if your upgrades succeed up bos -V still gives the old version do the following

find / -name bos 2>/dev/null does it show 4 areas?

$ find / -name bos 2>/dev/null

if yes, please delete the /usr/local/bin installation by sudo rm /usr/local/bin/bos sudo rm -r /usr/local/lib/node_modules/balanceofsatoshis

check /usr/bin/bos -V shows correct version?

then exit the shell and enter again. Check with bos -V

reconnect your telegram bot with the new version.

Validate that the tool is working:

Run the following commands and validate the output (not an error):

bos --version
bos utxos

If you get a 503, UnexpectedgetUtxosError, do the following:

sudo nano /etc/hosts
add the following line at the bottom umbrel.local

Then save and exit, ctrl + x
y enter

Now test again

Installing Telegram Bot

Video Instructions of Initial Setup

Go to Telegram Start chat with @BotFather press /start /newbot

Link to video instructions.

After the video setup, see also BoS Telegram AutoStart (OR) scroll down to the TMUX instructions to keep the bot running in the background. Use only one of them.

Text Instructions of Initial Setup

Go to Telegram Start chat with @BotFather press /start /newbot Decide A bot name NodeAliasNew Decide a bot user name for telegram BotName_bot

You will get a long alphanumeric API KEY for the bot, Note that. You can always retrieve it using /mybot with BotFather
BotFather will give you a link to your new bot, click on it and it will take you to your bot.
Now come back to your node
On your SSH session run: bos telegram at first prompt type API key (alpha numeric) received from BotFather.

In Telegram go to your bot by clicking on the link provided in BotFather ( Then press Start.

type /connect
you will get a numeric key, type that numeric key on the second prompt in your ssh session with bos telegram

You should get a connected message in your Telegram Bot as well as on SSH session.

Verify by typing /version in your telegram bot and you should see the version number of bos.

Press Ctrl-C in SSH session with bos telegram
bos telegram command needs to be running in the background for the bot to be online always, you can keep the bot online with either Docker or TMUX. If you prefer not to install docker or tmux option, see the disown/nohup section at the end.

see also BoS Telegram AutoStart

TMUX Instructions

TMUX To use tmux, you can do the following:

sudo apt-get install tmux

tmux new -s <give any session name>

The session name can be anything you like to name. e.g. "my_telegram_bot"

then in that window bos telegram --connect <connect id> where connect_id is your connection id - numeric key received from bot.

at this point, your bot should be working

to detach from TMUX, now enter ctrl+b d note ctrl-b is one command followed by d (not ctrl-b d together)

It should say detached from the session

If you want to connect back to this session later, just ssh again and then tmux ls and you should see your session you can then use tmux attach -t <YourSessionNameHere> you can keep attaching and detaching from the session and it keeps running

tmux kill-server —— to kill the sessions tmux attach -t <session name>

Disown or Nohup Instructions

if you are not using docker or tmux and want a simpler unix way or running the process in background after you exit the shell you can use disown or nohup.

bos telegram --connect <yourConnectionCode> 1> /tmp/bos.log 2>&1 & disown OR nohup bos telegram --connect <yourConnectionCode> 1> /tmp/bos.log 2>&1 &

both command will execute the process in background and you will get the process id as

$ /usr/bin/bos telegram --connect XXXXXX 1>/tmp/bos.log 2>&1 & disown

[1] 26912 <---- this process ID will be different for each session.

when you are running under nohup, exit your shell by typing exit on your shell prompt and do not just press x on there terminal window to close the window. Closing terminal window sends SIGTERM to terminated the running processes under the shell instead of SIGHUP.

disown is preferred, some plebs have reported issues with nohup that the process exits after they exit from shell (possibly by closing the window instead of pressing exit).

Docker Instructions:

If you have done npm install as above, docker ends up running a separate copy and it will cause confusion when you upgrade (because your bos telegram would show a different version to rest of upgraded bos). We suggest you run bos telegram under tmux, disown, or nohup as described above. if you still prefer to run under docker the instructions are below.


docker pull alexbosworth/balanceofsatoshis

For upgragrade docker ps | grep bos | grep -v grep and note the container id of bos container.

docker rm -f {container-id} to remove the previous image.

Now pull the new image and proceed to restart the bos container docker ps to check the container id running bos and docker restart <container id>

This is the UMBREL SPECIFIC docker command string to run the telegram bot:, this is a sample LND_IP. To get your own LND_IP address to use in the docker command, run:
cat /home/umbrel/.env
and replace the IP you get in the below command.
docker run -d --restart always --network="host" --add-host=umbrel.local: -v $HOME/.bos:/home/node/.bos -v $HOME/umbrel/lnd:/home/node/.lnd:ro alexbosworth/balanceofsatoshis:latest telegram --connect <YOUR CONNECT CODE HERE>

Paying invoices from bot

If you have secure access to your telegram account and you want to allow the Telegram Bot to pay invoices set a budget to pay for invoices through telegram using bot's /pay command:

bos telegram —-connect <numeric key from telegram bot> —-budget <yourMaxBudget in sats>

If you prefer to use bot only for messages from your node, do not set budget and it wont be able to pay any invoices.