support extra args to tailscale up

This commit is contained in:
John Bowdre 2023-12-29 21:58:39 -06:00
parent 9e4c2bb4e5
commit 54da987ff5
5 changed files with 14 additions and 6 deletions

View File

@ -21,6 +21,7 @@ Expected environment variables:
| `TS_HOSTNAME` | `my-app` | optional Tailscale hostname for the new node |
| `TS_STATE_DIR` | `/var/lib/tailscale/` | required directory for storing Tailscale state, this should be mounted to the container for persistence |
| `TS_TAILSCALED_EXTRA_ARGS` | `--verbose=1` | optional additional [flags](https://tailscale.com/kb/1278/tailscaled#flags-to-tailscaled) for `tailscaled` |
| `TS_EXTRA_ARGS` | `--ssh` | optional additional [flags](https://tailscale.com/kb/1241/tailscale-up) for `tailscale up` |
| `TS_SERVE_PORT` | `8080` | optional application port to expose with [Tailscale Serve](https://tailscale.com/kb/1312/serve) |
| `TS_FUNNEL` | `1` | if set (to anything), will proxy `TS_SERVE_PORT` **publicly** with [Tailscale Funnel](https://tailscale.com/kb/1223/funnel) |

View File

@ -1,6 +1,7 @@
# Rename to .env
TS_AUTHKEY="" # Required Tailscale auth key
TS_HOSTNAME="" # Optional hostname for this node
TS_TAILSCALED_EXTRA_ARGS="" # Optional additional arguments for tailscaled
TS_SERVE_PORT="" # Optional backend port to proxy with tailscale serve
TS_FUNNEL="" # If set, serve publicly with tailscale funnel
TS_AUTHKEY="" # Required Tailscale auth key
TS_HOSTNAME="" # Optional hostname for this node
TS_TAILSCALED_EXTRA_ARGS="" # Optional additional arguments for tailscaled
TS_EXTRA_ARGS="" # Optional additional arguments for tailscale up
TS_SERVE_PORT="" # Optional backend port to proxy with tailscale serve
TS_FUNNEL="" # If set, serve publicly with tailscale funnel

View File

@ -7,6 +7,8 @@ services:
TS_AUTHKEY: ${TS_AUTHKEY:?err} # from https://login.tailscale.com/admin/settings/authkeys
TS_HOSTNAME: ${TS_HOSTNAME:-ts-docker}
TS_STATE_DIR: "/var/lib/tailscale/" # store ts state in a local volume
TS_TAILSCALED_EXTRA_ARGS: ${TS_TAILSCALED_EXTRA_ARGS:-} # optional extra args to pass to tailscaled
TS_EXTRA_ARGS: ${TS_EXTRA_ARGS:-} # optional extra flags to pass to tailscale up
TS_SERVE_PORT: ${TS_SERVE_PORT:-} # optional port to proxy with tailscale serve (ex: '80')
TS_FUNNEL: ${TS_FUNNEL:-} # if set, serve publicly with tailscale funnel
volumes:

View File

@ -3,7 +3,7 @@ trap 'kill -TERM $PID' TERM INT
echo "Starting Tailscale daemon"
tailscaled --tun=userspace-networking --statedir="${TS_STATE_DIR}" ${TS_TAILSCALED_EXTRA_ARGS} &
PID=$!
until tailscale up --authkey="${TS_AUTHKEY}" --hostname="${TS_HOSTNAME}"; do
until tailscale up --authkey="${TS_AUTHKEY}" --hostname="${TS_HOSTNAME}" ${TS_EXTRA_ARGS}; do
sleep 0.1
done
tailscale status

View File

@ -21,6 +21,10 @@ spec:
value: "${TS_HOSTNAME:-ts-docker}"
- name: TS_STATE_DIR
value: "/var/lib/tailscale"
- name: TS_TAILSCALED_EXTRA_ARGS
value: "${TS_TAILSCALED_EXTRA_ARGS:-}"
- name: TS_EXTRA_ARGS
value: "${TS_EXTRA_ARGS:-}"
- name: TS_SERVE_PORT
value: "${TS_SERVE_PORT:-}"
- name: TS_FUNNEL