mirror of
https://github.com/getAlby/hub.git
synced 2026-08-13 12:33:39 +02:00
chore: better handle ports on Pi and allow albyhub to run on port 80 (#584)
* chore: better handle ports on Pi and allow albyhub to run on port 80 * chore: install script: create data dir before running docker compose * chore: install script for pi-aarch64 * chore: pi-zero move lib folder on update * chore: replace (not append) files in install scripts * chore: install text
This commit is contained in:
parent
207a8e44cb
commit
49449f0dfc
10 changed files with 160 additions and 24 deletions
|
|
@ -3,7 +3,8 @@
|
|||
## Requirements
|
||||
|
||||
- Linux distribution
|
||||
- Runs pretty much on any VPS/server with 512MB RAM or more (+some swap space ideally)
|
||||
- Runs pretty much on any VPS/server with 512MB RAM or more (1GB recommended / plus some swap space ideally)
|
||||
- lightning port 9735 must be available
|
||||
|
||||
### Installation (non-Docker)
|
||||
|
||||
|
|
@ -46,3 +47,17 @@ Make sure to backup your data directories:
|
|||
The install script will add an update.sh script to update Alby Hub. It will download the latest version for you.
|
||||
|
||||
After the update you will have to unlock Alby Hub again.
|
||||
|
||||
### Using Docker
|
||||
|
||||
Alby Hub comes as docker image: [ghcr.io/getalby/hub:latest](https://github.com/getAlby/hub/pkgs/container/hub)
|
||||
|
||||
$ docker run -v .albyhub-data:/data -e WORK_DIR='/data' -p 8080:8080 ghcr.io/getalby/hub:latest`
|
||||
|
||||
We also provide a simple docker-compose file:
|
||||
|
||||
$ wget https://raw.githubusercontent.com/getAlby/hub/master/docker-compose.yml # <- edit for your needs, but defaults should work well
|
||||
$ mkdir ./albyhub-data
|
||||
$ docker-compose up # or docker-compose up --pull=always <- to make sure you get the latest images
|
||||
|
||||
Make sure to mount and backup the data working directory.
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ then
|
|||
exit
|
||||
fi
|
||||
|
||||
sudo tee -a /etc/systemd/system/albyhub.service > /dev/null << EOF
|
||||
sudo tee /etc/systemd/system/albyhub.service > /dev/null << EOF
|
||||
[Unit]
|
||||
Description=Alby Hub
|
||||
After=network-online.target
|
||||
|
|
|
|||
|
|
@ -5,13 +5,14 @@ Run your Alby Hub with phoenixd as a backend.
|
|||
## Requirements
|
||||
|
||||
- Linux distribution
|
||||
- Runs pretty much on any VPS or server
|
||||
- Runs pretty much on any VPS or server (512MB+ memory recommended)
|
||||
|
||||
## Docker
|
||||
|
||||
To run Alby Hub with phoenixd use [docker-compose](https://docs.docker.com/compose/) using the [docker-compose.yml file](https://raw.githubusercontent.com/getAlby/hub/master/scripts/linux-x86_64/phoenixd/docker-compose.yml).
|
||||
|
||||
$ wget https://raw.githubusercontent.com/getAlby/hub/master/scripts/linux-x86_64/phoenixd/docker-compose.yml
|
||||
$ wget https://raw.githubusercontent.com/getAlby/hub/master/scripts/linux-x86_64/phoenixd/docker-compose.yml # <- edit for your needs, but defaults should work well
|
||||
$ mkdir -p ./albyhub-phoenixd/phoenixd && mkdir -p ./albyhub-phoenixd/albyhub # <- create the data directories for phoenixd and albyhub. make sure to have backups of this
|
||||
$ docker-compose up # or docker-compose up --pull=always <- to make sure you get the latest images
|
||||
|
||||
It will run on localhost:8080 by default. You can configure the port by editing the docker-compose.yml file.
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ rm server-linux-x86_64.tar.bz2
|
|||
rm phoenix-$PHOENIX_VERSION-linux-x64.zip
|
||||
|
||||
### Create start scripts
|
||||
tee -a $INSTALL_DIR/phoenixd/start.sh > /dev/null << EOF
|
||||
tee $INSTALL_DIR/phoenixd/start.sh > /dev/null << EOF
|
||||
#!/bin/bash
|
||||
|
||||
echo "Starting phoenixd"
|
||||
|
|
@ -45,7 +45,7 @@ echo "Make sure to backup your phoenixd data in $INSTALL_DIR/phoenixd/data"
|
|||
PHOENIX_DATADIR="$INSTALL_DIR/phoenixd/data" $INSTALL_DIR/phoenixd/phoenixd --agree-to-terms-of-service --http-bind-ip=0.0.0.0
|
||||
EOF
|
||||
|
||||
tee -a $INSTALL_DIR/albyhub/start.sh > /dev/null << EOF
|
||||
tee $INSTALL_DIR/albyhub/start.sh > /dev/null << EOF
|
||||
#!/bin/bash
|
||||
|
||||
echo "Starting Alby Hub"
|
||||
|
|
@ -54,7 +54,7 @@ PHOENIXD_AUTHORIZATION=\$(awk -F'=' '/^http-password/{print \$2}' "\$phoenix_con
|
|||
WORK_DIR="$INSTALL_DIR/albyhub/data" LN_BACKEND_TYPE=PHOENIX PHOENIXD_ADDRESS="http://localhost:9740" PHOENIXD_AUTHORIZATION=\$PHOENIXD_AUTHORIZATION LOG_EVENTS=true LDK_GOSSIP_SOURCE="" $INSTALL_DIR/albyhub/bin/albyhub
|
||||
EOF
|
||||
|
||||
tee -a $INSTALL_DIR/start.sh > /dev/null << EOF
|
||||
tee $INSTALL_DIR/start.sh > /dev/null << EOF
|
||||
#!/bin/bash
|
||||
|
||||
$INSTALL_DIR/phoenixd/start.sh &
|
||||
|
|
@ -82,7 +82,7 @@ then
|
|||
exit
|
||||
fi
|
||||
|
||||
sudo tee -a /etc/systemd/system/albyhub.service > /dev/null << EOF
|
||||
sudo tee /etc/systemd/system/albyhub.service > /dev/null << EOF
|
||||
[Unit]
|
||||
Description=Alby Hub
|
||||
After=network-online.target
|
||||
|
|
@ -99,7 +99,7 @@ ExecStart=$INSTALL_DIR/albyhub/start.sh
|
|||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
sudo tee -a /etc/systemd/system/phoenixd.service > /dev/null << EOF
|
||||
sudo tee /etc/systemd/system/phoenixd.service > /dev/null << EOF
|
||||
[Unit]
|
||||
Description=Phoenixd
|
||||
After=network-online.target
|
||||
|
|
|
|||
20
scripts/pi-aarch64/README.md
Normal file
20
scripts/pi-aarch64/README.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
### Installation on a Raspberry Pi 4/5 (aarch64)
|
||||
|
||||
This install scripts will help you installing Alby Hub on a Raspberry Pi with Raspberry Pi OS (previously called Raspbian).
|
||||
You should have some basic Linux understanding to install and operate it.
|
||||
|
||||
Have a look at our [installation guide](https://guides.getalby.com/user-guide/v/alby-account-and-browser-extension/alby-hub/alby-hub-flavors/raspberry-pi-zero) for more details and inspiration.
|
||||
|
||||
SSH into your Pi and run:
|
||||
```shell
|
||||
/bin/bash -c "$(curl -fsSL https://getalby.com/install/hub/pi-aarch64-install.sh)"
|
||||
```
|
||||
|
||||
### Updating a running instance
|
||||
|
||||
SSH into your Pi and run:
|
||||
```shell
|
||||
/bin/bash -c "$(curl -fsSL https://getalby.com/install/hub/pi-aarch64-update.sh)"
|
||||
```
|
||||
|
||||
And see install.sh and update.sh for details.
|
||||
67
scripts/pi-aarch64/install.sh
Normal file
67
scripts/pi-aarch64/install.sh
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
echo ""
|
||||
echo ""
|
||||
echo "⚡️ Welcome to Alby Hub"
|
||||
echo "-----------------------------------------"
|
||||
echo "Installing..."
|
||||
|
||||
|
||||
sudo mkdir -p /opt/albyhub
|
||||
sudo chown -R $USER:$USER /opt/albyhub
|
||||
cd /opt/albyhub
|
||||
wget https://getalby.com/install/hub/server-linux-aarch64.tar.bz2
|
||||
|
||||
# Extract archives
|
||||
tar -xvf server-linux-aarch64.tar.bz2
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to unpack Alby Hub. Potentially bzip2 is missing"
|
||||
echo "Install it with sudo apt-get install bzip2"
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
rm server-linux-aarch64.tar.bz2
|
||||
|
||||
# allow albyhub to bind on port 80
|
||||
sudo setcap CAP_NET_BIND_SERVICE=+eip /opt/albyhub/bin/albyhub
|
||||
|
||||
# Use port 80 if available otherwise 8029
|
||||
if sudo lsof -Pi :80 -sTCP:LISTEN -t >/dev/null ; then
|
||||
PORT=8029
|
||||
URL="http://$HOSTNAME.local:8029"
|
||||
else
|
||||
PORT=80
|
||||
URL="http://$HOSTNAME.local"
|
||||
fi
|
||||
|
||||
### Create systemd service
|
||||
sudo tee -a /etc/systemd/system/albyhub.service > /dev/null << EOF
|
||||
[Unit]
|
||||
Description=Alby Hub
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=1
|
||||
User=$USER
|
||||
ExecStart=/opt/albyhub/bin/albyhub
|
||||
# Hack to ensure Alby Hub never uses more than 90% CPU
|
||||
CPUQuota=90%
|
||||
|
||||
Environment="PORT=$PORT"
|
||||
Environment="WORK_DIR=/opt/albyhub/data"
|
||||
Environment="LDK_ESPLORA_SERVER=https://electrs.getalbypro.com"
|
||||
Environment="LOG_EVENTS=true"
|
||||
Environment="LDK_GOSSIP_SOURCE="
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
sudo systemctl enable albyhub
|
||||
sudo systemctl start albyhub
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
echo "✅ Installation finished! Please visit $URL to configure your new Alby Hub."
|
||||
echo ""
|
||||
24
scripts/pi-aarch64/update.sh
Normal file
24
scripts/pi-aarch64/update.sh
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "🔃 Updating Alby Hub..."
|
||||
sudo systemctl stop albyhub
|
||||
|
||||
# Download new artifacts
|
||||
cd /opt/albyhub
|
||||
rm -rf albyhub-backup
|
||||
mkdir albyhub-backup
|
||||
mv bin albyhub-backup
|
||||
mv lib albyhub-backup
|
||||
cp -r data albyhub-backup
|
||||
|
||||
wget https://getalby.com/install/hub/server-linux-aarch64.tar.bz2
|
||||
|
||||
# Extract archives
|
||||
tar -xvf server-linux-aarch64.tar.bz2
|
||||
|
||||
# Cleanup
|
||||
rm server-linux-aarch64.tar.bz2
|
||||
|
||||
sudo systemctl start albyhub
|
||||
|
||||
echo "✅ Update finished! Please login again to start your wallet."
|
||||
|
|
@ -1,23 +1,18 @@
|
|||
### Installation on a Raspberry Pi Zero
|
||||
### Installation on a Raspberry Pi Zero (arm)
|
||||
|
||||
Have a look at our [installation guide](https://guides.getalby.com/user-guide/v/alby-account-and-browser-extension/alby-hub/alby-hub-flavors/raspberry-pi-zero) for more details.
|
||||
This install scripts will help you installing Alby Hub on a Raspberry Pi with Raspberry Pi OS (previously called Raspbian).
|
||||
You should have some basic Linux understanding to install and operate it.
|
||||
|
||||
```shell
|
||||
$ ssh albyhub@albyhub.local '/bin/bash -c "$(curl -fsSL https://getalby.com/install/hub/pi-zero-install.sh)"'
|
||||
```
|
||||
Have a look at our [installation guide](https://guides.getalby.com/user-guide/v/alby-account-and-browser-extension/alby-hub/alby-hub-flavors/raspberry-pi-zero) for more details and inspiration.
|
||||
|
||||
or on the Pi directly:
|
||||
SSH into your Pi and run:
|
||||
```shell
|
||||
/bin/bash -c "$(curl -fsSL https://getalby.com/install/hub/pi-zero-install.sh)"
|
||||
```
|
||||
|
||||
### Updating a running instance
|
||||
|
||||
```shell
|
||||
$ ssh albyhub@albyhub.local '/bin/bash -c "$(curl -fsSL https://getalby.com/install/hub/pi-zero-install.sh)"'
|
||||
```
|
||||
|
||||
or on the Pi directly:
|
||||
SSH into your Pi and run:
|
||||
```shell
|
||||
/bin/bash -c "$(curl -fsSL https://getalby.com/install/hub/pi-zero-update.sh)"
|
||||
```
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ wget https://getalby.com/install/hub/server-linux-armv6.tar.bz2
|
|||
|
||||
# Extract archives
|
||||
tar -xvf server-linux-armv6.tar.bz2
|
||||
if [[ $? -eq 0 ]]; then
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to unpack Alby Hub. Potentially bzip2 is missing"
|
||||
echo "Install it with sudo apt-get install bzip2"
|
||||
fi
|
||||
|
|
@ -20,8 +20,20 @@ fi
|
|||
# Cleanup
|
||||
rm server-linux-armv6.tar.bz2
|
||||
|
||||
# allow albyhub to bind on port 80
|
||||
sudo setcap CAP_NET_BIND_SERVICE=+eip /opt/albyhub/bin/albyhub
|
||||
|
||||
# Use port 80 if available otherwise 8029
|
||||
if sudo lsof -Pi :80 -sTCP:LISTEN -t >/dev/null ; then
|
||||
PORT=8029
|
||||
URL="http://$HOSTNAME.local:8029"
|
||||
else
|
||||
PORT=80
|
||||
URL="http://$HOSTNAME.local"
|
||||
fi
|
||||
|
||||
### Create systemd service
|
||||
sudo tee -a /etc/systemd/system/albyhub.service > /dev/null << EOF
|
||||
sudo tee /etc/systemd/system/albyhub.service > /dev/null << EOF
|
||||
[Unit]
|
||||
Description=Alby Hub
|
||||
After=network-online.target
|
||||
|
|
@ -36,7 +48,7 @@ ExecStart=/opt/albyhub/bin/albyhub
|
|||
# Hack to ensure Alby Hub never uses more than 90% CPU
|
||||
CPUQuota=90%
|
||||
|
||||
Environment="PORT=80"
|
||||
Environment="PORT=$PORT"
|
||||
Environment="WORK_DIR=/opt/albyhub/data"
|
||||
Environment="LDK_ESPLORA_SERVER=https://electrs.getalbypro.com"
|
||||
Environment="LOG_EVENTS=true"
|
||||
|
|
@ -51,5 +63,5 @@ sudo systemctl start albyhub
|
|||
|
||||
echo ""
|
||||
echo ""
|
||||
echo "✅ Installation finished! Please visit http://$HOSTNAME.local to configure your new Alby Hub."
|
||||
echo "✅ Installation finished! Please visit $URL to configure your new Alby Hub."
|
||||
echo ""
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ cd /opt/albyhub
|
|||
rm -rf albyhub-backup
|
||||
mkdir albyhub-backup
|
||||
mv bin albyhub-backup
|
||||
mv lib albyhub-backup
|
||||
cp -r data albyhub-backup
|
||||
|
||||
wget https://getalby.com/install/hub/server-linux-armv6.tar.bz2
|
||||
|
||||
# Extract archives
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue