Instead of hardcoding the client name as “fly-app” in your start.sh script, you can use the FLY_APP_NAME environment variable provided by Fly.io. This variable contains the name of your Fly app, which should remain consistent across container restarts.
Modify your start.sh script to use the FLY_APP_NAME variable when setting up the Tailscale client name. For example:
tailscale_client_name="${FLY_APP_NAME}-tailscale"
Then, use this variable in your Tailscale cert command: