-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add linux-aarch64 scripts (#1032)
- Loading branch information
Showing
4 changed files
with
254 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Example Caddyfile to run Alby Hub behind a Caddy reverse proxy | ||
# Caddy has embedded letsencrypt support and creates HTTPS certificates | ||
# learn more: https://caddyserver.com/docs/getting-started | ||
|
||
# Refer to the Caddy docs for more information: | ||
# https://caddyserver.com/docs/caddyfile | ||
|
||
|
||
:80 { | ||
# optional additional basic authentication | ||
# the password is hashed, see Caddy documentation: https://caddyserver.com/docs/caddyfile/directives/basic_auth | ||
#basicauth { | ||
# Username "Bob", password "hiccup" | ||
# Bob $2a$14$Zkx19XLiW6VYouLHR5NmfOFU0z2GTNmpkT/5qqR7hx4IjWJPDhjvG | ||
#} | ||
|
||
# Alby Hub runs on 8029 by default | ||
reverse_proxy :8029 | ||
} |
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Alby Hub on a Linux server | ||
|
||
## Requirements | ||
|
||
- Linux distribution | ||
- 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) | ||
|
||
We have prepared an installation script that installs Alby Hub for you. | ||
We recommend inspecting the install script and if needed adjusting it or taking inspiration from it for your setup. | ||
|
||
If you do a fresh server setup make sure to do the basic setup like for example creating a new user and configuring the firewall. Here is a [simple tutorial for this](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu). | ||
|
||
Run the installation script on your server: | ||
|
||
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/getAlby/hub/master/scripts/linux-aarch64/install.sh)" | ||
|
||
The install script will prompt you for an installation folder and will install Alby Hub. | ||
Optionally it can also create a systemd service for you. | ||
|
||
You can also do these quite simple steps manually, have a look in the install script for details. | ||
|
||
Alby Hub will run on localhost:8080 (standalone) or localhost:8029 (when run with a systemd service) configurable using the `PORT` environment variable or by editing `Environment="PORT=8029"` in the albyhub.service systemd config file - See "Editing The Service" below) | ||
|
||
To run on a public domain we recommend the use of a reverse proxy using [Caddy](https://caddyserver.com/) | ||
|
||
### Running the services | ||
|
||
Either use systemd: | ||
|
||
$ sudo systemctl [start|stop] albyhub.service | ||
|
||
Or use the start scripts: | ||
|
||
$ [your install path]/start.sh | ||
|
||
### Viewing Logs (systemd) | ||
|
||
$ sudo journalctl -u albyhub | ||
|
||
### Editing The Service (systemd) | ||
|
||
$ sudo nano /etc/systemd/system/albyhub.service | ||
$ sudo systemctl daemon-reload | ||
$ sudo systemctl restart albyhub.service | ||
|
||
### Backup ! | ||
|
||
Make sure to backup your data directories: | ||
|
||
- `[your install path]/data` | ||
|
||
### Update | ||
|
||
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 # <- make sure to update platform | ||
$ 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. |
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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/bin/bash | ||
|
||
ALBYHUB_URL="https://getalby.com/install/hub/server-linux-aarch64.tar.bz2" | ||
echo "" | ||
echo "" | ||
echo "⚡️ Welcome to Alby Hub" | ||
echo "-----------------------------------------" | ||
echo "Installing Alby Hub" | ||
echo "" | ||
read -p "Absolute install directory path (default: $HOME/albyhub): " USER_INSTALL_DIR | ||
|
||
INSTALL_DIR="${USER_INSTALL_DIR:-$HOME/albyhub}" | ||
|
||
# create installation directory | ||
mkdir -p $INSTALL_DIR | ||
cd $INSTALL_DIR | ||
|
||
# download and extract the Alby Hub executable | ||
wget $ALBYHUB_URL | ||
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" | ||
exit | ||
fi | ||
|
||
rm server-linux-aarch64.tar.bz2 | ||
|
||
# prepare the data directory. this is pesistent and will hold all important data | ||
mkdir -p $INSTALL_DIR/data | ||
|
||
# create a simple start script that sets the default configuration variables | ||
tee $INSTALL_DIR/start.sh > /dev/null << EOF | ||
#!/bin/bash | ||
echo "Starting Alby Hub" | ||
WORK_DIR="$INSTALL_DIR/data" LOG_EVENTS=true LDK_GOSSIP_SOURCE="" $INSTALL_DIR/bin/albyhub | ||
EOF | ||
chmod +x $INSTALL_DIR/start.sh | ||
|
||
# add an update script to keep the Hub up to date | ||
# run this to update the hub | ||
wget https://raw.githubusercontent.com/getAlby/hub/master/scripts/linux-aarch64/update.sh | ||
chmod +x $INSTALL_DIR/update.sh | ||
|
||
echo "" | ||
echo "" | ||
echo "✅ Installation done." | ||
echo "" | ||
|
||
# optionally create a systemd service to start alby hub | ||
read -p "Do you want to setup a systemd service (requires sudo permission)? (y/n): " -n 1 -r | ||
if [[ ! $REPLY =~ ^[Yy]$ ]] | ||
then | ||
echo "" | ||
echo "" | ||
echo "Run $INSTALL_DIR/start.sh to start Alby Hub" | ||
echo "✅ DONE" | ||
exit | ||
fi | ||
|
||
sudo tee /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=$INSTALL_DIR/start.sh | ||
Environment="PORT=8029" | ||
[Install] | ||
WantedBy=multi-user.target | ||
EOF | ||
|
||
echo "" | ||
echo "" | ||
|
||
sudo systemctl enable albyhub | ||
sudo systemctl start albyhub | ||
|
||
echo "Run 'sudo systemctl start/stop albyhub' to start/stop AlbyHub" | ||
echo "" | ||
echo "" | ||
echo " ✅ DONE. Open Alby Hub to get started" | ||
echo "Alby Hub runs by default on localhost:8029" |
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash | ||
|
||
ALBYHUB_URL="https://getalby.com/install/hub/server-linux-aarch64.tar.bz2" | ||
echo "" | ||
echo "" | ||
echo "⚡️ Updating Alby Hub" | ||
echo "-----------------------------------------" | ||
echo "This will download the latest version of Alby Hub." | ||
echo "You will have to unlock Alby Hub after the update." | ||
echo "" | ||
echo "Make sure you have your unlock password available and a backup of your seed." | ||
|
||
read -p "Do you want continue? (y/n):" -n 1 -r | ||
if [[ ! $REPLY =~ ^[Yy]$ ]] | ||
then | ||
exit | ||
fi | ||
echo "" | ||
|
||
sudo systemctl list-units --type=service --all | grep -Fq albyhub.service | ||
if [[ $? -eq 0 ]]; then | ||
echo "Stopping Alby Hub" | ||
sudo systemctl stop albyhub | ||
fi | ||
|
||
if pgrep -x "albyhub" > /dev/null | ||
then | ||
echo "Alby Hub process is still running, stopping it now." | ||
pkill -f albyhub | ||
fi | ||
|
||
SCRIPT_DIR=$(dirname "$(readlink -f "$0")") | ||
read -p "Absolute install directory path (default: $SCRIPT_DIR): " USER_INSTALL_DIR | ||
echo "" | ||
|
||
INSTALL_DIR="${USER_INSTALL_DIR:-$SCRIPT_DIR}" | ||
|
||
if ! test -f $INSTALL_DIR/data/nwc.db; then | ||
echo "Could not find Alby Hub in this directory" | ||
exit 1 | ||
fi | ||
|
||
|
||
echo "Running in $INSTALL_DIR" | ||
# make sure we run this in the install directory | ||
cd $INSTALL_DIR | ||
|
||
echo "Cleaning up old backup" | ||
rm -rf albyhub-backup | ||
mkdir albyhub-backup | ||
|
||
echo "Creating current backup" | ||
mv bin albyhub-backup | ||
mv lib albyhub-backup | ||
cp -r data albyhub-backup | ||
|
||
|
||
echo "Downloading latest version" | ||
wget $ALBYHUB_URL | ||
tar -xvf server-linux-aarch64.tar.bz2 | ||
rm server-linux-aarch64.tar.bz2 | ||
|
||
sudo systemctl list-units --type=service --all | grep -Fq albyhub.service | ||
if [[ $? -eq 0 ]]; then | ||
echo "Starting Alby Hub" | ||
sudo systemctl start albyhub | ||
fi | ||
|
||
echo "" | ||
echo "" | ||
echo "✅ Update finished! Please unlock your wallet." | ||
echo "" |