Skip to content

Instantly share code, notes, and snippets.

@andytryn
Last active October 10, 2022 13:45
Show Gist options
  • Save andytryn/da1182c12014ded1caf33e98d705290a to your computer and use it in GitHub Desktop.
Save andytryn/da1182c12014ded1caf33e98d705290a to your computer and use it in GitHub Desktop.
Loophole Run on Background Raspberry Pi – Autostart on boot

Loophole Run on Background Raspberry Pi – Autostart

This explain how to install loophole in your raspberry pi and enable it on boot and access your services anytime anywhere.

Quick Step

Download Loophole (All Release)

wget https://github.com/loophole/cli/releases/download/1.0.0-beta.15/loophole-cli_1.0.0-beta.15_linux_arm64.tar.gz

Unzip Loophole

tar -xvf loophole-cli_1.0.0-beta.15_linux_arm64.tar.gz

Move Folder

mv loophole-cli_1.0.0-beta.15_linux_arm64 loophole

Login through the CLI

/home/ubuntu/loophole/loophole account login

Create a unit file

cat > loophole.service << "EOF"
[Unit]
Description=loophole
After=syslog.target network.target network-online.target

[Service]
ExecStart=loophole http 3000 --hostname {andytryn} --verbose # Change this your hostname aliase subdomain
StandardOutput=inherit
StandardError=inherit
Restart=always
RestartSec=5
User={ubuntu} # Change this your user

[Install]
WantedBy=multi-user.target
EOF

Copy the service file to system directory and bin directory

sudo cp loophole.service /etc/systemd/system/
sudo cp ./loophole/loophole /usr/local/bin

Reload the systemd manager

sudo systemctl daemon-reload

Enable the service to be run on boot

sudo systemctl enable loophole.service

Run Loophole service

sudo systemctl start loophole.service

Running into problems?

sudo systemctl status loophole.service
journalctl -u loophole.service

Tested on

Operating System: Ubuntu 20.04.4 LTS (Preinstalled server image)

Board: Raspberry Pi 3 Model B+

Reference

https://loophole.cloud/docs/guides/expose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment