Skip to content

Instantly share code, notes, and snippets.

@callebtc
Last active February 22, 2023 14:07
Show Gist options
  • Save callebtc/61417cce47ff00a8ed4d19c45f1ff10f to your computer and use it in GitHub Desktop.
Save callebtc/61417cce47ff00a8ed4d19c45f1ff10f to your computer and use it in GitHub Desktop.
Restore extensions after LNbits update

Background

Starting from commit b99b413, LNbits bundling has transitioned into a new model where all the extensions are not part of the main repository anymore. We made this step to improve the security of instances, enabling them to run only the extensions they choose, and to improve code maintainability over the long run.

This means that the default LNbits install doesn't come with extensions anymore as they all have been moved to external repositories. When you do a git pull on your LNbits (on the main branch), you might notice that all extensions are suddenly gone. This gist is here to help.

If you run your own instance, I recommend installing extensions one by one, depending on what you actually need to keep the attack surface of your instance as small as possible. We will have a list of vetted extensions that we have checked and we'll maintain.

Locate the extension

All extensions are spread across different repositories now. We host a manifest file with all the previously default extensions that has the information on how to download extensions. Check the manifest file and note the name of the extension you want to install. For example, this could be withdraw,lnurlp.

Install missing extensions automatically

If you're running a service on top of LNbits, it's likely that you don't use the Web interface a lot. We have added a new config option LNBITS_EXTENSIONS_DEFAULT_INSTALL that wants a comma-separated list of the extensions you want to have installed automatically when LNbits starts up. To install the extensions identified above, add this to your .env configuration file

LNBITS_EXTENSIONS_DEFAULT_INSTALL="withdraw,lnurlp"

Notice the comma and there are no spaces between entries. Now start up lnbits and you should see these extensions being available to you again.

Install missing extensions manually

Create an Admin user

In order to install the extensions manually through the user interface, you have to log in as an admin user. If you don't know the user ID of an admin yet, make an existing user admin. Below you can see the user id de6811bfa2b4400c99c3026da54bf68f of the currently logged in user (make sure this is you!).

getting the admin user ID

Copy that ID and add the following to your .env configuration file (or edit the entry that might be empty).

LNBITS_ADMIN_USERS="de6811bfa2b4400c99c3026da54bf68f"

Alternative: Admin UI

Instead of adding admin users throuhg the configuration, you can also use the Admin UI. To enable the Admin UI, set LNBITS_ADMIN_UI=true in your .env file to generate a superuser account on startup. You will see the link to the superuser account in the terminal.

Finished! Now: Install extensions

Now, when you restart LNbits again, you'll notice that this user is now an admin and can install extensions in the "Manage Extensions" menu. Here is a more detailed guide how you can proceed from here.

Manage extensions

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