Build a Remote Exit Node with Tailscale and Fly.io: Setup Instructions

How to setup Tailscale exit note on fly.io

[fly.toml]

app = "fly-scale"

[env]
  PATH="/usr/local/bin"
  TS_EXTRA_ARGS="--hostname=fly --advertise-exit-node"

[build]
  image = "tailscale/tailscale:stable"

[deploy]
  strategy="immediate"

[mounts]
  source="ts_data"
  destination="/var"

Install and authenticate your flyctl

$ brew install flyctl
$ flyctl auth login

Create a fly.io app from the provided fly.toml file

$ flyctl launch --copy-config

Set the TS_AUTH_KEY env var for the current app.

$ flyctl secrets set TS_AUTH_KEY=tskey-xxxxx

Create a volume to persist tailscale db.

$ fly volumes create ts_data --region fra --size 1

Re-deploy, if you change some settings

$ flyctl deploy