mirror of
https://github.com/vincenthsu/systemd-ngrok.git
synced 2025-02-06 15:05:48 +00:00
Merge pull request #11 from elzdave/master
Add Ngrok architecture auto detection and improve README
This commit is contained in:
commit
e4c01148bd
29
README.md
29
README.md
|
@ -1,24 +1,11 @@
|
||||||
# Installation
|
## Installation
|
||||||
|
|
||||||
Step 1: Place [`ngrok`](https://ngrok.com/download) in `/opt/ngrok/`.
|
1. Clone this repository to the target machine (eg: Raspberry Pi)
|
||||||
|
2. Get your `authtoken` from ngrok website
|
||||||
|
3. Inspect and modify the configuration file `ngrok.yml`, by default this config will use _Asia Pacific_ region to serve both **HTTP** and **TCP** tunnels
|
||||||
|
4. Run `sudo ./install.sh <your_authtoken>`, replace `<your_authtoken>` with the token you've obtained before from ngrok website.
|
||||||
|
5. You're good to go!
|
||||||
|
|
||||||
Step 2: Get `authtoken` from ngrok website, then add it to `/opt/ngrok/ngrok.yml`.
|
## Acknowledgements
|
||||||
|
|
||||||
Step 3. Modify your own configrations in `/opt/ngrok/ngrok.yml`.
|
Ngrok architecture auto detection was contributed by [David Eleazar](https://github.com/elzdave).
|
||||||
|
|
||||||
Step 4: Add `ngrok.service` to `/lib/systemd/system/`.
|
|
||||||
|
|
||||||
Step 5: Start ngrok service by typing:
|
|
||||||
|
|
||||||
```
|
|
||||||
systemctl enable ngrok.service
|
|
||||||
systemctl start ngrok.service
|
|
||||||
```
|
|
||||||
|
|
||||||
or just execute `install.sh` on Linux x64 platform.
|
|
||||||
|
|
||||||
```
|
|
||||||
curl -O https://raw.githubusercontent.com/vincenthsu/systemd-ngrok/master/install.sh
|
|
||||||
chmod +x install.sh
|
|
||||||
sudo ./install.sh <your_authtoken>
|
|
||||||
```
|
|
||||||
|
|
26
install.sh
26
install.sh
|
@ -1,5 +1,20 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# determine system arch
|
||||||
|
ARCH=
|
||||||
|
if [ "$(uname -m)" == 'x86_64' ]
|
||||||
|
then
|
||||||
|
ARCH=amd64
|
||||||
|
elif [ "$(uname -m)" == 'aarch64' ]
|
||||||
|
then
|
||||||
|
ARCH=arm64
|
||||||
|
elif [ "$(uname -m)" == 'i386' ] || [ "$(uname -m)" == 'i686' ]
|
||||||
|
then
|
||||||
|
ARCH=386
|
||||||
|
else
|
||||||
|
ARCH=arm
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! $(which wget) ]; then
|
if [ ! $(which wget) ]; then
|
||||||
echo 'Please install wget package'
|
echo 'Please install wget package'
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -29,16 +44,21 @@ if [ ! -e ngrok.service ]; then
|
||||||
git clone --depth=1 https://github.com/vincenthsu/systemd-ngrok.git
|
git clone --depth=1 https://github.com/vincenthsu/systemd-ngrok.git
|
||||||
cd systemd-ngrok
|
cd systemd-ngrok
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp ngrok.service /lib/systemd/system/
|
cp ngrok.service /lib/systemd/system/
|
||||||
mkdir -p /opt/ngrok
|
mkdir -p /opt/ngrok
|
||||||
cp ngrok.yml /opt/ngrok
|
cp ngrok.yml /opt/ngrok
|
||||||
sed -i "s/<add_your_token_here>/$1/g" /opt/ngrok/ngrok.yml
|
sed -i "s/<add_your_token_here>/$1/g" /opt/ngrok/ngrok.yml
|
||||||
|
|
||||||
cd /opt/ngrok
|
cd /opt/ngrok
|
||||||
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
|
echo "Downloading ngrok for $ARCH . . ."
|
||||||
unzip ngrok-stable-linux-amd64.zip
|
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-$ARCH.zip
|
||||||
rm ngrok-stable-linux-amd64.zip
|
unzip ngrok-stable-linux-$ARCH.zip
|
||||||
|
rm ngrok-stable-linux-$ARCH.zip
|
||||||
chmod +x ngrok
|
chmod +x ngrok
|
||||||
|
|
||||||
systemctl enable ngrok.service
|
systemctl enable ngrok.service
|
||||||
systemctl start ngrok.service
|
systemctl start ngrok.service
|
||||||
|
|
||||||
|
echo "Done installing ngrok"
|
||||||
|
exit 0
|
||||||
|
|
15
ngrok.yml
15
ngrok.yml
|
@ -1,16 +1,9 @@
|
||||||
authtoken: <add_your_token_here>
|
authtoken: <add_your_token_here>
|
||||||
# region: ap
|
region: ap
|
||||||
tunnels:
|
tunnels:
|
||||||
|
web:
|
||||||
|
proto: http
|
||||||
|
addr: 80
|
||||||
ssh:
|
ssh:
|
||||||
proto: tcp
|
proto: tcp
|
||||||
addr: 22
|
addr: 22
|
||||||
# myapp-http:
|
|
||||||
# addr: 80
|
|
||||||
# proto: http
|
|
||||||
# hostname: example.com
|
|
||||||
# auth: "user:secretpassword"
|
|
||||||
# bind_tls: false
|
|
||||||
# myapp-https:
|
|
||||||
# addr: 443
|
|
||||||
# proto: tls
|
|
||||||
# hostname: example.com
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user