Last active
February 26, 2023 17:35
-
-
Save juriansluiman/d571d9b2710a19d0d77958dddd29f662 to your computer and use it in GitHub Desktop.
Traefik 2.2 with openvpn failover with udp+tcp protocol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
networks: | |
web: | |
external: true | |
bridge: | |
external: true | |
services: | |
traefik: | |
image: traefik:v2.2 | |
container_name: traefik | |
ports: | |
- "80:80" | |
- "443:443" | |
- "1194:1194/udp" | |
networks: | |
- web | |
- bridge | |
volumes: | |
- /var/www/traefik/traefik.toml:/etc/traefik/traefik.toml:rw | |
- /var/www/traefik/acme.json:/acme.json:rw | |
- /var/www/traefik/traefik.log:/traefik.log:rw | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
restart: always | |
openvpn-udp: | |
image: kylemanna/openvpn | |
container_name: ovpn-udp | |
cap_add: | |
- NET_ADMIN | |
depends_on: | |
- "traefik" | |
networks: | |
- web | |
command: ovpn_run --proto udp | |
labels: | |
- "traefik.udp.routers.openvpn.entrypoints=openvpn" | |
- "traefik.udp.routers.openvpn.service=openvpn" | |
- "traefik.udp.services.openvpn.loadbalancer.server.port=1194" | |
volumes: | |
- openvpn:/etc/openvpn | |
restart: always | |
openvpn-tcp: | |
image: kylemanna/openvpn | |
container_name: ovpn-tcp | |
cap_add: | |
- NET_ADMIN | |
depends_on: | |
- "traefik" | |
networks: | |
- web | |
command: ovpn_run --proto tcp | |
labels: | |
- "traefik.tcp.routers.openvpn.rule=HostSNI(`*`)" | |
- "traefik.tcp.routers.openvpn.entrypoints=websecure" | |
- "traefik.tcp.routers.openvpn.service=openvpn" | |
- "traefik.tcp.services.openvpn.loadbalancer.server.port=1194" | |
volumes: | |
- openvpn:/etc/openvpn | |
restart: always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[entryPoints] | |
[entryPoints.web] | |
address = ":80" | |
[entryPoints.websecure] | |
address = ":443" | |
[entryPoints.openvpn] | |
address = ":1194/udp" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, How do I configure openvpn? If I deploy these containers. What is the next step? How to I get the .ovpn file etc?
Best,