Some improvements

1. Added simple architecture auto-detect feature
2. Improved README.md
3. Improved ngrok.yml config

Signed-off-by: David Eleazar <smartways897@gmail.com>
This commit is contained in:
David Eleazar 2021-11-24 01:11:11 +07:00
parent edcc59014f
commit 69b4852152
No known key found for this signature in database
GPG Key ID: 2D07ED54845E0541
3 changed files with 34 additions and 37 deletions

View File

@ -1,24 +1,9 @@
# 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`.
Step 3. Modify your own configrations in `/opt/ngrok/ngrok.yml`.
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>
```
_NB : this repository is forked from [vincenthsu/systemd-ngrok](https://github.com/vincenthsu/systemd-ngrok) with architecture auto-detect feature_

View File

@ -1,5 +1,20 @@
#!/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
echo 'Please install wget package'
exit 1
@ -26,7 +41,7 @@ if [ -z "$1" ]; then
fi
if [ ! -e ngrok.service ]; then
git clone --depth=1 https://github.com/vincenthsu/systemd-ngrok.git
git clone --depth=1 https://github.com/elzdave/systemd-ngrok.git
cd systemd-ngrok
fi
cp ngrok.service /lib/systemd/system/
@ -35,10 +50,14 @@ cp ngrok.yml /opt/ngrok
sed -i "s/<add_your_token_here>/$1/g" /opt/ngrok/ngrok.yml
cd /opt/ngrok
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip ngrok-stable-linux-amd64.zip
rm ngrok-stable-linux-amd64.zip
echo "Downloading ngrok for $ARCH . . ."
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-$ARCH.zip
unzip ngrok-stable-linux-$ARCH.zip
rm ngrok-stable-linux-$ARCH.zip
chmod +x ngrok
systemctl enable ngrok.service
systemctl start ngrok.service
echo "Done installing ngrok"
exit 0

View File

@ -1,16 +1,9 @@
authtoken: <add_your_token_here>
# region: ap
region: ap
tunnels:
web:
proto: http
addr: 80
ssh:
proto: tcp
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