├── .gitattributes ├── ngrok-sample.yml ├── systemd └── ngrok.service └── scripts └── service-installer.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /ngrok-sample.yml: -------------------------------------------------------------------------------- 1 | authtoken: abc123 2 | tunnels: 3 | ssh: 4 | proto: tcp 5 | addr: 22 6 | dashboard: 7 | proto: http 8 | addr: 8080 9 | vnc: 10 | proto: tcp 11 | addr: 5900 12 | -------------------------------------------------------------------------------- /systemd/ngrok.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Companion Service 3 | After=network.target 4 | 5 | [Service] 6 | Environment=PATH=/home/__USER__/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 7 | ExecStart=/home/__USER__/ngrok start --all 8 | WorkingDirectory=/home/__USER__/ 9 | StandardOutput=tty, 10 | StandardError=tty 11 | Restart=always 12 | User=__USER__ 13 | 14 | [Install] 15 | WantedBy=multi-user.target 16 | -------------------------------------------------------------------------------- /scripts/service-installer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | if [[ $EUID -ne 0 ]]; then 6 | echo "This script must be run as root (use sudo)" 1>&2 7 | exit 1 8 | fi 9 | 10 | #Get the checkout directory 11 | GIT_DIR="$(realpath $(dirname ${BASH_SOURCE[0]})/..)" 12 | 13 | #Get the owner of the checkout directory 14 | GIT_OWNER="$(ls -ld "$GIT_DIR" | awk 'NR==1 {print $3}')" 15 | 16 | cd "$(dirname "${BASH_SOURCE[0]}")/.." 17 | repo_path="$PWD" 18 | 19 | 20 | for service in systemd/*.service; do 21 | sed "s:/home/__USER__/ngrok-service:${repo_path}:g;s:__USER__:${GIT_OWNER}:g" "$service" \ 22 | > "/lib/systemd/system/$(basename "$service")" 23 | done 24 | --------------------------------------------------------------------------------