forked from horologger/albyhub-startos
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): Add Lightning implementation selection
- Introduce 'lightning' configuration option - Allow users to choose between LND and Alby embedded node (LDK) - Implement handling of switching between LND and Alby/LDK setups with backup and restore system for different configurations. - Update description with detailed explanations for each option - Update instructions and change marketing-site to albyhub.com
- Loading branch information
Showing
5 changed files
with
174 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,113 @@ | ||
#!/bin/sh | ||
|
||
export LN_BACKEND_TYPE="LND" | ||
export LND_ADDRESS="lnd.embassy:10009" #the LND gRPC address, eg. localhost:10009 (used with the LND backend) | ||
export LND_CERT_FILE="/mnt/lnd/tls.cert" #the location where LND's tls.cert file can be found (used with the LND backend) | ||
export LND_MACAROON_FILE="/mnt/lnd/admin.macaroon" #the location where LND's admin.macaroon file can be found (used with the LND backend) | ||
printf "\n\n [i] Starting Alby Hub ...\n\n" | ||
|
||
# Read current LN setup from config | ||
LN_VALUE=$(grep 'lightning:' /data/start9/config.yaml | cut -d ' ' -f 2) | ||
|
||
# File to track initial setup (lnd or alby) | ||
SETUP_FILE="/data/start9/initial_setup" | ||
WORK_DIR="/data/albyhub" | ||
BACKUP_DIR="/data/start9/backups" | ||
|
||
# Ensure the backup directory exists | ||
mkdir -p "$BACKUP_DIR" | ||
|
||
# Determine the initial setup | ||
if [ -f "$SETUP_FILE" ]; then | ||
INITIAL_SETUP=$(cat "$SETUP_FILE") | ||
else | ||
INITIAL_SETUP="$LN_VALUE" | ||
echo "$INITIAL_SETUP" >"$SETUP_FILE" # Store initial setup if it doesn't exist | ||
fi | ||
# Function to create a tar.gz backup of the albyhub directory | ||
backup_dir() { | ||
suffix="$INITIAL_SETUP" | ||
tar_file="$BACKUP_DIR/${suffix}_backup.tar.gz" | ||
|
||
# Create a tar.gz file containing the albyhub directory | ||
tar -czf "$tar_file" -C "/data" albyhub 2>/dev/null | ||
echo "[i] Created backup: $tar_file" | ||
} | ||
# Function to restore the albyhub directory from a tar.gz backup | ||
restore_dir() { | ||
suffix="$1" # Either 'lnd' or 'alby' | ||
tar_file="$BACKUP_DIR/${suffix}_backup.tar.gz" | ||
|
||
if [ -f "$tar_file" ]; then | ||
rm -rf "$WORK_DIR" | ||
tar -xzf "$tar_file" -C "/data" | ||
echo "[i] Restored from backup: $tar_file" | ||
else | ||
echo "[i] No $suffix backup found." | ||
fi | ||
} | ||
|
||
# Handling different setups | ||
if [ "$INITIAL_SETUP" != "$LN_VALUE" ]; then | ||
if [ "$INITIAL_SETUP" = "lnd" ] && [ "$LN_VALUE" = "alby" ]; then | ||
echo "[i] Switching from LND to Alby/LDK..." | ||
|
||
# Backup current LND directory | ||
backup_dir | ||
|
||
# Restore Alby backup if it exists, otherwise start fresh | ||
if [ -f "$BACKUP_DIR/alby_backup.tar.gz" ]; then | ||
restore_dir "alby" | ||
else | ||
echo "[i] No Alby/LDK backup found, starting fresh..." | ||
rm -rf "$WORK_DIR" | ||
mkdir -p "$WORK_DIR" | ||
fi | ||
|
||
# Update the initial setup to 'alby' | ||
echo "alby" >"$SETUP_FILE" | ||
|
||
elif [ "$INITIAL_SETUP" = "alby" ] && [ "$LN_VALUE" = "lnd" ]; then | ||
echo "[i] Switching from Alby/LDK to LND..." | ||
|
||
# Backup current Alby directory | ||
backup_dir | ||
|
||
# Restore LND backup if it exists, otherwise clean up the data directory for initial LND setup | ||
if [ -f "$BACKUP_DIR/lnd_backup.tar.gz" ]; then | ||
restore_dir "lnd" | ||
else | ||
echo "[i] No LND backup found, cleaning up the data directory for initial LND setup..." | ||
rm -rf "$WORK_DIR" | ||
mkdir -p "$WORK_DIR" | ||
fi | ||
|
||
# Update the initial setup to 'lnd' | ||
echo "lnd" >"$SETUP_FILE" | ||
fi | ||
fi | ||
|
||
# Set up environment variables based on LN_VALUE | ||
if [ "$LN_VALUE" = "lnd" ]; then | ||
export LN_BACKEND_TYPE="LND" | ||
export LND_ADDRESS="lnd.embassy:10009" # the LND gRPC address | ||
export LND_CERT_FILE="/mnt/lnd/tls.cert" # the location where LND's tls.cert file can be found | ||
export LND_MACAROON_FILE="/mnt/lnd/admin.macaroon" # the location where LND's admin.macaroon file can be found | ||
else | ||
# Default to Alby/LDK if lightning value is not "lnd" | ||
export LN_BACKEND_TYPE="LDK" | ||
unset LND_ADDRESS | ||
unset LND_CERT_FILE | ||
unset LND_MACAROON_FILE | ||
fi | ||
|
||
export WORK_DIR="/data/albyhub" | ||
export PORT=8080 #the port on which the app should listen on (default='blah' #8080) | ||
export PORT=8080 #the port on which the app should listen on (default='blah' #8080) | ||
export LOG_EVENTS=true # makes debugging easier | ||
|
||
# export TOR_ADDRESS=$(yq e '.tor-address' /data/start9/config.yaml) | ||
# export LAN_ADDRESS=$(yq e '.lan-address' /data/start9/config.yaml) | ||
printf "\n\n [i] Starting Alby Hub ...\n\n" | ||
echo "LN Backend Type: " $LN_BACKEND_TYPE | ||
echo "LN Address: " $LND_ADDRESS | ||
echo "LND Cert: " $LND_CERT_FILE | ||
echo "LND Macaroon: " $LND_MACAROON_FILE | ||
# Output some debug information | ||
echo "LN Backend Type: $LN_BACKEND_TYPE" | ||
if [ "$LN_VALUE" = "lnd" ]; then | ||
echo "LN Address: $LND_ADDRESS" | ||
echo "LND Cert: $LND_CERT_FILE" | ||
echo "LND Macaroon: $LND_MACAROON_FILE" | ||
fi | ||
|
||
# Start the Alby Hub app | ||
exec /bin/main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,31 @@ | ||
# Quick Start Guide for Alby Hub | ||
|
||
1. **Launch Alby Hub** | ||
Click the `Launch UI` button to start Alby Hub. | ||
1. **Configure Alby Hub** | ||
In the Alby Hub configuration settings, select your preferred Lightning implementation: | ||
|
||
2. **Get Started** | ||
On the Alby Welcome screen, click **Get Started (LND)**. | ||
- **LND on this node**: This is the default and preferred method, offering full control over your node. Use the LND (Lightning Network Daemon) implementation for increased sovereignty and security. | ||
- **Alby embedded node (LDK)**: Use the built-in Alby's Lightning Development Kit (LDK) implementation for convenience. This option doesn't require running your own LND node and might be a good choice for low-powered devices. | ||
|
||
3. **Create a Strong Password** | ||
Set a strong password for your Alby Hub account. It’s recommended to store this password securely in your self-hosted Vaultwarden. | ||
2. **Start the Service** | ||
After configuring, start the Alby Hub service. | ||
|
||
4. **Connect Your Alby Account** | ||
3. **Launch Alby Hub** | ||
Click the `Launch UI` button to open the Alby Hub interface. | ||
|
||
4. **Get Started** | ||
On the Alby Welcome screen, click the **Get Started** button. The button will display either (LND) or (LDK) based on your chosen configuration. | ||
|
||
5. **Create a Strong Password** | ||
Set a strong password for your Alby Hub account. It's recommended to store this password securely in your self-hosted Vaultwarden. | ||
|
||
6. **Connect Your Alby Account** | ||
Follow the on-screen instructions to connect your Alby account. | ||
|
||
5. **All Set!** | ||
You’re done! Your Alby Hub is now ready to use. | ||
7. **All Set!** | ||
You're done! Your Alby Hub is now ready to use. | ||
|
||
## Getting Help | ||
|
||
For more information and help about Alby visit [getalby.com](https://getalby.com) | ||
For more information and help about Alby Hub visit [albyhub.com](https://albyhub.com/) | ||
|
||
You can also ask for assistance in the [Start9 community chats](https://start9.com/contact). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters