Skip to content

Instantly share code, notes, and snippets.

@ji-podhead
Last active April 9, 2025 14:15
Show Gist options
  • Select an option

  • Save ji-podhead/38fc8d0bf9e5b1fdf27c090146a692a9 to your computer and use it in GitHub Desktop.

Select an option

Save ji-podhead/38fc8d0bf9e5b1fdf27c090146a692a9 to your computer and use it in GitHub Desktop.
Deploy tailscale and Vault via docker compose on openwrt router

Deploy tailscale and Vault via docker compose on openwrt router

you can find the full project here pamji - onpremcontrol those are the minimum requirements to deploy a basis infra via IaC. This is the controller for the pamji onprem infra. It servers as a low spec router, failover vpn access point and secrets manager.

requirements

  • predeployed openwrt router

creates

  • a tailscale- and a vault docker container
  • those are the minimum requirements to deploy the basis infra via IaC.

deployment

  • generate a tailscale oauth key

    oauth-key

  • ssh into the openwrt router

  • get the files

    wget --no-check-certificate --content-disposition https://github.com/pam-ji/onpremctl/archive/refs/heads/main.zip
    unzip onpremctl-main.zip
  • cd into onpremctl-main/docker

  • export your authkey

    export TS_AUTHKEY="tskey-client-..."
  • edit your tailscale flags in the compose file under TS_EXTRA_ARGS=

    • mine are for routing and ssh:
      TS_EXTRA_ARGS=--ssh --advertise-routes=200.0.0.0/8,192.168.0.0/16 --advertise-tags=ci
  • now you can deploy with docker compose up

  • unfortunately you need to click the login link in the docker compose output compose output

its on of the first lines of the tailscale logs

changing the avertised routes

  • ssh into the container
    • since we are having ssh access via tailscale and wifi access via the router, we dont need to worry about breaking something
tailscale set --advertise-routes=200.0.0.0/8,192.168.0.0/16 

this way you dont need to use tailscale down, or "" for the advertise routes to delete them

issues

initial login required

  • tailscale should use the ts_authkey which is available as a env var in the container and can be used via $TS_AUTHKEY, but somehow tailscale requires an initial login. the weird thing is tho, when you rerun compose, it does not ask for the login again and uses the authkey.

networking issues

  • make sure that openwrt allows your bridge to use the eth0 interface this is my current setup:

image

under interfaces -> devices -> docker0

image

firewall

image

onprem infra (in progress)

This is our dev environment which is scalable via AWS. Development is done locally, AWS is simulated locally too using localstack. The development containers stored in gitlab. pamjiInfra2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment