Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1
    Senior Member philchillbill's Avatar
    Join Date
    Jan 2019
    Location
    The Netherlands
    Posts
    705

    [Announce] Easy ngrok-setup for MediaServer & LMS-lite Alexa skills

    Name:  1.png
Views: 491
Size:  40.6 KB

    There's a new completely-automated setup procedure for deploying ngrok for use with the MediaServer and LMS-lite skills.

    It automatically downloads/configures ngrok and also sets it up to autostart at boot on the target system. Your account-linking UUID is automagically deployed to update the skill(s) when tunnel details change (i.e. upon ngrok restart or system reboot). There's no more manually creating systemd services or tweaking Python/Perl updaters because the installer handles everything

    To make it as easy to use as possible, the user visits a web form (see above) and enters details which are then pre-populated into a downloaded installer script.
    Your choice of platform/OS in the form not only determines what version of the ngrok binary to download for you, it also results in a script that matches the native capabilities of the target platform/OS so there are no dependencies to install.

    The process is currently available for:

    * pCP: with a sh script as installer that builds a tcz package and adds an entry to /opt/bootlocal.sh for autostart.
    * Debian-Linuxes: with a bash script as installer for distros like Raspberry Pi OS, Max2Play, Ubuntu - it uses systemd to daemonize ngrok.
    * Windows10: with a PowerShell script as installer that runs ngrok as a hidden background process at boot.

    The old Python/Perl script for updating tunnel details to the skills has been superseded by a native sh/bash/pwsh script that the installer creates on your system.

    The process is fully documented in the new instructions at https://smartskills.tech/lmslitesetup (one installer handles both skills).

    When filled out, the form might look as follows:

    Name:  2.png
Views: 481
Size:  40.1 KB

    For noobs evaluating the skills, the recommended platform is probably now Windows 10. There's no need to use ssh to transfer the installer to a headless machine - it's just right-click and run. Remember, ngrok on a PC will happily proxy for a NAS or pi elsewhere in your LAN.

    Many thanks to @chill for the pioneering work on the pCP platform script !
    Last edited by philchillbill; 2021-04-06 at 10:38.

  2. #2
    Senior Member
    Join Date
    Aug 2006
    Posts
    243
    This setup is a great improvement over the original one. Just one thing, could you please provide a link to the previous instructions to jog the memories of us who already have ngrok installed so that we can clean up the previous files and changes to files before doing the new setup, if and when required. Thanks...

  3. #3
    Senior Member philchillbill's Avatar
    Join Date
    Jan 2019
    Location
    The Netherlands
    Posts
    705
    Quote Originally Posted by raglencross View Post
    This setup is a great improvement over the original one. Just one thing, could you please provide a link to the previous instructions to jog the memories of us who already have ngrok installed so that we can clean up the previous files and changes to files before doing the new setup, if and when required. Thanks...
    Good idea. I've linked them in a footnote on the first tab in the latest instructions.

    That said, if you're already set up then there's no need to change a working installation just for the sake of it. The new procedure does not do anything 'better' than the old way, it's just scripted instead of manual. But for a new install, do it the new way for sure.
    Last edited by philchillbill; 2021-02-23 at 11:00.

  4. #4
    Senior Member
    Join Date
    Dec 2005
    Location
    Brussels, Belgium
    Posts
    362

    Thanks!

    Just installed and it works like a charm. Much easier set up! Thanks very much.
    FYI - I had to do it twice. The 1st time, I didn't start the install from pi/home and when I restarted Max2Play it didn't work anymore.
    Cheers!
    Transporter, Touch, SB3, SB2, Duet, Booms, Radios, piCorePlayer --- iPeng & Material --- LMS 8.0.1 - 1606928904 on Pi4 4GB - Max2Play --- Qobuz

  5. #5
    Senior Member philchillbill's Avatar
    Join Date
    Jan 2019
    Location
    The Netherlands
    Posts
    705
    The requirement to manually run the updater script once AFTER linking the skills has now been relaxed, as your uuid is already in the setup script when you download it.

    This means that setup is now a single-pass process and no restart of e.g. pCP is required (thanks @chill !). On Windows 10, the desktop shortcut is no longer created or necessary.

    All this magic will only work in modern browsers with localStorage enabled and functioning. If you're still on Netscape Navigator, a popup will remind you it's 2021

    The docs have already been updated to reflect the simplification.
    Last edited by philchillbill; 2021-03-22 at 11:17.

  6. #6
    Senior Member philchillbill's Avatar
    Join Date
    Jan 2019
    Location
    The Netherlands
    Posts
    705

    App-to-App automatic account linking implemented

    Amazon is trying to make skill setup and account-linking easier, and a while back they introduced so-called app-to-app account linking. The idea is that you don't have to visit the Alexa app or web-portal to perform account-linking, but instead can do it from the app or website of the skill author. It not only links the skill but will even install it if you haven’t already done so.

    I now have it live for both skills and links are available in the online setup-help pages that will automatically perform account-linking for you. There's no more need to paste your ngrok URL and chosen credentials into the landing page at the Alexa portal. Instead you will log in to your regular Amazon account (if you still have a valid cookie from the last time you logged in then you won't even need to do this) and authorize Amazon to link the skill(s) in question by just clicking on a pop-up.

    It's a complicated flow under the hood with 3 different bouts of oauth2 to-and-fro-ing but it's very secure and worked well in my testing and the user does not see any of it. MediaServer has now been upgraded to use full authorization code grant instead of implicit tokens (LMS-lite already had that).

    If you encounter any problems, please report them here as I will not see anything in the skill logs to indicate failed attempts.

    This is as easy as skill setup will ever get until Amazon releases the promised capability to use an Echo as a native proxy device inside your LAN (announced last Sept as 'coming soon')


    Name:  apptoapp.png
Views: 182
Size:  18.1 KB
    Last edited by philchillbill; 2021-04-17 at 11:19.

  7. #7
    Hi, I've installed this today on pcp v7.0.1 running on wifi, the same pcp is running lms.
    The first time the script runs everything works as expected. Alexa discovers and can control devices, I can use the tunnel link and see my lms from the internet.
    Unfortunately it doesn't survive a reboot. The tunnel link says
    Tunnel {MYTUNNEL}.eu.ngrok.io not found

    This is my /opt/bootlocal.sh
    Code:
    #!/bin/sh
    # put other system startup commands here
    
    echo "Starting SQLITE-control.sh from /opt/bootlocal.sh..." | tee -a /var/log/pcp_b>
    /home/tc/SQLITE-control.sh find M6 &
    GREEN="$(echo -e '\033[1;32m')"
    
    echo
    echo "${GREEN}Running bootlocal.sh..."
    #pCPstart------
    /usr/local/etc/init.d/pcp_startup.sh 2>&1 | tee -a /var/log/pcp_boot.log
    #pCPstop------
    
    ### BH1750 start ------
    # Enabling kernel module i2c-dev
    /sbin/modprobe i2c-dev
    # starting shell script to control display brightness
    /home/tc/lux/display-control.py
    ### BH1750 stop ------
    I expected something about ngrok in here, but I don't know what.

  8. #8
    Senior Member philchillbill's Avatar
    Join Date
    Jan 2019
    Location
    The Netherlands
    Posts
    705
    Quote Originally Posted by Bogg View Post
    Hi, I've installed this today on pcp v7.0.1 running on wifi, the same pcp is running lms.
    The first time the script runs everything works as expected. Alexa discovers and can control devices, I can use the tunnel link and see my lms from the internet.
    Unfortunately it doesn't survive a reboot. The tunnel link says
    Tunnel {MYTUNNEL}.eu.ngrok.io not found

    This is my /opt/bootlocal.sh
    Code:
    #!/bin/sh
    # put other system startup commands here
    
    echo "Starting SQLITE-control.sh from /opt/bootlocal.sh..." | tee -a /var/log/pcp_b>
    /home/tc/SQLITE-control.sh find M6 &
    GREEN="$(echo -e '\033[1;32m')"
    
    echo
    echo "${GREEN}Running bootlocal.sh..."
    #pCPstart------
    /usr/local/etc/init.d/pcp_startup.sh 2>&1 | tee -a /var/log/pcp_boot.log
    #pCPstop------
    
    ### BH1750 start ------
    # Enabling kernel module i2c-dev
    /sbin/modprobe i2c-dev
    # starting shell script to control display brightness
    /home/tc/lux/display-control.py
    ### BH1750 stop ------
    I expected something about ngrok in here, but I don't know what.
    setup.sh should have added a single line to bootlocal.sh - maybe it did but the final pcp bu step failed? Run setup.sh again and watch for any error messages. When it completes, do a pcp bu yourself. Any error?
    If that fails, the correct entry is

    /bin/sh /home/tc/ngrok_startup.sh

    But you should try to understand why the setup process failed. Did you change permissions or ownership in the past?

  9. #9
    Hi, Thanks for your swift reply.

    I think it is a permissions issue. I don't recall changing the permissions for /opt/bootlocal.sh, but I do recall having permissions issues for the display control script, and maybe the sqlite control script too. I started with a standard pcp installation, so I'm unsure why I seem to get permission issues.

    Unfortunately I'm too stupid to work them out myself, so if you could help me with the actual code to copy and paste it would be most helpful.

    Here's the likely problem from the script rerun -

    Code:
    --> Adding autostart entry to /opt/bootlocal.sh
    
    sed: can't create temp file '/opt/bootlocal.shfdHyWV': Permission denied
    sed: can't create temp file '/opt/bootlocal.shnvI1x3': Permission denied
    sed: can't create temp file '/opt/bootlocal.shlgWw98': Permission denied
    --> Creating ngrok.yml in /home/tc/.ngrok2/ for tunnel [SqDisplayLMSTunnel]
    
    --> Backing up changes using pcp bu.

  10. #10
    Senior Member philchillbill's Avatar
    Join Date
    Jan 2019
    Location
    The Netherlands
    Posts
    705
    Quote Originally Posted by Bogg;
    I think it is a permissions issue. I don't recall changing the permissions for /opt/bootlocal.sh, but I do recall having permissions issues for the display control script, and maybe the sqlite control script too. I started with a standard pcp installation, so I'm unsure why I seem to get permission issues.

    Unfortunately I'm too stupid to work them out myself, so if you could help me with the actual code to copy and paste it would be most helpful.

    Here's the likely problem from the script rerun -

    Code:
    --> Adding autostart entry to /opt/bootlocal.sh
    
    sed: can't create temp file '/opt/bootlocal.shfdHyWV': Permission denied
    sed: can't create temp file '/opt/bootlocal.shnvI1x3': Permission denied
    sed: can't create temp file '/opt/bootlocal.shlgWw98': Permission denied
    --> Creating ngrok.yml in /home/tc/.ngrok2/ for tunnel [SqDisplayLMSTunnel]
    
    --> Backing up changes using pcp bu.
    If you do 'cd /opt' and then 'sudo chown tc:staff bootlocal.sh' (both commands without the quotes) then bootlocal.sh will be editable by tc. The script should then run fine.
    Last edited by philchillbill; 2021-04-17 at 11:06.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •