Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker compose advanced example #133

Open
Marsu31 opened this issue Jan 25, 2025 · 1 comment
Open

Add docker compose advanced example #133

Marsu31 opened this issue Jan 25, 2025 · 1 comment

Comments

@Marsu31
Copy link

Marsu31 commented Jan 25, 2025

URL to the Wiki page

https://github.com/qdm12/gluetun-wiki/blob/main/setup/advanced/vpn-port-forwarding.md#qbittorrent-example

What's incorrect?

Hi !
We could add a more advanced example which uses the configs section in docker compose (version > v2.23.1) :

services:
  gluetun:
    image: qmcgaw/gluetun:latest
    [...]
    environment:
      [...]
      - VPN_PORT_FORWARDING_UP_COMMAND=/usr/local/sbin/up_command.sh {{PORTS}}
    configs:
      - source: up_command
        target: /usr/local/sbin/up_command.sh
        mode: 0500
    [...]

  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent:latest
    [...]

configs:
  up_command:
    content: |
      #!/bin/sh
      # uncomment to debug commands
      #set -x
      echo === up command - begin =========================================================
      # redirect stderr to stdout
      exec 2>&1
      # give a name to arguments
      port=$$1
      # call qbittorrent api
      echo call qbittorrent api to set listening port to $${port}
      /usr/bin/wget -O - --retry-connrefused --post-data "json={\"listen_port\":$${port}}" http://127.0.0.1:${QBITTORRENT_UI_PORT}/api/v2/app/setPreferences
      echo === up command - end ===========================================================
      exit 0

It does the same as the actual short command but some would prefer this clearer syntax.

Regards.

Copy link

⚠️ This is the Gluetun WIKI and any issue unrelated to the issue will be instantly closed as not planned without any explanation.

qdm12 is more or less the only maintainer so please:

  • do not ask for updates, be patient
  • 👍 the issue to show your support instead of commenting

qdm12 usually checks Wiki issues at least once per month and tries to resolve them all before a new Gluetun release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant