guillaumedsde / alpine-qbittorrent-openvpn

qBittorrent docker container with OpenVPN client running as unprivileged user on alpine linux
https://guillaumedsde.gitlab.io/alpine-qbittorrent-openvpn/
GNU General Public License v3.0
216 stars 40 forks source link

[help wanted] [enhancement] - Executing script after tunnel up #88

Open Ricardo-0101 opened 3 years ago

Ricardo-0101 commented 3 years ago

Sorry if this is the wrong place to post this, I've been struggling to work out how with this container to execute a script once the tunnel comes up. The purpose if this is to update via an API the IP assigned to the VPN.

As a fallback I know I can add up /pathtoscript/script.sh to my .ovpn file but I suspect there is a more elegant way to do this, hopefully configurable with an evinronment variable. The haugene container for example exectutes /scripts/openvpn-post-config.sh.

Current setup

version: "3.3"
services:
  alpine-qbittorrent-openvpn:
    container_name: alpine-qbittorrent-openvpn
    restart: unless-stopped
    image: guillaumedsde/alpine-qbittorrent-openvpn:latest #guillaumedsde/alpine-qbittorrent-openvpn:dd4cd24 
    volumes:
      - /mnt/downloads/:/downloads
      - /mnt/temp_downloads:/temp_downloads
      - ${USERDIR}/docker/qbittorrent:/config
      - ${USERDIR}/docker/shared/######/##########:/config/openvpn/config.ovpn
      - ${USERDIR}/docker/shared/###:/###
      - ${USERDIR}/docker/qbittorrent/scripts:/scripts
      - /etc/localtime:/etc/localtime:ro
    environment:
      - OPENVPN_PROVIDER= #Leave empty if provider not in the supported list
      - OPENVPN_USERNAME=###########
      - OPENVPN_PASSWORD=#########
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
      - QBT_WEBUI_PORT=8090
      - LAN=#############
    ports:
      - "8090:8090" #Unifi controller uses 8080
    cap_add:
      - NET_ADMIN
    labels:
      - com.centurylinklabs.watchtower.enable=true