Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Run a Tailscale node on Railway

Stand up a Tailscale node in 10 seconds or less (assuming instantaneous CTRL+C CTRL+V). Run an exit node. Host your own DNS. The possibilities are endless.

Deploy on Railway

Configuration

Set your Tailscale authentication key

Set your Tailscale key for the variable TS_AUTHKEY. You can create a new key in the Tailscale admin console:

Settings > Personal Settings > Keys

Create a new authentication key in the Tailscale admin console

I recommend using a single-use key. This recipe will persist Tailscale's state across restarts, so there is no need to use this key more than once per environment.

Configure the authentication key to be single-use

Set the Docker image version (optional)

You can pin to a specific version of the Tailscale Docker image by setting the VERSION variable.

VERSION="v1.92.5"  # defaults to "latest"

Further customize the node configuration (optional)

You can configure the Tailscale service through any of the environment variables in the Tailscale docs.

Serving as an exit node

To advertise an exit node, you can use TS_EXTRA_ARGS to add the appropriate flag when the container starts up:

TS_EXTRA_ARGS="--advertise-exit-node"

Be sure to also approve the exit node in the Tailscale admin console after deploying.

Enabling the subnet router

Your node can provide access to other services in Railway by allowing you to connect to the railway.internal domain.

First, have the node advertise routes for Railway's internal network CIDR range:

TS_ROUTES="fd12::/16,10.128.0.0/9"

Second, configure split DNS in the Tailscale admin console to route DNS lookups for railway.internal to Railway's internal DNS server. Use fd12::10 as the nameserver address (used for all Railway internal routing).

Add a customer nameserver in the Railway admin console

Configure the nameserver with an address of fd12::10 and split DNS enabled for the railway.internal host

Finally, be sure to approve the subnet routes in the Tailscale admin console after deploying.

You can now access railway.internal routes when connected to Tailscale.

Why

I use Tailscale to tunnel in to a number of development environments. While Railway also offers similar functionality, I prefer to just use the same tool I'm using everywhere. And then I went overboard because I didn't like the way logs were formatted...

Related projects & attribution

About

Run a Tailscale node on Railway

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Contributors

Languages