azinchen/nordvpn

RECREATE_VPN_CRON not working

acountrec opened this issue · 2 comments

Hi,
Not sure if you still update this, but the recreate does not work in a compose file? I haven't tested it in a docker run command but assume it not to be a difference.

here is my compose file

version: "3"
services:
  vpn:
    image: azinchen/nordvpn
    container_name: vpn
    network_mode: bridge        # Required
    cap_add:
      - NET_ADMIN               # Required
      # - SYS_MODULE              # Required for TECHNOLOGY=NordLynx
    devices:
      - /dev/net/tun            # Required
    environment:                # Review https://github.com/bubuntux/nordvpn#environment-variables
      - USER=user
      - PASS=password         # Required
      - RECREATE_VPN_CRON="*/5 * * * *"
      - RANDOM_TOP=1000
    restart: always

  autosel:
    build: .
    container_name: pypy
    command: python ./AutoSel.py
    network_mode: service:vpn
    depends_on:
      - vpn
    restart: always
    volumes:
      - C:/Users/acoun/PycharmProjects/PointsPrizes:/usr/src/app

Hi @acountrec ,

Yes, this image is still well maintained ;)

The " symbol is not a string delimiter in compose file. Remove it from defining RECREATE_VPN_CRON environment variable.

...
      - RECREATE_VPN_CRON=*/5 * * * *
...

Tested on my environment, the VPN connection has restarted every 5th minute.

In addition, I think RANDOM_TOP=1000 is not a good idea. The idea of this setting is to reorder top of RANDOM_TOP servers from the list of filtered and sorted servers and connect to the first one (or to the next one if the appropriate config file has been removed manually from /ovpn folder). I prefer to set this setting to 10.

Closed outdated issue.