From e26693a0beb74090c77fb8bfbe7d97a50cc11cc7 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Tue, 6 Aug 2024 13:59:01 +0200 Subject: [PATCH] chore: move pi install scripts in special folder --- nip47/event_handler.go | 8 +++++--- scripts/README.md | 11 ----------- scripts/pi-arm/README.md | 25 +++++++++++++++++++++++++ scripts/{ => pi-arm}/install.sh | 6 +++++- scripts/{ => pi-arm}/update.sh | 0 5 files changed, 35 insertions(+), 15 deletions(-) delete mode 100644 scripts/README.md create mode 100644 scripts/pi-arm/README.md rename scripts/{ => pi-arm}/install.sh (87%) rename scripts/{ => pi-arm}/update.sh (100%) diff --git a/nip47/event_handler.go b/nip47/event_handler.go index c51813c1..aa00c76a 100644 --- a/nip47/event_handler.go +++ b/nip47/event_handler.go @@ -236,15 +236,17 @@ func (svc *nip47Service) HandleEvent(ctx context.Context, relay nostrmodels.Rela err = svc.publishResponseEvent(ctx, relay, &requestEvent, resp, &app) if err != nil { logger.Logger.WithFields(logrus.Fields{ - "requestEventNostrId": event.ID, - "eventKind": event.Kind, - "appId": app.ID, + "requestEventNostrId": event.ID, + "responseEventNostrId": resp.ID, + "eventKind": event.Kind, + "appId": app.ID, }).WithError(err).Error("Failed to publish event") requestEvent.State = db.REQUEST_EVENT_STATE_HANDLER_ERROR } else { requestEvent.State = db.REQUEST_EVENT_STATE_HANDLER_EXECUTED logger.Logger.WithFields(logrus.Fields{ "requestEventNostrId": event.ID, + "responseEventNostrId": resp.ID, "eventKind": event.Kind, "appId": app.ID, }).Info("Published response") diff --git a/scripts/README.md b/scripts/README.md deleted file mode 100644 index 222ddffd..00000000 --- a/scripts/README.md +++ /dev/null @@ -1,11 +0,0 @@ -### Installation on a Raspberry Pi Zero - -```shell -/bin/bash -c "$(curl -fsSL https://getalby.com/install/hub/pi-zero-install.sh)" -``` - -### Updating a running instance - -```shell -/bin/bash -c "$(curl -fsSL https://getalby.com/install/hub/pi-zero-update.sh)" -``` diff --git a/scripts/pi-arm/README.md b/scripts/pi-arm/README.md new file mode 100644 index 00000000..df96d651 --- /dev/null +++ b/scripts/pi-arm/README.md @@ -0,0 +1,25 @@ +### Installation on a Raspberry Pi Zero + +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. + +```shell + $ ssh albyhub@albyhub.local '/bin/bash -c "$(curl -fsSL https://getalby.com/install/hub/pi-zero-install.sh)"' + ``` + +or on the Pi directly: +```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: +```shell +/bin/bash -c "$(curl -fsSL https://getalby.com/install/hub/pi-zero-update.sh)" +``` + +And see install.sh and update.sh for details. diff --git a/scripts/install.sh b/scripts/pi-arm/install.sh similarity index 87% rename from scripts/install.sh rename to scripts/pi-arm/install.sh index 675026c2..490369d5 100644 --- a/scripts/install.sh +++ b/scripts/pi-arm/install.sh @@ -12,6 +12,10 @@ wget https://getalby.com/install/hub/server-linux-armv6.tar.bz2 # Extract archives tar -xvf server-linux-armv6.tar.bz2 +if [[ $? -eq 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-armv6.tar.bz2 @@ -27,7 +31,7 @@ Wants=network-online.target Type=simple Restart=always RestartSec=1 -User=root +User=$USER ExecStart=/opt/albyhub/bin/albyhub # Hack to ensure Alby Hub never uses more than 90% CPU CPUQuota=90% diff --git a/scripts/update.sh b/scripts/pi-arm/update.sh similarity index 100% rename from scripts/update.sh rename to scripts/pi-arm/update.sh