Small utility to generate a Tailscale serve config from a yaml file supporting TCP ports and http to https forwarding.
Find a file
2026-01-18 22:24:58 +01:00
.gitignore Initial commit 2026-01-18 20:24:13 +01:00
go.mod Initial commit 2026-01-18 20:24:13 +01:00
go.sum Initial commit 2026-01-18 20:24:13 +01:00
License.txt Initial commit 2026-01-18 20:24:13 +01:00
main.go Added --init flag 2026-01-18 22:24:20 +01:00
Readme.md Added note about tailserve --init in readme 2026-01-18 22:24:58 +01:00

Tailserve

Small utility to generate a Tailscale serve config from a yaml file supporting TCP ports and http to https forwarding.

This is very small and probably only useful to me, but basically, it turns this tailserve.yml file:

tailnet: example.ts.net
output: serve.json

services:
  git:
    https: http://forgejo-forgejo-1:3000
    ports:
      - 22:forgejo-forgejo-1

Into this serve.json file:

{
  "Services": {
    "svc:git": {
      "TCP": {
        "22": { "TCPForward": "forgejo-forgejo-1:22" },
        "443": { "HTTPS": true }
      },
      "Web": {
        "git.example.ts.net:443": {
          "Handlers": {
            "/": { "Proxy": "http://forgejo-forgejo-1:3000" }
          }
        }
      }
    }
  }
}

Use tailserve --init to generate a boilerplate tailserve.yml.

Install

go install codeberg.org/codecat/tailserve@latest

Advertise

As an additional note, to advertise to your Tailnet that the services are available, you would have to run:

tailscale serve advertise svc:git

Or, if Tailscale is running in a Docker container:

docker exec -it my-container tailscale serve advertise svc:git