Difference between revisions of "Umbrel - Installing BoS"

From PlebNet Wiki
Jump to navigation Jump to search
Line 82: Line 82:


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


In telegram go to your bot (link in BotFather window usually @BotName_bot
In telegram go to your bot (link in BotFather window usually @BotName_bot


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


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


Press Ctrl-C in SSH session with <code> bos telegram </code>
Press Ctrl-C in SSH session with <code> bos telegram </code>
Now run it as <code> nohup bos telegram --connect <yourConnectionCode> 1>/tmp/bos.log 2>&1 &</code> if you want to pay invoices from telegram use <code> nohup bos telegram --connect <yourConnectionCode> --budget <yourBudgetAmount-OPTIONAL> 1>/tmp/bos.log 2>&1 &</code>
<br>
 
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.
This will run your telegram bot even if you come out of your ssh session.
<br>
 
<br>
Instead of nohup you can also run it under TMUX if you are familiar.
==== Docker Instructions: ====
 
You may also run this with a docker command, this is the UMBREL SPECIFIC docker command string to run the telegram bot:
docker run -d --restart always --network="host" --add-host=umbrel.local:10.21.21.9 -v $HOME/.bos:/home/node/.bos -v $HOME/umbrel/lnd:/home/node/.lnd:ro alexbosworth/balanceofsatoshis:latest telegram --connect <YOUR CONNECT CODE HERE>


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

Revision as of 20:49, 1 September 2021

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 https://deb.nodesource.com/setup_14.x | 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 line to the end

PATH="$HOME/.npm-global/bin:$PATH"

Save and exit ctrl + x
y enter

update shell:

. ~/.profile

Install balanceofsatoshis. This command also works for upgrade

npm i -g balanceofsatoshis

Step 3: 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

127.0.0.1 umbrel.local

Then save and exit, ctrl + x
y enter

Now test again

Step 4: Installing Telegram Bot

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 (link in BotFather window usually @BotName_bot

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.

Docker Instructions:

This is the UMBREL SPECIFIC docker command string to run the telegram bot: 10.21.21.9 to get this IP address in the below command, do:
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:10.21.21.9 -v $HOME/.bos:/home/node/.bos -v $HOME/umbrel/lnd:/home/node/.lnd:ro alexbosworth/balanceofsatoshis:latest telegram --connect <YOUR CONNECT CODE HERE>

TMUX Installation

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>

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.