From ef1b7f75fa666acf99d901f5142f10730de801c0 Mon Sep 17 00:00:00 2001 From: scott boone Date: Fri, 1 Aug 2025 15:42:58 -0500 Subject: [PATCH 1/2] WIP: tailscale and headscale VPN --- nomad/headscale.hcl | 189 ++++++++++++++++++++++++ nomad/tailscale.hcl | 232 ++++++++++++++++++++++++++++++ scripts/deploy-nomad-headscale.sh | 56 ++++++++ scripts/deploy-nomad-tailscale.sh | 49 +++++++ 4 files changed, 526 insertions(+) create mode 100644 nomad/headscale.hcl create mode 100644 nomad/tailscale.hcl create mode 100755 scripts/deploy-nomad-headscale.sh create mode 100755 scripts/deploy-nomad-tailscale.sh diff --git a/nomad/headscale.hcl b/nomad/headscale.hcl new file mode 100644 index 000000000..a419284c5 --- /dev/null +++ b/nomad/headscale.hcl @@ -0,0 +1,189 @@ +variable "dc" { + type = string +} + +variable "headscale_hostname" { + type = string +} + +variable "headscale_version" { + type = string + default = "latest" +} + +variable "headscale_count" { + type = number + default = 1 +} + +job "[JOB_NAME]" { + datacenters = ["${var.dc}"] + type = "service" + priority = 50 + + constraint { + attribute = "${attr.kernel.name}" + value = "linux" + } + + group "headscale" { + count = var.headscale_count + + constraint { + attribute = "${meta.pool_type}" + operator = "set_contains_any" + value = "consul,general" + } + + restart { + attempts = 2 + interval = "30m" + delay = "15s" + mode = "fail" + } + + ephemeral_disk { + size = 1000 + } + + network { + port "http" { + to = 8080 + } + port "grpc" { + to = 50443 + } + port "metrics" { + to = 9090 + } + } + + task "headscale" { + driver = "docker" + + vault { + change_mode = "restart" + } + + config { + image = "headscale/headscale:${var.headscale_version}" + force_pull = false + ports = ["http", "grpc", "metrics"] + volumes = [ + "local/config.yaml:/etc/headscale/config.yaml", + "alloc/data:/var/lib/headscale" + ] + command = "serve" + } + + template { + destination = "local/config.yaml" + data = < /dev/null 2>&1"] + interval = "30s" + timeout = "10s" + } + } + } + + task "tailscale-web" { + driver = "docker" + + lifecycle { + hook = "poststart" + sidecar = true + } + + config { + image = "nginx:alpine" + ports = ["http"] + volumes = [ + "local/nginx.conf:/etc/nginx/nginx.conf" + ] + } + + template { + destination = "local/nginx.conf" + data = < Date: Tue, 12 Aug 2025 10:35:03 -0500 Subject: [PATCH 2/2] WIP: tailscale VPN --- nomad/headscale.hcl | 17 ++-- nomad/ouroboros.hcl | 128 ++++++++++++++++++++++++++++++ nomad/tailscale.hcl | 2 +- scripts/deploy-nomad-ouroboros.sh | 78 ++++++++++++++++++ 4 files changed, 212 insertions(+), 13 deletions(-) create mode 100644 nomad/ouroboros.hcl create mode 100755 scripts/deploy-nomad-ouroboros.sh diff --git a/nomad/headscale.hcl b/nomad/headscale.hcl index a419284c5..2055df7d7 100644 --- a/nomad/headscale.hcl +++ b/nomad/headscale.hcl @@ -79,7 +79,7 @@ job "[JOB_NAME]" { template { destination = "local/config.yaml" data = <