FYI Docker Compose with the NGINX behind Traefik (a different proxy)

57 views
Skip to first unread message

Mirza Arnaut

unread,
Aug 9, 2020, 2:18:24 PM8/9/20
to OpenWISP
Recently I started using OpenWRT and found out abt OpenWisp for managing my two Xiaomi/Redmi routers.
I am using a rental server for installing OpenWisp and an instance of traefik as a reverse proxy.
But since the docker version of openwisp has its own proxy, I started to fiddle with it, to get it to work and came up with this docker-compose.yaml file:


version: "3"

services
:
  dashboard
:
    image
: openwisp/openwisp-dashboard:latest
    env_file
:
     
- .env
    volumes
:
     
- ./openwisp_static:/opt/openwisp/static
     
- ./openwisp_media:/opt/openwisp/media
    depends_on
:
     
- postgres
     
- redis
     
- postfix

  controller
:
    image
:  openwisp/openwisp-controller:latest
    env_file
:
     
- .env
    depends_on
:
     
- postgres
     
- redis
     
- dashboard

  radius
:
    image
: openwisp/openwisp-radius:latest
    env_file
:
     
- .env
    depends_on
:
     
- postgres
     
- dashboard

  topology
:
    image
: openwisp/openwisp-topology:latest
    env_file
:
     
- .env
    depends_on
:
     
- postgres
     
- dashboard

  websocket
:
    image
: openwisp/openwisp-websocket:latest
    env_file
:
     
- .env
    depends_on
:
     
- dashboard

  nginx
:
    image
: openwisp/openwisp-nginx:latest
    env_file
:
     
- .env
    volumes
:
     
- ./openwisp_static:/opt/openwisp/static:ro
     
- ./openwisp_media:/opt/openwisp/media:ro
     
- ./openwisp_certs:/etc/letsencrypt
     
- ./public_html:/opt/openwisp/public_html
    networks
:
     
default:
        aliases
:
         
- dashboard.internal
         
- controller.internal
         
- radius.internal
         
- topology.internal
    depends_on
:
     
- dashboard
     
- controller
     
- radius
     
- topology
     
- websocket
    networks
:
     
- default
     
- web
    labels
:
     
- traefik.enable=true
     
- traefik.docker.network=web
     
- traefik.http.routers.openwisp_proxy.rule=Host(`wisp.example.org`)||Host(`dashboard.wisp.example.org`)||Host(`controller.wisp.example.org`)||Host(`vpn.wisp.example.org`)||Host(`topology.wisp.example.org`)||Host(`radius.wisp.example.org`)
     
- traefik.http.routers.openwisp_proxy.tls.certresolver=myresolver
     
- traefik.http.routers.openwisp_proxy.entrypoints=websecure

  celery
:
    image
: openwisp/openwisp-dashboard:latest
    environment
:
     
- MODULE_NAME=celery
    env_file
:
     
- .env
    depends_on
:
     
- postgres
     
- redis
     
- dashboard

  celerybeat
:
    image
: openwisp/openwisp-dashboard:latest
    environment
:
     
- MODULE_NAME=celerybeat
    env_file
:
     
- .env
    depends_on
:
     
- postgres
     
- redis
     
- dashboard

  postfix
:
    image
: openwisp/openwisp-postfix:latest
    env_file
:
     
- .env
    volumes
:
     
- ./openwisp_certs:/etc/ssl/mail

  freeradius
:
    image
: openwisp/openwisp-freeradius:latest
    env_file
:
     
- .env
    ports
:
     
- "1812:1812/udp"
     
- "1813:1813/udp"
    depends_on
:
     
- postgres
     
- radius
     
- dashboard

  postgres
:
    image
: mdillon/postgis:11-alpine
    environment
:
     
- POSTGRES_DB=$DB_NAME
     
- POSTGRES_USER=$DB_USER
     
- POSTGRES_PASSWORD=$DB_PASS
     
- TZ=$TZ
    volumes
:
     
- ./postgres_data:/var/lib/postgresql/data

  openvpn
:
    image
: openwisp/openwisp-openvpn:latest
    ports
:
     
- "1194:1194/udp"
    env_file
:
     
- .env
    depends_on
:
     
- postgres
    cap_add
:
     
- NET_ADMIN

  redis
:
    image
: redis:alpine

networks
:
  web
:
    external
: true
 
default:
    ipam
:
      config
:
       
- subnet: 172.42.0.0/16

The network web is the for all containers, which have a website for displaying something.
Hope this helps some people with their setup :)

Best regards
Mirza
Reply all
Reply to author
Forward
0 new messages