add funnel support

This commit is contained in:
John Bowdre 2023-12-29 09:48:11 -06:00
parent abe2074cbc
commit 9b9871f435
4 changed files with 12 additions and 1 deletions

View file

@ -2,4 +2,5 @@
export TS_AUTHKEY=""
export TS_HOSTNAME=""
export TS_OPT=""
export TS_SERVE_PORT=""
export TS_SERVE_PORT=""
export TS_FUNNEL_PORT=""

View file

@ -8,6 +8,7 @@ services:
TS_HOSTNAME: ${TS_HOSTNAME:-ts-docker}
TS_STATE: "/var/lib/tailscale/tailscale.state" # store ts state in a local volume
TS_SERVE_PORT: ${TS_SERVE_PORT:-} # optional port to proxy with tailscale serve (ex: '80')
TS_FUNNEL_PORT: ${TS_FUNNEL_PORT:-} # optional port to publish publicly with tailscale funnel (ex: '80')
volumes:
- ./ts_data:/var/lib/tailscale/
myservice:

View file

@ -12,4 +12,9 @@ if [ -n "${TS_SERVE_PORT}" ]; then
tailscale serve --bg "${TS_SERVE_PORT}"
fi
fi
if [ -n "${TS_FUNNEL_PORT}" ]; then
if ! tailscale funnel status | grep -q -A1 '(Funnel on)' | grep -q "${TS_FUNNEL_PORT}"; then
tailscale funnel --bg "${TS_FUNNEL_PORT}"
fi
fi
wait ${PID}

View file

@ -21,6 +21,10 @@ spec:
value: "tailscale-docker-k8s-simple"
- name: TS_STATE
value: "mem:"
- name: TS_SERVE_PORT
value: "${TS_SERVE_PORT:-}"
- name: TS_FUNNEL_PORT
value: "${TS_FUNNEL_PORT:-}"
resources:
limits:
memory: "128Mi"