tailscale-dev / docker-mod

The home for our universal Docker mod
BSD 3-Clause "New" or "Revised" License
47 stars 26 forks source link

Invalid 'target' when TAILSCALE_SERVE_MODE=tls-terminated-tcp #16

Open Kiser360 opened 6 months ago

Kiser360 commented 6 months ago

Scenario Trying to follow the blog article's docker-compose.yml snippet for code-server. I've made no changes except filling in the secrets.

Problem error: failed to apply TCP serve: unable to expand target: must be a URL starting with one of the supported schemes: [tcp]

Research This commit suggests Tailscale 1.52.0 made some CLI changes. Looking at the docs it suggests that when using --tls-terminated-tcp specifying a 'target' with http:// might be invalid. The docs even say that the protocol can be omitted.

Problem This line will always specify http:// regardless of TAILSCALE_SERVE_MODE.

Solution: Perhaps omit the protocol from the tailscale serve command?

Can't validate the solution and do the pull myself, but I didn't want the research to go to waste.

Kiser360 commented 6 months ago

I did some of the work to investigate the fix:

  1. Start services, but we expect a failure : docker compose up -d

  2. Shell into the docker container: docker compose exec -it <container-name> bash

  3. Modify the docker mod : nano /etc/s6-overlay/s6-rc.d/svc-tailscale-up/run

  4. Change the line mentioned in the top post, remove the protocol from the target http://localhost:"${TAILSCALE_SERVE_PORT} -> localhost:"${TAILSCALE_SERVE_PORT}

  5. Restart services : docker compose restart

This fix works for TAILSCALE_SERVE_MODE=tls-terminated-tcp. I have not tested for any other modes

stevesbrain commented 6 months ago

Can confirm this also works for me, and fits with the fact they changed the serve + funnel logic. Would have been nice if they updated their mods at the same time :P

alexfornuto commented 4 months ago

I hate to add what's essentially noise to an issue thread, but since there's no upstream response I thought a little noise might be warranted.

The very first service I wanted to test this mod with was Quassel, and IRC client. Thus my attempt was met with a known error. Please review this issue.