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

@ -3,3 +3,4 @@ export TS_AUTHKEY=""
export TS_HOSTNAME="" export TS_HOSTNAME=""
export TS_OPT="" 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_HOSTNAME: ${TS_HOSTNAME:-ts-docker}
TS_STATE: "/var/lib/tailscale/tailscale.state" # store ts state in a local volume 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_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: volumes:
- ./ts_data:/var/lib/tailscale/ - ./ts_data:/var/lib/tailscale/
myservice: myservice:

View file

@ -12,4 +12,9 @@ if [ -n "${TS_SERVE_PORT}" ]; then
tailscale serve --bg "${TS_SERVE_PORT}" tailscale serve --bg "${TS_SERVE_PORT}"
fi fi
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} wait ${PID}

View file

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