Feature req: Add options file for gluetun so that you can customize the VPN providers settings #36

Closed
opened 2024-09-24 15:19:20 -03:00 by kragil · 14 comments
kragil commented 2024-09-24 15:19:20 -03:00 (Migrated from gitlab.com)

I was really fed up with Private Internet Access always connecting me with Chile or Malaysia or some far away country. I also use jdownloader over this VPN and my.jdownloader.org was totally unusable over these slow far away VPNs.

I edited the docker file like this to archive my goal (solution at the end):

  # Gluetun is our VPN, so you can download torrents safely
  gluetun:
    image: qmcgaw/gluetun:v3
    container_name: gluetun
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    ports:
      - 8888:8888/tcp # HTTP proxy
      - 8388:8388/tcp # Shadowsocks
      - 8388:8388/udp # Shadowsocks
      - 8080:8080/tcp # gluetun
    volumes:
      - ${INSTALL_DIRECTORY}/config/gluetun:/config
    environment:
      - VPN_SERVICE_PROVIDER=${VPN_SERVICE}
      - VPN_TYPE=openvpn
      - OPENVPN_USER=${VPN_USER}
      - OPENVPN_PASSWORD=${VPN_PASSWORD}
      - OPENVPN_CIPHERS=AES-256-GCM
      - SERVER_REGIONS=Andorra,Belgium,Bosnia and Herzegovina,Bulgaria,Croatia,Cyprus,Czech Republic,DK Copenhagen,DK Streaming Optimized,ES Madrid,ES Valencia,Estonia,FI Helsinki,FI Streaming Optimized,France,Georgia,Greece,Hungary,IT Milano,IT Streaming Optimized,Iceland,Ireland,Isle of Man,Israel,Latvia,Liechtenstein,Lithuania,Luxembourg,Monaco,Montenegro,NL Netherlands Streaming Optimized,Netherlands,North Macedonia,Norway,Poland,Portugal,Romania,SE Stockholm,SE Streaming Optimized,Serbia,Slovakia,Slovenia,Switzerland,Turkey,UK London,UK Manchester,UK Southampton,UK Streaming Optimized,Ukraine
    restart: unless-stopped

PIA uses SERVER_REGIONS, other VPNs use different variables. So I think a generic file that is included in the dockerfile would be best. But I really don't know what the best option is. You are the devs ;-)

Keep up the great work! Thanks!

I was really fed up with Private Internet Access always connecting me with Chile or Malaysia or some far away country. I also use jdownloader over this VPN and my.jdownloader.org was totally unusable over these slow far away VPNs. I edited the docker file like this to archive my goal (solution at the end): ``` # Gluetun is our VPN, so you can download torrents safely gluetun: image: qmcgaw/gluetun:v3 container_name: gluetun cap_add: - NET_ADMIN devices: - /dev/net/tun:/dev/net/tun ports: - 8888:8888/tcp # HTTP proxy - 8388:8388/tcp # Shadowsocks - 8388:8388/udp # Shadowsocks - 8080:8080/tcp # gluetun volumes: - ${INSTALL_DIRECTORY}/config/gluetun:/config environment: - VPN_SERVICE_PROVIDER=${VPN_SERVICE} - VPN_TYPE=openvpn - OPENVPN_USER=${VPN_USER} - OPENVPN_PASSWORD=${VPN_PASSWORD} - OPENVPN_CIPHERS=AES-256-GCM - SERVER_REGIONS=Andorra,Belgium,Bosnia and Herzegovina,Bulgaria,Croatia,Cyprus,Czech Republic,DK Copenhagen,DK Streaming Optimized,ES Madrid,ES Valencia,Estonia,FI Helsinki,FI Streaming Optimized,France,Georgia,Greece,Hungary,IT Milano,IT Streaming Optimized,Iceland,Ireland,Isle of Man,Israel,Latvia,Liechtenstein,Lithuania,Luxembourg,Monaco,Montenegro,NL Netherlands Streaming Optimized,Netherlands,North Macedonia,Norway,Poland,Portugal,Romania,SE Stockholm,SE Streaming Optimized,Serbia,Slovakia,Slovenia,Switzerland,Turkey,UK London,UK Manchester,UK Southampton,UK Streaming Optimized,Ukraine restart: unless-stopped ``` PIA uses SERVER_REGIONS, other VPNs use different variables. So I think a generic file that is included in the dockerfile would be best. But I really don't know what the best option is. You are the devs ;-) Keep up the great work! Thanks!
kragil commented 2024-09-24 15:20:33 -03:00 (Migrated from gitlab.com)

changed the description

changed the description
kragil commented 2024-09-24 15:21:01 -03:00 (Migrated from gitlab.com)

changed the description

changed the description
MasonStooksbury commented 2024-09-24 15:23:21 -03:00 (Migrated from gitlab.com)

@rogs I think we could probably add a step to yams start command that could read from a file, convert to a string, and export a variable that the docker-compose.yaml file could reference.

This would keep the docker-compose file clean and allow people to easily modify the regions they connect to

This all assumes that VPN providers like Nord don't completely explode. I have Nord so I can test something like this when I get a chance

@rogs I think we could probably add a step to `yams start` command that could read from a file, convert to a string, and export a variable that the docker-compose.yaml file could reference. This would keep the docker-compose file clean and allow people to easily modify the regions they connect to This all assumes that VPN providers like Nord don't completely explode. I have Nord so I can test something like this when I get a chance
methbkts commented 2024-09-24 15:30:24 -03:00 (Migrated from gitlab.com)

The easiest way to do this is to set env_file: .env instead of environment: in your compose.yaml file and set all yours environment variables in a file named .env

The easiest way to do this is to set `env_file: .env` instead of `environment:` in your `compose.yaml` file and set all yours environment variables in a file named `.env`
MasonStooksbury commented 2024-09-24 15:35:34 -03:00 (Migrated from gitlab.com)

This is frustratingly genius. I'm gonna test this out and then write up some documentation for it

This is frustratingly genius. I'm gonna test this out and then write up some documentation for it
rogs commented 2024-09-24 20:00:32 -03:00 (Migrated from gitlab.com)

I like this solution. Let us know how it goes @MasonStooksbury!

I like this solution. Let us know how it goes @MasonStooksbury!
MasonStooksbury commented 2024-09-25 01:58:03 -03:00 (Migrated from gitlab.com)

So, I was able to get this to work and didn't have any issues. Locked my regions to just Belgium, restarted YAMS several times, and only ever got a server in Belgium.

That being said, I have some thoughts.

I think for the sake of simplicity, it makes the most sense to leave the Gluetun setup how it is. Since this will work best for most users in my opinion.

That being said, because there are those that value being able to truly make this their own, I think it would be worthwhile to add a section to the documentation on how to augment Gluetun so that you can region lock it (or do whatever you wanna do). Either by adding the SERVER_REGIONS property to the docker-compose service directly, or by modding the whole thing to use a .env file Metin suggested.

Thoughts? @methbkts @rogs

So, I was able to get this to work and didn't have any issues. Locked my regions to just Belgium, restarted YAMS several times, and only ever got a server in Belgium. That being said, I have some thoughts. I think for the sake of simplicity, it makes the most sense to leave the Gluetun setup how it is. Since this will work best for most users in my opinion. That being said, because there are those that value being able to truly make this their own, I think it would be worthwhile to add a section to the documentation on how to augment Gluetun so that you can region lock it (or do whatever you wanna do). Either by adding the SERVER_REGIONS property to the docker-compose service directly, or by modding the whole thing to use a .env file Metin suggested. Thoughts? @methbkts @rogs
rogs commented 2024-09-25 08:20:00 -03:00 (Migrated from gitlab.com)

Changing everything to use the .env file by default should be the way to go. Do you want to tackle this one or do you want me to do it on the hardlink-by-default PR that's coming soon ™️? I'm fine either way 👍

Just a sidenote, if you are doing this we'll merge it after my PR (or even better, I'll base my PR on it).

Changing everything to use the `.env` file by default should be the way to go. Do you want to tackle this one or do you want me to do it on the hardlink-by-default PR that's coming soon :tm:? I'm fine either way :thumbsup: Just a sidenote, if you are doing this we'll merge it after my PR (or even better, I'll base my PR on it).
MasonStooksbury commented 2024-09-25 09:10:26 -03:00 (Migrated from gitlab.com)

@rogs I think it makes more sense to probably bundle it into the PR you're already working on. But if you'd rather me go ahead and do it now, I'd be happy to get that out today

@rogs I think it makes more sense to probably bundle it into the PR you're already working on. But if you'd rather me go ahead and do it now, I'd be happy to get that out today
rogs commented 2024-09-25 09:11:16 -03:00 (Migrated from gitlab.com)

No worries @MasonStooksbury! I can add it to the PR I have now 👍 Thank you for helping with the investigation!

No worries @MasonStooksbury! I can add it to the PR I have now :thumbsup: Thank you for helping with the investigation!
MasonStooksbury commented 2024-09-25 09:16:58 -03:00 (Migrated from gitlab.com)

No problem!

Would it make more sense to close this issue and make a new one for converting everything to use a .env file? Just to keep things clean and obvious?

No problem! Would it make more sense to close this issue and make a new one for converting everything to use a .env file? Just to keep things clean and obvious?
rogs commented 2024-09-25 09:22:16 -03:00 (Migrated from gitlab.com)

Yes, that makes sense! I'm closing this issue, can you create the new one? Thanks!

Yes, that makes sense! I'm closing this issue, can you create the new one? Thanks!
rogs (Migrated from gitlab.com) closed this issue 2024-09-25 09:22:18 -03:00
MasonStooksbury commented 2024-09-25 11:39:47 -03:00 (Migrated from gitlab.com)

Sorry, had to take care of something. Creating the new one now

Sorry, had to take care of something. Creating the new one now
MasonStooksbury commented 2024-09-25 11:47:56 -03:00 (Migrated from gitlab.com)

mentioned in issue #37

mentioned in issue #37
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rogs/yams#36
No description provided.