ghostserverd / mediaserver-docker

Docker compose for comprehensive autonomous media server
253 stars 42 forks source link

Trouble adapting Transmission through Wireguard with DockStarter setup #13

Closed bearsandbears closed 4 years ago

bearsandbears commented 4 years ago

I'm probably out of my league here but I'm attempting to adapt your solution allowing transmission traffic through Wireguard to a DockStarter setup. I initially tried using your third option for enabling docker DNS resolution within the Wireguard container but received failures asking if I mounted docker.sock. I suspect something was failing earlier down the line that was forcing the fallback to this original method.

Currently I receive an error in Wireguard

...
No resolv.conf for interface lo.dnsmasq
Restarting DNS forwarder and DHCP server: dnsmasq.
Fri Jul 17 21:18:26 UTC 2020: ---INFO--- Adding route back to local network: 192.168.0.0/24
Fri Jul 17 21:18:26 UTC 2020: ---INFO--- Endpoint in config: theaddress
Fri Jul 17 21:18:26 UTC 2020: ---INFO--- Active EndPoint : theaddress
Fri Jul 17 21:18:26 UTC 2020: ---INFO--- Adding services to /etc/hosts```

and then a list of the services added.

transmission's log reads

...
[services.d] starting services
[services.d] done.
[2020-07-16 21:09:58.538] Transmission 3.00 (bb6b5a062e) started (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/session.c:769)
[2020-07-16 21:09:58.542] RPC Server Adding address to whitelist: 127.0.0.1 (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/rpc-server.c:956)
[2020-07-16 21:09:58.542] RPC Server Serving RPC and Web requests on 0.0.0.0:5656/transmission/ (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/rpc-server.c:1243)
[2020-07-16 21:09:58.542] RPC Server Password required (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/rpc-server.c:1254)
[2020-07-16 21:09:58.542] UDP Failed to set receive buffer: requested 4194304, got 425984 (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/tr-udp.c:97)
[2020-07-16 21:09:58.542] UDP Please add the line "net.core.rmem_max = 4194304" to /etc/sysctl.conf (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/tr-udp.c:99)
[2020-07-16 21:09:58.542] UDP Failed to set send buffer: requested 1048576, got 425984 (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/tr-udp.c:105)
[2020-07-16 21:09:58.542] UDP Please add the line "net.core.wmem_max = 1048576" to /etc/sysctl.conf (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/tr-udp.c:107)
[2020-07-16 21:09:58.542] Using settings from "/config" (/home/buildozer/aports/community/transmission/src/transmission-3.00/daemon/daemon.c:646)
[2020-07-16 21:09:58.542] Saved "/config/settings.json" (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/variant.c:1221)
[2020-07-16 21:09:58.542] transmission-daemon requiring authentication (/home/buildozer/aports/community/transmission/src/transmission-3.00/daemon/daemon.c:674)
[2020-07-16 21:09:58.542] Watching "/watch" for new .torrent files (/home/buildozer/aports/community/transmission/src/transmission-3.00/daemon/daemon.c:698)
[2020-07-16 21:09:58.542] Port Forwarding (NAT-PMP) initnatpmp succeeded (0) (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/natpmp.c:73)
[2020-07-16 21:09:58.542] Port Forwarding (NAT-PMP) sendpublicaddressrequest succeeded (2) (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/natpmp.c:73)
[2020-07-16 21:10:06.541] Port Forwarding State changed from "Not forwarded" to "Starting" (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/port-forwarding.c:106)
[2020-07-16 21:10:06.541] Port Forwarding State changed from "Starting" to "???" (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/port-forwarding.c:106)

When I attempt to connect to transmission webgui it times out after some time. these are my compose entries

  wireguard:
    image: ghostserverd/wireguard
    container_name: wireguard
    restart: always
    privileged: true
    sysctls:
      - "net.ipv6.conf.all.disable_ipv6=0"
      - "net.ipv6.conf.default.forwarding=1"
      - "net.ipv6.conf.all.forwarding=1"
      - "net.ipv4.ip_forward=1"
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    networks:
      default:
        aliases:
#          - nzbget
          - transmission
    ports:
#      - "${NZBGET_PORT}:6789"
      - ${TRANS_WEBUI_PORT}:${TRANS_WEBUI_PORT}
#      # TRANS_CONNECTION_PORT may need to be port forwarded by your VPN
      - ${TRANS_CONNECTION_PORT}:${TRANS_CONNECTION_PORT}
      - ${TRANS_CONNECTION_PORT}:${TRANS_CONNECTION_PORT}/udp
    environment: 
      - LOCAL_NETWORK=${LOCAL_NETWORK}
#      # NETWORK_NAME is not needed unless you are mounting docker.sock to write /etc/hosts
      - NETWORK_NAME=${NETWORK_NAME}
#      # this is required unless you are mounting docker.sock to write /etc/hosts
#      - IPTABLES_MASQ=0
#      # space separated  list of docker service names to make addressable
#      - SERVICE_NAMES=filebot sonarr radarr bazarr jackett announcedd heimdall tautulli plex
#      # local TLD to use when routing DNS requests which requires aliases for each service to be addressable from within the wireguard network
#      # - LOCAL_TLD=ghost
    volumes:
      - ${DOCKERCONFDIR}/wireguard:/etc/wireguard
      - /lib/modules:/lib/modules
#      # this is no longer necessary but if enabled, will cause the /etc/hosts file to be written with all available services
      - /var/run/docker.sock:/var/run/docker.sock:ro
  transmission:
    image: ghostserverd/transmission-combustion
    container_name: transmission
    restart: always
    network_mode: "service:wireguard"
    depends_on:
      - wireguard
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
      - TRANS_WEBUI_USER=${TRANS_WEBUI_USER}
      - TRANS_WEBUI_PASS=${TRANS_WEBUI_PASS}
      - TRANS_WEBUI_PORT=${TRANS_WEBUI_PORT}
      - TRANS_MAX_RETENTION=${TRANS_MAX_RETENTION}
      - TRANS_MAX_RATIO=${TRANS_MAX_RATIO}
      - TRANS_CONNECTION_PORT=${TRANS_CONNECTION_PORT}
#      - FILEBOT_PORT=${FILEBOT_PORT}
    volumes:
      - ${DOCKERCONFDIR}/transmission:/config
      - ${DOWNLOADSDIR}:/downloads
      - ${MEDIADIR_TV}:/media

and the relevant .env entries

TRANS_CONNECTION_PORT=theport
TRANS_MAX_RATIO=10
TRANS_MAX_RETENTION=2592000
TRANS_WEBUI_PASS=pass
TRANS_WEBUI_PORT=5656
TRANS_WEBUI_USER=user
DOCKERCONFDIR=theconfigdirectory
NETWORK_NAME=compose_default
LOCAL_NETWORK=192.168.0.0/24
DOWNLOADSDIR=thedownloaddir

The proper port is forwarded to the host in mullvad.

Any guidance would be appreciated, thanks.

bearsandbears commented 4 years ago

I've been working on this a couple of days and naturally as soon as I posted this I made some progress. I changed the mullvad config generator to Server Connection Protocol to IPv4 and Tunnel Traffic to Only IPv4. I did not receive the No resolv.conf for interface lo.dnsmasq message and everything seemed to boot appropriately. I accessed the webgui through 0.0.0.0. :9091/transmission and everything appears to be working.

i'm not sure why I had to do it "the old way" mounting the docker.sock but I'm happy it works, thanks.

Michsior14 commented 4 years ago

I had similar problems at the very beginning with the default (3) approach, but it turned out to be easier to fix than I expected. The things that I needed to do were to provide only one wireguard configuration named wg0.conf and remove announcedd from SERVICE_NAMES.

ghostserverd commented 4 years ago

@bearsandbears I would definitely try option three again if you're up for it. It's my preferred method now. Like @Michsior14 mentioned, taking announcedd out of the service list should clear it up for you (thanks for catching that btw).

As far as IPv6 support, when I generate my config, I definitely do set Server Connection Protocol to IPv4, but I have Tunnel Traffic set to Both so that should work as expected.

Since you've gotten it working, I'm going to resolves this. But feel free to open a new issue if you run into problems again.