tailscale-dev/docker-guide-code-examples

How to get this working in a swarm?

Opened this issue · 0 comments

I could not get this working for me at all in my swarm.

this worked on my rpi

services:
  tailscale:
    image: tailscale/tailscale:latest
    hostname: tailscale-npm
    environment:
      - TS_AUTHKEY=redacted
      #- TS_EXTRA_ARGS=--advertise-tags=tag:container
      - TS_STATE_DIR=/var/lib/tailscale
      - TS_USERSPACE=false
      - TS_NO_LOGS_NO_SUPPORT=true
      - TS_DEBUG_MTU=1500
      - TS_HOSTNAME=tailscale-npm
    volumes:
      - /home/pi/tailscale:/var/lib/tailscale
      - /dev/net/tun:/dev/net/tun
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    restart: unless-stopped
  npm:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: always
    environment:
      DISABLE_IPV6: 'true'
    volumes:
      - /home/pi/npm.data:/data
      - /home/pi/le:/etc/letsencrypt
    depends_on:
      - tailscale
    network_mode: service:tailscale

this did not work on the swarm, while i could ping the tailnet node it was as if no packets were being forwarded to the nginx proxy manager - does network_moder:service service-name work?

version: "3.2"
services:
  tailscale-npm:
    image: tailscale/tailscale:latest
    hostname: tailscale-npm
    environment:
      - TS_AUTHKEY=redacted
#      - TS_EXTRA_ARGS=--advertise-tags=tag:container
      - TS_STATE_DIR=/var/lib/tailscale
      - TS_USERSPACE=false
      - TS_NO_LOGS_NO_SUPPORT=true
      - TS_DEBUG_MTU=1500
      - TS_HOSTNAME=tailscale-npm
    volumes:
      - ts:/var/lib/tailscale
      - /dev/net/tun:/dev/net/tun
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    restart: unless-stopped
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: always
    ports:
      # These ports are in format <host-port>:<container-port>
      - '180:80' # Public HTTP Port
      - '1443:443' # Public HTTPS Port
      - '181:81' # Admin Web Port
      # Add any other Stream port you want to expose
      # - '21:21' # FTP
    environment:
      DISABLE_IPV6: 'true'
    volumes:
      - data:/data
      - le:/etc/letsencrypt
    depends_on:
      - tailscale-npm
    network_mode: service:tailscale-npm
    deploy:
      mode: replicated
      replicas: 1    


volumes:
  data:
    driver: gluster-vol1
  le:
    driver: gluster-vol1
  ts:
    driver: gluster-vol1