DEV Community 👩‍💻👨‍💻

Cover image for Using Packetriot to Access OctoPrint Remotely
Kyle Schwartz
Kyle Schwartz

Posted on

Using Packetriot to Access OctoPrint Remotely

Introduction

Welcome! This is a pretty straight-forward tutorial on setting up Packetriot. Although intended for OctoPrint, this is pretty software-agnostic, and thus, can be followed for pretty much any local service. I will be doing this on an Orange Pi PC+ running Armbian (Debian) Buster. This should work for any Debian-like OS such as PopOS and Ubuntu.

For this tutorial, you'll need:

  • A Domain
  • Basic Linux knowledge
  • A Packetriot Account (Get one here)

If you're not running a Debian-like OS, additional download instructions are available here.

If at any point you get stuck, check out Packetriot's incredibly extensive documentation here.

Now, let's get into it!

Install Packetriot

Install the GPG key and make sure apt can work with GPG signed packages and HTTPS sources.

sudo apt-get install apt-transport-https gnupg -y

wget -qO - https://download.packetriot.com/linux/debian/pubkey.gpg | sudo apt-key add -
Enter fullscreen mode Exit fullscreen mode

Setup the Packetriot source in the apt sources directory.

echo "
deb [arch=amd64] https://download.packetriot.com/linux/debian/buster/stable/non-free/binary-amd64 / 
deb [arch=i386]  https://download.packetriot.com/linux/debian/buster/stable/non-free/binary-i386  / 
deb [arch=armhf] https://download.packetriot.com/linux/debian/buster/stable/non-free/binary-armhf / 
deb [arch=arm64] https://download.packetriot.com/linux/debian/buster/stable/non-free/binary-arm64 / 
" | sudo tee /etc/apt/sources.list.d/packetriot.list
Enter fullscreen mode Exit fullscreen mode

Update the apt sources and install the client.

sudo apt-get update

sudo apt-get install pktriot
Enter fullscreen mode Exit fullscreen mode

Add a Domain

In order to have a static domain, you'll either need to have a paid plan or provide your own domain. In this tutorial, we'll opt for the latter.

On the Packetriot site:

  1. Go to Domains -> Custom
  2. Click Verify Domain.
  3. Enter your domain name.
  4. Click Submit.

Now, Packetriot will show you a long string of text that you need to copy. In your DNS config in your domain registrar, you will have to create a new TXT record. Paste in the TXT Record from Packetriot and wait a few minutes. Once the domain is verified, continue to the next step.

Enable Packetriot

Now that our domain is setup, we will actually create the tunnel. First, we enable the Packetriot service so it'll start on the server's startup. Then we will login and create the tunnel. When you run configure, make sure you choose option 1.

sudo systemctl enable pktriot
sudo -u pktriot pktriot configure
Enter fullscreen mode Exit fullscreen mode

After the configuration has been run, you'll be provided with an IPv4. Take this and create a new A record in your domain registrar's DNS, same as before with the TXT record. This must be the same domain as registered earlier.

Next, we will run the following command to tell the tunnel where to connect. The first part is not a typo; it is telling the server to run the command as the pktriot user, and then running the pktriot command. Change example.com and 80 to the relevant fields. I.e. your domain and port, respectively. For OctoPrint, this will be 5000 if no reverse proxy has been setup. Additionally, change 127.0.0.1 to the appropriate IP if not being run on the same server as the server you are tunneling.

sudo -u pktriot pktriot tunnel http add --domain example.com --destination 127.0.0.1 --http 80 --letsencrypt
Enter fullscreen mode Exit fullscreen mode

And finally, start the Packetriot service. This may take a few minutes to get the SSL certificates. Once it is done, you can go to your URL and access your server from anywhere!

sudo systemctl start pktriot
Enter fullscreen mode Exit fullscreen mode

Thank you so much for following allong with this tutorial! If you liked it, had any problems, or found any errors, let me know in the comments down below!

Have a great day!

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.