Set optional tailscaled flags with TAILSCALE_OPT (#6)

* Allow user to set additional Tailscaled options

* Added example use of TAILSCALE_OPT
This commit is contained in:
Ian Neubert 2023-04-04 10:28:36 -04:00 committed by GitHub
parent 45916632fa
commit 9626fd835c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -7,6 +7,8 @@ services:
TAILSCALE_AUTH_KEY: ${TAILSCALE_AUTH_KEY:?err} TAILSCALE_AUTH_KEY: ${TAILSCALE_AUTH_KEY:?err}
TAILSCALE_HOSTNAME: ${TAILSCALE_HOSTNAME:-tailscale-docker-simple-example} TAILSCALE_HOSTNAME: ${TAILSCALE_HOSTNAME:-tailscale-docker-simple-example}
TAILSCALE_STATE_ARG: "mem:" TAILSCALE_STATE_ARG: "mem:"
# (optional) set additional flags on tailscaled
# TAILSCALE_OPT: --outbound-http-proxy-listen=localhost:1055
some-service-1: some-service-1:
image: nginxdemos/hello image: nginxdemos/hello
network_mode: "service:tailscale" network_mode: "service:tailscale"

View file

@ -2,7 +2,7 @@
trap 'kill -TERM $PID' TERM INT trap 'kill -TERM $PID' TERM INT
echo "Starting Tailscale daemon" echo "Starting Tailscale daemon"
# -state=mem: will logout and remove ephemeral node from network immediately after ending. # -state=mem: will logout and remove ephemeral node from network immediately after ending.
tailscaled --tun=userspace-networking --state=${TAILSCALE_STATE_ARG} & tailscaled --tun=userspace-networking --state=${TAILSCALE_STATE_ARG} ${TAILSCALE_OPT} &
PID=$! PID=$!
until tailscale up --authkey="${TAILSCALE_AUTH_KEY}" --hostname="${TAILSCALE_HOSTNAME}"; do until tailscale up --authkey="${TAILSCALE_AUTH_KEY}" --hostname="${TAILSCALE_HOSTNAME}"; do
sleep 0.1 sleep 0.1