This guide will walk you through the steps to deploy a docker-headscale
meshnet on Fly.io.
Anything starting with a $
is a placeholder value which will need to be replaced with real values from the commands.
- Assumptions
- Step 0: Pull the latest code version
- Step 1: Initialize Fly.io
- Step 2: Create persistent storage
- Step 3: Allocate IP addresses
- Step 4: Deploy an HTTPS certificate using Fly's CLI
- Step 5: Customise your configuration
- Step 6: Deploy Your Application
- Step 7: Monitor Your Application
- Conclusion
The assumptions made in this document are the following:
- You have a Fly.io account
- You have Fly CLI installed
- You control the DNS records of a domain
- You have a Git client installed
Pull the latest tag from PI's main
branch, and switch to the directory.
git clone https://github.com/privacyint/docker-headscale.git
cd docker-headscale
git checkout main
Log into Fly.io and create a new application.
$yourAppName
may be anything, but must be unique to Fly.io. You can instead use a randomly generated app name by using --generate-name
in place of $yourAppName
.
flyctl auth login
flyctl apps create $yourAppName
$yourAppRegion
may be any Fly.io region. n.b. How to find valid Fly regions
flyctl volumes create --app $yourAppName --region $yourAppRegion --size 1 hs_data
flyctl ips allocate-v4 --shared
flyctl ips allocate-v6
Add the above generated IP addresses to the required A
and AAAA
records.
flyctl certs add $publicServerURL
Create a customised fly.toml
configuration file in the root of your project from the template:
export FLY_APP=$yourAppName
export PUBLIC_SERVER_URL=$publicServerURL
export HEADSCALE_DNS_CONFIG_BASE_DOMAIN=$tailnetInternalDomain
envsubst < templates/fly.template.toml > fly.toml
Deploy your application using the Fly CLI:
flyctl deploy
You can monitor your application using the Fly.io dashboard or the Fly CLI:
flyctl status
You have successfully deployed your application to Fly.io. For more information, refer to the Fly.io documentation.