Last active
February 17, 2022 19:36
-
-
Save rrmerugu/2c6e22941b31f9b5892c8e329c7542c5 to your computer and use it in GitHub Desktop.
ngrok setup as service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```bash | |
snap install ngrok | |
``` | |
#/home/user/.ngrok2/ngrok.yml | |
``` | |
authtoken: xyz-secret-from-ngrok | |
tunnels: | |
ssh: | |
proto: tcp | |
addr: 12123 | |
``` | |
## test run the ngrok | |
``` | |
ngrok start ssh --config /home/user/.ngrok2/ngrok.yml --region in | |
``` | |
## setup ngrok as service | |
#/lib/systemd/system/ngrok.service | |
``` | |
[Unit] | |
Description=ngrok | |
After=syslog.target network.target | |
[Service] | |
User=user | |
WorkingDirectory=/home/user | |
ExecStart=/snap/bin/ngrok start ssh --config="/home/user/.ngrok2/ngrok.yml" --region="in" | |
ExecReload=/bin/kill -HUP $MAINPID | |
KillMode=process | |
IgnoreSIGPIPE=true | |
Restart=always | |
RestartSec=3 | |
Type=simple | |
[Install] | |
WantedBy=multi-user.target | |
``` | |
sudo systemctl enable ngrok.service | |
sudo systemctl disable ngrok.service | |
sudo systemctl start ngrok.service | |
sudo systemctl status ngrok.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment