Raised: $0
0% of monthly goal Help us cross the finish line!
Goal: $12,000
Raised: $0 Goal: $12,000
0% of monthly goal Help us cross the finish line!
Sponsor DDEV

add-on registry tests last commit release

DDEV Tailscale Router

Overview

Tailscale is a VPN service that creates a private and secure network between your devices.

This add-on integrates Tailscale into your DDEV project. Unlike temporary sharing solutions, this gives you permanent, human-readable URLs that work across all your Tailscale-connected devices.

Read the full blog post: Tailscale for DDEV: Simple and Secure Project Sharing

Use Cases

This add-on is particularly useful for:

Prerequisites

Before installing the add-on:

  1. Install Tailscale on any two devices (computer, phone, or tablet). This is required to generate the auth key.
  2. Enable HTTPS in your DNS settings by clicking “Enable HTTPS…” (required for TLS certificate generation).
  3. Generate an auth key in your Keys settings (ephemeral, reusable keys are recommended).

    Get the auth key and add it to your environment by updating ~/.bashrc, ~/.zshrc, or another relevant shell configuration file with this command:

     echo 'export TS_AUTHKEY=tskey-auth-your-key-here' >> ~/.bashrc
    

    Alternatively, you can also set up authentication using ddev tailscale login after your project starts. This provides secure, interactive access for your DDEV project.

  4. For public access: To enable Funnel (public sharing), configure your Access Control List (ACL) in the Tailscale admin console by adding the funnel node attribute:

     {
       "nodeAttrs": [
         {
           "target": ["*"],
           "attr": ["funnel"]
         }
       ]
     }
    
  5. For SSL certificate generation (Optional): To run the command tailscale cert from the container, the machine needs corresponsing access by adding a certs capability inside node attributes:

     "nodeAttrs": [
       {
         "target": ["*"],
         "attr":   ["tailscale.com/cap/certs"],
       },
     ],
    

Installation

ddev add-on get atj4me/ddev-tailscale-router
ddev restart

To launch your project’s Tailscale URL in your browser:

ddev tailscale launch

To get your project’s Tailscale URL:

ddev tailscale url

Your project’s permanent Tailscale URL will look like: https://<project-name>.<your-tailnet>.ts.net. You can also find it in your Tailscale admin console.

Configure Privacy (Optional)

By default, the project doesn’t connect to Tailscale. To start sharing with your tailnet:

ddev tailscale share

To make your project publicly accessible (Funnel mode):

ddev tailscale share --public

To revert to private mode (only accessible to your Tailscale devices):

ddev tailscale share

Usage

Access all Tailscale CLI commands plus helpful shortcuts:

Command Description
ddev tailscale launch [--public] Share and launch your project’s Tailscale URL in your browser (--public uses Funnel mode for public access)
ddev tailscale share [--public] [--port=<port>] Start sharing your project (--public uses Funnel mode for public access, --port sets the local port)
ddev tailscale stop Stop sharing and reset proxy/funnel configuration
ddev tailscale stat Show Tailscale status for self and active peers
ddev tailscale proxystat Show Funnel/Serve (proxy) status
ddev tailscale url Get your project’s Tailscale URL
ddev tailscale login Authenticate with Tailscale
ddev tailscale <any tailscale command> Run any Tailscale CLI command in the web container

Notes:

Advanced Commands

Tailscale Serve and Tailscale Funnel commands can be used to serve custom ports or files on your TailNet Server. Run ddev tailscale stop first to reset any existing proxy/funnel configuration, if you want to reuse the same port.

# To serve a ReactJS application running on port 8443
ddev tailscale serve --bg --https=8443 localhost:5173

This will share the main project in the 443 port and have the React app in a different 8443 port.

Only ports 8443, 443, and 10000 are supported by tailscale funnel.

Troubleshooting

If you get an error while running the share command, check your authentication status:

Components of the Repository

Testing

This add-on includes automated tests to ensure that the Tailscale router works correctly inside a DDEV environment.

To run tests locally:

bats tests/test.bats

Tests also run automatically in GitHub Actions on every push.

Contributing

Contributions are welcome! If you have suggestions, bug reports, or feature requests, please:

  1. Fork the repository.
  2. Create a new branch.
  3. Make your changes.
  4. Submit a pull request.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.


Maintained by @atj4me 🚀

Let me know if you want any tweaks! 🎯