Skip to content

Instantly share code, notes, and snippets.

@openoms openoms/thunderhub.md Secret

Last active Jul 26, 2020
Embed
What would you like to do?
ThunderHub Installation

example: https://www.thunderhub.io/
https://github.com/apotdevin/thunderhub
use lnd v0.10.0 for full compatibility

RaspiBlitz install script:

https://github.com/rootzoll/raspiblitz/blob/v1.6/home.admin/config.scripts/bonus.thunderhub.sh
usage:

# update NodeJS
wget https://raw.githubusercontent.com/rootzoll/raspiblitz/v1.6/home.admin/config.scripts/bonus.nodejs.sh
bash bonus.nodejs.sh off
bash bonus.nodejs.sh on
# download thunderhub install script
wget https://raw.githubusercontent.com/rootzoll/raspiblitz/v1.6/home.admin/config.scripts/bonus.thunderhub.sh
# run
bash bonus.thunderhub.sh on

Manual installation on a RaspiBlitz:

# Preparations
# check and install NodeJS
/home/admin/config.scripts/bonus.nodejs.sh

# open the firewall for the chosen port (here: 3010)
# set any free port (the default port: 3000 is reserved for RTL)
# fill in the approrpriate local subnet (here: 192.168.0.0/16)
sudo ufw allow from 192.168.0.0/16 to any port 3010 comment 'allow ThunderHub on LAN'

# create a dedicated Hidden Service (if Tor is on)):
/home/admin/config.scripts/internet.hiddenservice.sh thunderhub 80 3010

# create thunderhub user
sudo adduser --disabled-password --gecos "" thunderhub

# change to thunderhub user
sudo su - thunderhub

git clone https://github.com/apotdevin/thunderhub.git
cd thunderhub
npm install
npm run build

# run this in Tmux if you want to keep it running after closing the terminal
npm run start -- -p 3010

Connect to RASPIBLITZ_IP:3010 or to the TOR_HIDDEN_SERVICE.onion in the Tor Browser.

Copy the HEX macaroon and TLS.cert from the menu: LNDCREDS -> EXPORT -> HEX
Use localhost or the LAN_IP and the GRPC port 10009.

Afterwards use the command to run (in Tmux if you want to keep it running after closing the terminal):

sudo su - thunderhub
cd thunderhub
npm run start:compatible -- -p 3010

To uninstall ThunderHub:

sudo userdel -rf thunderhub

To update ThunderHub:

with the RaspiBlitz install script:

bash bonus.thunderhub.sh update

Manual:

sudo systemctl stop thunderhub
sudo su - thunderhub
cd thunderhub
git pull
npm install
npm run build
exit
sudo systemctl start thunderhub

.env file:

nano /home/thunderhub/thunderhub/.env

# -----------
# Server Configs
# -----------
LOG_LEVEL='debug'
# HODL_KEY='HODL_HODL_API_KEY'
# BASE_PATH='/basePath'

# -----------
# Interface Configs
# -----------
THEME='dark'
# CURRENCY='sat'
# FETCH_PRICES=false
# FETCH_FEES=false

# -----------
# Account Configs
# -----------
ACCOUNT_CONFIG_PATH='/home/thunderhub/thubConfig.yaml'
#COOKIE_PATH='/home/thunderhub/.cookie'
#SSO_SERVER_URL='127.0.0.1:10009'
#SSO_CERT_PATH='/home/thunderhub/.lnd/tls.cert'
#SSO_MACAROON_PATH='/home/thunderhub/.lnd/data/chain/bitcoin/mainnet/'

thubConfig.yaml:

nano /home/thunderhub/thubConfig.yaml

masterPassword: 'PASSWORD' # Default password unless defined in account
accounts:
  - name: 'blitz'
    serverUrl: '127.0.0.1:10009'
    macaroonPath: '/home/thunderhub/.lnd/data/chain/bitcoin/mainnet/admin.macaroon'
    certificatePath: '/home/thunderhub/.lnd/tls.cert'
   #password: 'accountpassword'

Systemd unit

(can copy-paste the whole script)

    # install service
    echo "*** Install ThundeHub systemd for ${network} on ${chain} ***"
    cat > /home/admin/thunderhub.service <<EOF
# Systemd unit for thunderhub
# /etc/systemd/system/thunderhub.service

[Unit]
Description=ThunderHub daemon
Wants=lnd.service
After=lnd.service

[Service]
WorkingDirectory=/home/thunderhub/thunderhub
ExecStart=/usr/bin/npm run start -- -p 3010
User=thunderhub
Restart=always
TimeoutSec=120
RestartSec=30
StandardOutput=null
StandardError=journal

[Install]
WantedBy=multi-user.target
EOF

    sudo mv /home/admin/thunderhub.service /etc/systemd/system/thunderhub.service 
    sudo chown root:root /etc/systemd/system/thunderhub.service
    sudo systemctl enable thunderhub
    echo "OK - the ThunderHub service is now enabled"
 
 sudo systemctl start thunderhub
@openoms

This comment has been minimized.

Copy link
Owner Author

openoms commented May 20, 2020

To remove yarn serving the previous versions:
sudo apt remove yarn

@grnqrtr

This comment has been minimized.

Copy link

grnqrtr commented May 21, 2020

Hey @openoms, I used your instructions before with no problems, but after the last ThunderHub update, I now get this after npm install:

found 14 vulnerabilities (7 low, 1 moderate, 6 high)
  run `npm audit fix` to fix them, or `npm audit` for details

npm audit fix just says that you need to fix issues manually.

@openoms

This comment has been minimized.

Copy link
Owner Author

openoms commented May 21, 2020

@qrnqrtr that is about the numerous Javascript dependencies managed upstream.
There is nothing actionable on our side.
This is one of the reasons I aim to separate the various applications under their own non-sudo user.

@grnqrtr

This comment has been minimized.

Copy link

grnqrtr commented May 21, 2020

Okay, thanks. Maybe it was the same before and I didn't notice.

@apotdevin

This comment has been minimized.

Copy link

apotdevin commented May 26, 2020

Updated and removed some dependencies. The npm audit vulnerabilities is now less.

The High and Moderate dependencies as shown below can be safely ignored as shown in this thread: airbnb/babel-plugin-inline-react-svg#59

image

The remaining vulnerabilities should all be Low.

Will try to keep them as reduced as possible, but there's only so much I can do with external dependencies

@openoms

This comment has been minimized.

Copy link
Owner Author

openoms commented May 26, 2020

Thanks for clarifying this @apotdevin!

@drunkenclam

This comment has been minimized.

Copy link

drunkenclam commented May 26, 2020

It seems to be working fine for me at first, but when I try to create an invoice I get this (yes, it's setup with Admin Macaroon):

2020-05-25 15:49:45 error [THUB]: Error getting invoice: [
  503,
  'AddInvoiceError',
  {
    err: Error: 2 UNKNOWN: permission denied
        at Object.exports.createStatusError (/home/thunderhub/thunderhub/node_modules/grpc/src/common.js:91:15)
        at Object.onReceiveStatus (/home/thunderhub/thunderhub/node_modules/grpc/src/client_interceptors.js:1209:28)
        at InterceptingListener._callNext (/home/thunderhub/thunderhub/node_modules/grpc/src/client_interceptors.js:568:42)
        at InterceptingListener.onReceiveStatus (/home/thunderhub/thunderhub/node_modules/grpc/src/client_interceptors.js:618:8)
        at callback (/home/thunderhub/thunderhub/node_modules/grpc/src/client_interceptors.js:847:24) {
      [stack]: 'Error: 2 UNKNOWN: permission denied\n' +
        '    at Object.exports.createStatusError (/home/thunderhub/thunderhub/node_modules/grpc/src/common.js:91:15)\n' +
        '    at Object.onReceiveStatus (/home/thunderhub/thunderhub/node_modules/grpc/src/client_interceptors.js:1209:28)\n' +
        '    at InterceptingListener._callNext (/home/thunderhub/thunderhub/node_modules/grpc/src/client_interceptors.js:568:42)\n' +
        '    at InterceptingListener.onReceiveStatus (/home/thunderhub/thunderhub/node_modules/grpc/src/client_interceptors.js:618:8)\n' +
        '    at callback (/home/thunderhub/thunderhub/node_modules/grpc/src/client_interceptors.js:847:24)',
      [message]: '2 UNKNOWN: permission denied',
      code: 2,
      metadata: Metadata { _internal_repr: {}, flags: 0 },
      details: 'permission denied'
    }
  },
  [length]: 3
]
@openoms

This comment has been minimized.

Copy link
Owner Author

openoms commented May 26, 2020

@drunkenclam can you please open an issue at https://github.com/apotdevin/thunderhub describing your environment?
The developer can try to reproduce and help you there

@drunkenclam

This comment has been minimized.

Copy link

drunkenclam commented May 26, 2020

@openoms done, thanks

@drunkenclam

This comment has been minimized.

Copy link

drunkenclam commented May 26, 2020

@openoms is it correct that sometimes port 3001 is used and sometimes 3010?

@openoms

This comment has been minimized.

Copy link
Owner Author

openoms commented May 26, 2020

thanks fixed, it needs to be consistent. Decided to use 3010 as it will be in RaspiBlitz.

@Jestopher-BTC

This comment has been minimized.

Copy link

Jestopher-BTC commented May 28, 2020

When I dump the Systemd Unit into the command line, I get an error at the "fi" line.

@openoms

This comment has been minimized.

Copy link
Owner Author

openoms commented May 28, 2020

@Jestopher-BTC sure, removed that

@hermanlim

This comment has been minimized.

Copy link

hermanlim commented Jul 25, 2020

Hi, can anyone confirm whether the 'Chats' is working on Raspiblitz 1.6 RC3 with Thunder Hub fully updated? I keep getting a "Cannot read property 'messages' of undefined" error.

@grnqrtr

This comment has been minimized.

Copy link

grnqrtr commented Jul 25, 2020

@hermanlim Yes, I just checked, seems to be working fine for me on Raspiblitz 1.6 RC3 with ThunderHub fully updated.

@apotdevin

This comment has been minimized.

Copy link

apotdevin commented Jul 25, 2020

Hey @ hermanlim, when are you getting this error?

@hermanlim

This comment has been minimized.

Copy link

hermanlim commented Jul 25, 2020

@apotdevin, I'm getting it everytime I click on the chat bubble, on the top right of the screen.
This has never worked properly, although the rest of the app works well and without issue.

@grnqrtr, thanks for checking.

Screenshot_20200725_204614

@apotdevin

This comment has been minimized.

Copy link

apotdevin commented Jul 26, 2020

@hermanlim thanks! Will look into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.