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.
Merge pull request horologger#10 from Start9Labs/update/1.9.0
Update/1.9.0
- Loading branch information
Showing
8 changed files
with
217 additions
and
212 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,4 +1,5 @@ | ||
FROM ghcr.io/getalby/hub:v1.8.0 AS builder | ||
FROM ghcr.io/getalby/hub:v1.10.1 AS builder | ||
RUN apt update; apt install -y --no-install-recommends caddy | ||
|
||
FROM debian:12-slim AS final | ||
|
||
|
@@ -10,5 +11,7 @@ COPY --from=builder /usr/lib/nwc/libglalby_bindings.so /usr/lib/nwc/ | |
COPY --from=builder /usr/lib/nwc/libldk_node.so /usr/lib/nwc/ | ||
COPY --from=builder /bin/main /bin/ | ||
COPY --chmod=755 docker_entrypoint.sh /usr/local/bin/ | ||
COPY --from=builder /usr/bin/caddy /usr/bin/ | ||
RUN mkdir -p /etc/caddy | ||
|
||
LABEL maintainer="andrewlunde <[email protected]>" |
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,143 @@ | ||
#!/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 | ||
export ENABLE_ADVANCED_SETUP=false | ||
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 | ||
# Reverse proxy configuration (aka Firefox patch) | ||
cat <<EOF >/etc/caddy/Caddyfile | ||
{ | ||
admin off | ||
servers { | ||
protocols h1 h2c h3 | ||
} | ||
} | ||
:8443 { | ||
tls /mnt/cert/main.cert.pem /mnt/cert/main.key.pem | ||
reverse_proxy albyhub.embassy:8080 | ||
} | ||
EOF | ||
|
||
# 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 | ||
|
||
# Set up a trap to catch INT signal for graceful shutdown and start | ||
_term() { | ||
echo "Caught INT signal!" | ||
kill -INT "$alby_process" 2>/dev/null | ||
kill -INT "$caddy_process" 2>/dev/null | ||
} | ||
|
||
main & | ||
alby_process=$! | ||
|
||
caddy run --config /etc/caddy/Caddyfile & | ||
caddy_process=$! | ||
|
||
trap _term INT | ||
|
||
exec /bin/main | ||
wait $caddy_process $alby_process |
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 server**: This option tells Alby Hub to use the LND node installed on this StartOS server. It is the more sovereign and secure option, allowing full control over your node. | ||
- **Alby Hub embedded light node**: This option tells Alby Hub to use its own, built-in light node. This option is convenient but offers less control over your node. | ||
|
||
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. If you are using the Alby Hub embedded light node, it is critical you do not lose your password, as it will result in loss of funds. | ||
|
||
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). |
Oops, something went wrong.