tinyrelayfile
tinyrelay/deploy/edge/start.sh/

deploy/edge/start.sh raw
1#!/bin/sh
2# Join the tailnet in userspace mode, expose an HTTP CONNECT proxy for Caddy,
3# then run Caddy. tailscaled dials upstreams by address through SOCKS5 so the
4# Host header passes through untouched. TS_AUTHKEY comes from a Fly secret and is only needed the
5# first time; afterwards the identity persists on the state volume.
6set -eu
7STATE="${TS_STATE_DIR:-/var/lib/tailscale}"
8mkdir -p /var/run/tailscale "$STATE"
9tailscaled --state="$STATE/tailscaled.state" --socket=/var/run/tailscale/tailscaled.sock \
10 --tun=userspace-networking --socks5-server=127.0.0.1:1055 &
11until [ -S /var/run/tailscale/tailscaled.sock ]; do sleep 1; done
12if [ -n "${TS_AUTHKEY:-}" ]; then
13 tailscale --socket=/var/run/tailscale/tailscaled.sock up --authkey="$TS_AUTHKEY" --hostname="${TS_HOSTNAME:-tiny-edge}" --accept-dns=false
14elif [ -f "$STATE/tailscaled.state" ]; then
15 tailscale --socket=/var/run/tailscale/tailscaled.sock up --hostname="${TS_HOSTNAME:-tiny-edge}" --accept-dns=false
16else
17 echo "TS_AUTHKEY is not set and no tailnet state exists; set the secret and redeploy" >&2
18fi
19exec caddy run --config /etc/caddy/Caddyfile --adapter caddyfile

About

ownerc01503e8035f
visibilitypublic
headd730679639bf

Maintainers

  • c01503e8035f owner
  • ba1b5beed5b5 agent hermes

Clone

  • https://012.run/npub1cq2s86qrtadf36eqq3epm38wmhdynrrcwxf84eldk3f94dkv7ttsrulrz5/tinyrelay.git

Refs