|
| 1 | +# Make Invidious requests data from YouTube through a VPN using Gluetun (in case your IP is blocked) |
| 2 | + |
| 3 | +## Create the docker network (must be done outside of the compose file): |
| 4 | + |
| 5 | +``` |
| 6 | +docker network create --subnet=172.80.0.0/16 gluetun_network |
| 7 | +``` |
| 8 | + |
| 9 | +Note: We're not using the Gluetun default of 172.18.0.0/16, because it might already be used which causes Gluetun to not start with the error `Error response from daemon: invalid pool request: Pool overlaps with other one on this address space`, if you have this issue with 172.80.0.0/16 just use a number higher than "80" (at the second byte) and apply the rest of the documentation accordingly |
| 10 | + |
| 11 | + |
| 12 | +## Create the compose file for Gluetun |
| 13 | + |
| 14 | +- Global setup: https://github.com/qdm12/gluetun-wiki/tree/main/setup |
| 15 | + |
| 16 | +- Provider setup: https://github.com/qdm12/gluetun-wiki/tree/main/setup/providers |
| 17 | + |
| 18 | +``` |
| 19 | +services: |
| 20 | + gluetun: |
| 21 | + image: ghcr.io/qdm12/gluetun |
| 22 | + container_name: gluetun |
| 23 | + cap_add: |
| 24 | + - NET_ADMIN |
| 25 | + devices: |
| 26 | + - /dev/net/tun:/dev/net/tun |
| 27 | + ports: |
| 28 | +# - 8888:8888/tcp # HTTP proxy # Useless |
| 29 | +# - 8388:8388/tcp # Shadowsocks # Useless |
| 30 | +# - 8388:8388/udp # Shadowsocks # Useless |
| 31 | + - "127.0.0.1:3000:3000" # Invidious (use the Invidious ports configuration) |
| 32 | + volumes: |
| 33 | + - /docker/gluetun/data:/gluetun |
| 34 | + environment: |
| 35 | + - VPN_SERVICE_PROVIDER=<REDACTED> |
| 36 | + - VPN_TYPE=openvpn # Use openvpn or wireguard |
| 37 | + - OPENVPN_USER=<REDACTED> |
| 38 | + - OPENVPN_PASSWORD=<REDACTED> |
| 39 | + - SERVER_COUNTRIES=Germany # Use your server location |
| 40 | + - UPDATER_PERIOD=24h |
| 41 | + - TZ=Europe/Paris # Use your timezone |
| 42 | + networks: |
| 43 | + gluetun_network: |
| 44 | +
|
| 45 | +networks: |
| 46 | + gluetun_network: |
| 47 | + external: true |
| 48 | +``` |
| 49 | + |
| 50 | +## Make Invidious use gluetun |
| 51 | + |
| 52 | + |
| 53 | +Add this to your DB: |
| 54 | + |
| 55 | +``` |
| 56 | + networks: |
| 57 | + gluetun_network: |
| 58 | + ipv4_address: 172.80.0.22 |
| 59 | +``` |
| 60 | + |
| 61 | +Add this to the end of your compose (to make the Invidious-Postgres stack connect to gluetun): |
| 62 | + |
| 63 | +``` |
| 64 | +networks: |
| 65 | + gluetun_network: |
| 66 | + external: true |
| 67 | +``` |
| 68 | + |
| 69 | + |
| 70 | +Add this to the Invidious container: |
| 71 | + |
| 72 | +``` |
| 73 | + network_mode: "container:gluetun" |
| 74 | +``` |
| 75 | + |
| 76 | +Comment out the "- ports:" of the Invidious container (gluetun replaces it, reason why we configured it with the same value) |
| 77 | + |
| 78 | + |
| 79 | +Update the Invidious config to use the new database address (since the network is "different", using the hostname wont work): |
| 80 | + |
| 81 | +``` |
| 82 | + INVIDIOUS_CONFIG: | |
| 83 | + db: |
| 84 | + dbname: invidious |
| 85 | + user: kemal |
| 86 | + password: <REDACTED> |
| 87 | + host: 172.80.0.22 |
| 88 | + port: 5432 |
| 89 | +``` |
0 commit comments