From 91b4cbce355557915315ef1bf527871af6440c3e Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Sat, 13 Feb 2021 15:33:12 -0600 Subject: [PATCH] Add Sphinx Relay v1.3.8 (beta) --- .../etc/systemd/system/sphinxrelay.service | 5 +++-- rootfs/standard/usr/bin/mynode_lndconnect.sh | 2 +- rootfs/standard/usr/bin/mynode_post_upgrade.sh | 2 +- rootfs/standard/usr/bin/mynode_pre_sphinxrelay.sh | 13 +++++++++++++ .../standard/usr/share/mynode/sphinxrelay_app.json | 2 +- rootfs/standard/var/www/mynode/settings.py | 2 ++ .../var/www/mynode/templates/includes/apps.html | 2 -- .../var/www/mynode/templates/sphinxrelay.html | 14 ++++---------- setup/setup_device.sh | 1 + 9 files changed, 26 insertions(+), 17 deletions(-) create mode 100755 rootfs/standard/usr/bin/mynode_pre_sphinxrelay.sh diff --git a/rootfs/standard/etc/systemd/system/sphinxrelay.service b/rootfs/standard/etc/systemd/system/sphinxrelay.service index 9d9402a3..a6ea2fc0 100644 --- a/rootfs/standard/etc/systemd/system/sphinxrelay.service +++ b/rootfs/standard/etc/systemd/system/sphinxrelay.service @@ -9,6 +9,7 @@ After=lnd.service [Service] ExecStartPre=/usr/bin/is_not_shutting_down.sh ExecStartPre=/usr/bin/wait_on_lnd.sh +ExecStartPre=/usr/bin/mynode_pre_sphinxrelay.sh WorkingDirectory=/opt/mynode/sphinxrelay ExecStart=npm run prod @@ -16,9 +17,9 @@ User=bitcoin Group=bitcoin Type=simple KillMode=control-group -TimeoutSec=240 +TimeoutSec=60 Restart=always -RestartSec=60 +RestartSec=30 StandardOutput=syslog StandardError=syslog SyslogIdentifier=sphinxrelay diff --git a/rootfs/standard/usr/bin/mynode_lndconnect.sh b/rootfs/standard/usr/bin/mynode_lndconnect.sh index a12f7038..55df5078 100755 --- a/rootfs/standard/usr/bin/mynode_lndconnect.sh +++ b/rootfs/standard/usr/bin/mynode_lndconnect.sh @@ -29,7 +29,7 @@ while true; do # Find URLs LND_TOR_ADDR=$(cat /var/lib/tor/mynode_lnd/hostname) - LOCAL_IP_ADDR=$(hostname -I | head -n 1) + LOCAL_IP_ADDR=$(hostname -I | head -n 1 | cut -d' ' -f1) # Generate QR Codes lndconnect --lnddir=/mnt/hdd/mynode/lnd -o --bitcoin.mainnet --host=$LOCAL_IP_ADDR diff --git a/rootfs/standard/usr/bin/mynode_post_upgrade.sh b/rootfs/standard/usr/bin/mynode_post_upgrade.sh index 1b1ac32e..4f1a40f7 100755 --- a/rootfs/standard/usr/bin/mynode_post_upgrade.sh +++ b/rootfs/standard/usr/bin/mynode_post_upgrade.sh @@ -95,7 +95,7 @@ $TORIFY apt-get -y -qq install apt-transport-https ca-certificates $TORIFY apt-get -y install libgmp-dev automake libtool libltdl-dev libltdl7 $TORIFY apt-get -y install xorg chromium openbox lightdm openjdk-11-jre libevent-dev ncurses-dev $TORIFY apt-get -y install libudev-dev libusb-1.0-0-dev python3-venv gunicorn sqlite3 libsqlite3-dev -$TORIFY apt-get -y install torsocks python3-requests libsystemd-dev +$TORIFY apt-get -y install torsocks python3-requests libsystemd-dev libjpeg-dev zlib1g-dev # Make sure some software is removed apt-get -y purge ntp # (conflicts with systemd-timedatectl) diff --git a/rootfs/standard/usr/bin/mynode_pre_sphinxrelay.sh b/rootfs/standard/usr/bin/mynode_pre_sphinxrelay.sh new file mode 100755 index 00000000..bd6ea0d6 --- /dev/null +++ b/rootfs/standard/usr/bin/mynode_pre_sphinxrelay.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -x +set -e + +LOCAL_IP_ADDR=$(hostname -I | head -n 1 | cut -d' ' -f1) + +# Update IP address in config file (local IP) +if [ -f /mnt/hdd/mynode/sphinxrelay/app.json ]; then + sed -i "s/public_url\": \".*/public_url\": \"${LOCAL_IP_ADDR}:53001\",/g" /mnt/hdd/mynode/sphinxrelay/app.json +fi + +exit 0 \ No newline at end of file diff --git a/rootfs/standard/usr/share/mynode/sphinxrelay_app.json b/rootfs/standard/usr/share/mynode/sphinxrelay_app.json index c4ef70ea..fdaf6a54 100644 --- a/rootfs/standard/usr/share/mynode/sphinxrelay_app.json +++ b/rootfs/standard/usr/share/mynode/sphinxrelay_app.json @@ -39,7 +39,7 @@ "hub_check_invite_url": "https://hub.sphinx.chat/check_invite", "media_host": "memes.sphinx.chat", "tribes_host": "tribes.sphinx.chat", - "public_url": "", + "public_url": "REPLACE_WITH_IP:53001", "connection_string_path": "connection_string.txt", "ssl": { "enabled": false, diff --git a/rootfs/standard/var/www/mynode/settings.py b/rootfs/standard/var/www/mynode/settings.py index 454e424b..0d7cc36a 100644 --- a/rootfs/standard/var/www/mynode/settings.py +++ b/rootfs/standard/var/www/mynode/settings.py @@ -175,6 +175,8 @@ def page_status(): rtl_status_log = get_journalctl_log("rtl") lnbits_status_log = get_journalctl_log("lnbits") thunderhub_status_log = get_journalctl_log("thunderhub") + ckbunker_status_log = get_journalctl_log("ckbunker") + sphinxrelay_status_log = get_journalctl_log("sphinxrelay") docker_status_log = get_journalctl_log("docker") docker_image_build_status_log = get_journalctl_log("docker_images") diff --git a/rootfs/standard/var/www/mynode/templates/includes/apps.html b/rootfs/standard/var/www/mynode/templates/includes/apps.html index 0ed31043..ac5b460c 100644 --- a/rootfs/standard/var/www/mynode/templates/includes/apps.html +++ b/rootfs/standard/var/www/mynode/templates/includes/apps.html @@ -243,7 +243,6 @@ {% endif %} - diff --git a/rootfs/standard/var/www/mynode/templates/sphinxrelay.html b/rootfs/standard/var/www/mynode/templates/sphinxrelay.html index a5ba68dd..5b815741 100644 --- a/rootfs/standard/var/www/mynode/templates/sphinxrelay.html +++ b/rootfs/standard/var/www/mynode/templates/sphinxrelay.html @@ -28,16 +28,10 @@
Instructions to setup Sphinx Relay
    -
  1. Ensure that Sphinx Relay is enabled and you see "Running" on the status tile.
  2. -
  3. Download and install Sphinx from sphinx.chat.
  4. -
  5. ...
  6. -
  7. ...
  8. -
  9. ...
  10. -
  11. ...
  12. -
  13. ...
  14. -
  15. ...
  16. -
  17. ...
  18. -
  19. ...
  20. +
  21. Ensure that Sphinx Relay is enabled and you see "Running" on the status tile
  22. +
  23. Download and install Sphinx from sphinx.chat
  24. +
  25. Paste the Connection String into the Sphinx application
  26. +
  27. Sphinx should now be connected to your own node!
  28. Enjoy!
diff --git a/setup/setup_device.sh b/setup/setup_device.sh index 0e0018f2..b535aa3b 100755 --- a/setup/setup_device.sh +++ b/setup/setup_device.sh @@ -161,6 +161,7 @@ apt -y -qq install apt-transport-https ca-certificates apt-get -y install xorg chromium openbox lightdm openjdk-11-jre libevent-dev ncurses-dev apt-get -y install zlib1g-dev libudev-dev libusb-1.0-0-dev python3-venv gunicorn apt-get -y install sqlite3 libsqlite3-dev torsocks python3-requests libsystemd-dev +apt-get -y install libjpeg-dev zlib1g-dev # Make sure some software is removed