environment variable auth key

This commit is contained in:
Louis-Philippe Asselin 2022-08-22 14:40:15 -04:00
parent 1009329b49
commit beb2ad6bb6
5 changed files with 15 additions and 8 deletions

View file

@ -15,5 +15,4 @@ A nginx layer is added. It manages two services in independent containers at loc
## TODO ## TODO
- auth key as a secret - force reuse hostname in tailscale instead of adding suffix. Example: first container is assigned `hostname`. Then, if container is recreated, Tailscale assigns `hostname-1`. Possibly helpful [info](https://tailscale.com/kb/1111/ephemeral-nodes/#can-i-create-an-ephemeral-node-without-an-auth-key).
- force reuse hostname in tailscale instead of adding suffix. Example: first start is assigned `hostname`. Then, if container is recreated, Tailscale assigns `hostname-1`

View file

@ -3,6 +3,8 @@ services:
tailscale: tailscale:
build: build:
context: ./tailscale context: ./tailscale
environment:
- TAILSCALE_AUTH_KEY
nginx: nginx:
build: build:
context: ./nginx context: ./nginx

View file

@ -1,7 +1,9 @@
#!/bin/ash #!/bin/ash
echo "Starting TS daemon" echo "Starting TS daemon"
tailscaled --tun=userspace-networking & tailscaled --tun=userspace-networking &
sleep 5 PID=$!
tailscale up --authkey=TAILSCALE_AUTH_KEY --hostname=complex-example until tailscale up --authkey=${TAILSCALE_AUTH_KEY} --hostname=complex-example; do
sleep 0.1
done
tailscale status tailscale status
sleep infinity wait ${PID}

View file

@ -3,6 +3,8 @@ services:
tailscale: tailscale:
build: build:
context: ./tailscale context: ./tailscale
environment:
- TAILSCALE_AUTH_KEY
some-service-1: some-service-1:
image: nginxdemos/hello image: nginxdemos/hello
network_mode: "service:tailscale" network_mode: "service:tailscale"

View file

@ -1,7 +1,9 @@
#!/bin/ash #!/bin/ash
echo "Starting TS daemon" echo "Starting TS daemon"
tailscaled --tun=userspace-networking & tailscaled --tun=userspace-networking &
sleep 5 PID=$!
tailscale up --authkey=TAILSCALE_AUTH_KEY --hostname=simple-docker-compose until tailscale up --authkey=${TAILSCALE_AUTH_KEY} --hostname=complex-example; do
sleep 0.1
done
tailscale status tailscale status
sleep infinity wait ${PID}