Skip to content

Latest commit

 

History

History
102 lines (69 loc) · 2.86 KB

fly-io.md

File metadata and controls

102 lines (69 loc) · 2.86 KB

Deploying to Fly.io

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.

Table of Contents

Assumptions

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

Step 0: Pull the latest code version

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

Step 1: Initialize Fly.io

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

Step 2: Create persistent storage

$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

Step 3: Allocate IP addresses

flyctl ips allocate-v4 --shared
flyctl ips allocate-v6

Add the above generated IP addresses to the required A and AAAA records.

Step 4: Deploy an HTTPS certificate using Fly's CLI

flyctl certs add $publicServerURL

Step 5: Customise your configuration

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

Step 6: Deploy Your Application

Deploy your application using the Fly CLI:

flyctl deploy

Step 7: Monitor Your Application

You can monitor your application using the Fly.io dashboard or the Fly CLI:

flyctl status

Conclusion

You have successfully deployed your application to Fly.io. For more information, refer to the Fly.io documentation.