Skip to content

Instantly share code, notes, and snippets.

@novemberalpha
Last active April 2, 2023 23:14
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save novemberalpha/668cd2d3c6c42dd39acc7eb20246b725 to your computer and use it in GitHub Desktop.
Save novemberalpha/668cd2d3c6c42dd39acc7eb20246b725 to your computer and use it in GitHub Desktop.

NGROK OPENAG

Installing a ngrok tunnel on your openag_brain will allow you to access it from anywhere in the world.

Follow these steps:

  1. Create an account at ngrok.com (it's free)
  2. Download ngrok onto your Raspberry Pi
    • wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm.zip
  3. Unzip the ngrok app in your home folder
    • unzip ngrok-stable-linux-arm.zip
  4. Move the ngrok app to /usr/local/bin
    • sudo mv ngrok /usr/local/bin/
  5. Test ngrok
    • ngrok http 80
  6. Type ctrl-c to stop ngrok
  7. Install your ngrok auth token
  8. Create the ngrok.yml config file
    • nano .ngrok2/ngrok.yml
    • paste in the text from the ngrok.yml file below and press ctrl-x and Y to save
      • make sure to change "username:password" to your desired username and password to access your pi
  9. Create the run_after_boot.sh script
    • nano run_after_boot.sh
    • paste in the text from the run_after_boot.sh file below and press ctrl-x and Y to save
  10. Add startup command in rc.local
    • sudo nano /etc/rc.local
    • Add sh /home/pi/run_after_boot.sh & just before the line that contains exit 0
    • press ctrl-x and Y to save
  11. Restart your Pi
    • sudo reboot
  12. See your new tunnels on ngrok.com
    • https://dashboard.ngrok.com/status
    • Copy your https tunnel url and add /_utils/ to it like this https://XXXXXXXX.ngrok.io/_utils
    • Enter your username and password (sometimes twice) and you are now viewing the Openag CouchDB
    • You can also see openag_ui if you have it installed https://XXXXXXXX.ngrok.io/app/_design/app/_rewrite
    • You can ssh to your pi using this pattern: ssh pi@1.tcp.ngrok.io -p21020 Paste in your url/port.

RTFM

They have some great documentation. Check it out. https://ngrok.com/docs

Bonus round

With a paid account you can lock in a subdomain and even a consistent ssh routes

authtoken: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
json_resolver_url: ""
dns_resolver_ips: []
# add the stuff below this line to your file
tunnels:
ssh:
proto: tcp
addr: 22
openag:
proto: http
bind_tls: true
addr: 5984
auth: "username:password"
openag_ui_cam:
proto: http
bind_tls: true
addr: 80
subdomain: tangerine_cam
##! /bin/sh
ngrok start --all \
--config=/home/pi/.ngrok2/ngrok.yml \
--log=stdout \
> /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment