Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 50 additions & 18 deletions src/content/blog/tailscale-router-ddev-addon.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
title: "Tailscale for DDEV: Simple and Secure Project Sharing"
pubDate: 2025-09-09
modifiedDate: 2025-10-09
modifiedDate: 2025-10-20
modifiedComment: "Updated for v3.0.0!"
summary: "Tired of temporary sharing links? Learn how to use the ddev-tailscale-router add-on to get a stable, secure, and private URL for your DDEV projects."
author: Ajith Thampi Joseph
featureImage:
Expand All @@ -14,9 +15,9 @@ categories:
- TechNotes
---

I've found that DDEV's [`ddev share`](https://docs.ddev.com/en/stable/users/topics/sharing/) command is a great way to quickly share my local development environment. However, since it uses ngrok, it generates a new, random URL every time unless you use a [stable domain](https://docs.ddev.com/en/stable/users/topics/sharing/#setting-up-a-stable-ngrok-domain). As an alternative, I've created the [`ddev-tailscale-router`](https://github.com/atj4me/ddev-tailscale-router) add-on.
I've found that DDEV's [`ddev share`](https://docs.ddev.com/en/stable/users/topics/sharing/) command is a great way to quickly share my local development environment. However, since it uses ngrok, it requires ngrok to be installed on the host system and generates a new, random URL every time unless you use a [stable domain](https://docs.ddev.com/en/stable/users/topics/sharing/#setting-up-a-stable-ngrok-domain). As an alternative, I've created the [`ddev-tailscale-router`](https://github.com/atj4me/ddev-tailscale-router) add-on.

This add-on uses [Tailscale](https://tailscale.com/), a VPN service that creates a private and secure network between your devices. It is free for personal use!
This add-on uses [Tailscale](https://tailscale.com/), a VPN service that creates a private and secure network between your devices. It is free for personal use and doesn't require any additional software to be installed on your host system!

As a result, you get a stable, human-readable URL for each of your DDEV projects, which you can access from any device on your Tailscale network.

Expand All @@ -28,7 +29,9 @@ I've found this approach to be particularly useful for:

### How it Works

The `ddev-tailscale-router` add-on works by running a Tailscale container alongside your DDEV project. This container automatically connects to your Tailscale network and securely proxies requests to your project's web container.
The `ddev-tailscale-router` add-on works by installing Tailscale directly into your DDEV project's web container using userspace networking. This approach provides better macOS compatibility and improved reliability compared to running a separate container. The add-on automatically connects to your Tailscale network and securely proxies requests to your project.

> **Update:** Version 3.0.0 brought significant architectural improvements! The add-on now uses YAML-based configuration, improved command structure, and better error handling. If you're upgrading from an earlier version, see the [migration instructions](https://github.com/atj4me/ddev-tailscale-router/releases/tag/v3.0.0) in the release notes.

### Prerequisites

Expand All @@ -52,11 +55,7 @@ To get started, follow these steps:

Replace `~/.bashrc` with `~/.zshrc` if you use Zsh, or your relevant shell configuration file.

Alternatively, you can set it per project (**NOT RECOMMENDED**, because `.ddev/.env.tailscale-router` is not intended to store secrets):

```bash
ddev dotenv set .ddev/.env.tailscale-router --ts-authkey=tskey-auth-your-key-here
```
Alternatively, you can use interactive authentication after installation by running `ddev tailscale login` after your project starts.

2. Next, **install the add-on:**

Expand All @@ -71,7 +70,13 @@ To get started, follow these steps:

### Using Your Tailscale URL

Once installation is complete, you can access your project using these commands:
Once installation is complete, you need to start sharing your project:

Start sharing your project:

```bash
ddev tailscale share
```

Launch your project's Tailscale URL in browser:

Expand All @@ -87,6 +92,8 @@ 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.

To see all available commands and options, run `ddev tailscale help`. This will show you both the DDEV-specific shortcuts and all native Tailscale CLI commands that you can use.

### Public vs. Private Mode

The add-on offers two modes for sharing your project:
Expand All @@ -96,23 +103,46 @@ The add-on offers two modes for sharing your project:

To switch between modes:

Switch to public mode (accessible to anyone on the internet):
Share publicly (accessible to anyone on the internet):

```bash
ddev tailscale share --public
```

Share privately (default, only accessible to your Tailscale devices):

```bash
ddev dotenv set .ddev/.env.tailscale-router --ts-privacy=public
ddev restart
ddev tailscale share
```

Switch back to private mode (default):
Stop sharing:

```bash
ddev dotenv set .ddev/.env.tailscale-router --ts-privacy=private
ddev restart
ddev tailscale stop
```

> **Note:** For public access, you need to configure your [Access Control List (ACL)](https://tailscale.com/kb/1223/funnel#funnel-node-attribute) to enable Funnel. See the [Tailscale Funnel documentation](https://tailscale.com/kb/1223/funnel) for details on setting up the required ACL policy.

I hope this add-on helps streamline your development workflow! If you run into any issues or have suggestions for improvements, feel free to open an issue on the [GitHub repository](https://github.com/atj4me/ddev-tailscale-router/issues).
### Uninstalling the Add-on

If you need to remove the add-on from your project:

1. **Stop any active sharing:**

```bash
ddev tailscale stop
```

2. **Remove the add-on:**

```bash
ddev add-on remove tailscale-router
```

3. **Restart DDEV:**
```bash
ddev restart
```

### Additional Resources

Expand All @@ -129,6 +159,8 @@ Here are some additional resources that you might find helpful:
- **Medium: [My Journey with PHP Dev Environments](https://medium.com/@josephajithampi/my-journey-with-php-dev-environments-1da9f2806ee9)**: A blog post on setting up a PHP development environment.
- **LinkedIn: [The Day My Development Environment Nearly Broke Me](https://www.linkedin.com/pulse/day-my-development-environment-nearly-broke-me-how-i-thampi-joseph-ildhc/)**: An article on the importance of a reliable development environment.

I hope this add-on helps streamline your development workflow! If you run into any issues or have suggestions for improvements, feel free to open an issue on the [GitHub repository](https://github.com/atj4me/ddev-tailscale-router/issues).

---

_This blog post was written with the assistance of Amazon Q and Google Gemini. I used them to help simplify the language, improve the flow, and proofread the text._
_This blog post was updated with the assistance of GitHub Copilot (Claude). I used it to help update the content based on the latest add-on changes, improve accuracy, and maintain consistency. The original version was written with assistance from Amazon Q and Google Gemini._
Loading