Add script to automatically open plex tunnel
This commit is contained in:
parent
97aa842dac
commit
8b2d20e257
|
@ -1,3 +1,4 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
/config
|
/config
|
||||||
|
tunnel-options.sh
|
||||||
|
|
|
@ -93,7 +93,7 @@ http {
|
||||||
server_name ~^(webtools)(\.\w+)+$;
|
server_name ~^(webtools)(\.\w+)+$;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
set $webtools http://plex:33443;
|
set $webtools http://plex:33442;
|
||||||
proxy_pass $webtools;
|
proxy_pass $webtools;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source tunnel-options.sh
|
||||||
|
|
||||||
|
if [[ -z $username ]]; then
|
||||||
|
username=$USER
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[$0] Connecting and fetching IP..."
|
||||||
|
echo "[$0] Username: $username"
|
||||||
|
echo "[$0] Host: $hostname"
|
||||||
|
|
||||||
|
ip=$(ssh -t ${username}@${hostname} "docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${container}")
|
||||||
|
|
||||||
|
echo "[$0] IP found: $ip"
|
||||||
|
echo "[$0] Openning tunnel..."
|
||||||
|
|
||||||
|
open http://localhost:$port && ssh -L $port:$ip:$port ${username}@${hostname}
|
||||||
|
|
||||||
|
echo "[$0] Tunnel closed."
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
# Use : Rename me into "tunnel-options.sh" and change parameters #
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
# SSH Host to open tunnel on
|
||||||
|
hostname="example.com"
|
||||||
|
|
||||||
|
# "UNIX username for SSH access"
|
||||||
|
username="bob"
|
||||||
|
|
||||||
|
# Plex container name for WebTools IP fetching
|
||||||
|
container="seedbox_plex_1"
|
||||||
|
|
||||||
|
# Port for WebTools on the container
|
||||||
|
port=33442
|
Loading…
Reference in New Issue