Skip to content

Instantly share code, notes, and snippets.

@microlancer
Last active April 23, 2021 07:39
Show Gist options
  • Save microlancer/5bf3d6cad9fba96e720db43f5f6fa62a to your computer and use it in GitHub Desktop.
Save microlancer/5bf3d6cad9fba96e720db43f5f6fa62a to your computer and use it in GitHub Desktop.
Setting up Thunderhub

First, get the repo:

git clone https://github.com/apotdevin/thunderhub

In the thunderhub repo, there is a folder named "example" and inside docker-compose.yml you can start from.

I modified it as follows:

version: '3'
services:
  thunderhub:
    image: apotdevin/thunderhub:v0.12.14
    restart: unless-stopped
    stop_signal: SIGKILL
    environment:
      # BASE_PATH: '/thub'
      # COOKIE_PATH: '/data/.cookie'
      # SSO_SERVER_URL: 'lnd_bitcoin:10009'
      # SSO_MACAROON_PATH: '/etc/lnd'
      # SSO_CERT_PATH: '/etc/lnd/tls.cert'
      # NO_CLIENT_ACCOUNTS: 'true'
      ACCOUNT_CONFIG_PATH: '/data/thubConfig.yaml'
      LOG_LEVEL: debug
    volumes:
      - ./data:/data
    ports:
      - '3000:3000'
    expose:
      - '3000'
    command: ['npm', 'run', 'start']

In the same example folder, I created a ./data directory with the 3 files:

  • thubConfig.yaml
  • tls.cert
  • admin.macaroon

The yaml file looks like:

masterPassword: passw0rd123
accounts:
  - name: Account 1
    serverUrl: 172.19.0.1:10009
    macaroonPath: /data/admin.macaroon
    certificatePath: /data/tls.cert
    password: passw0rd456

I ran:

docker-compose up

The serverUrl is the LND host and port. To figure this one out, I checked the network:

ip a
docker network ls
docker network inspect <...>

Until I figured out that from the container's perspective, the docker IP 172.19.0.1 represented the host that is running LND.

To test this, I also did:

docker exec -ti <thunderhub image name> /bin/sh

And then ran:

nc -vz 172.19.0.1 10009

Initially, this wouldn't connect. Then I realized it was a firewall issue. I was using ufw, so I added:

ufw allow from 172.19.0.0/24 to any port 10009

Then I ran the nc command again to check, and got the output:

172.19.0.1 (172.19.0.1:10009) open

If docker container is running on your local system you can just go to http://localhost:3000 at this point. Since my docker container was on a remote host, so I created a localhost 3000 tunnel over ssh.

ssh -L 3000:localhost:3000 username@remotehost

Then I can browse to http://localhost:3000 and get the welcome page. I can then login.

If there are any errors, you can check the terminal where you ran docker-compose up and see the error messages there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment