selfhosted-apps-docker/unifi/readme.md
2022-11-07 21:37:29 +01:00

3.4 KiB

UniFi Controller

guide-by-example

logo

Purpose & Overview

Ubiquiti managment software for wifi access points and other ubiquiti hardware.

UniFi is a web based managment software for Ubiquiti devices.
It is written in Java, utilizing the Spring Framework and using MongoDB as a database.

Docker image used here is provided by linuxserver.io

Files and directory structure

/home/
└── ~/
    └── docker/
        └── unifi/
            ├── config/
            ├── .env
            └── docker-compose.yml
  • config/ - a directory where unifi stores its coniguration data
  • .env - a file containing environment variables for docker compose
  • docker-compose.yml - a docker compose file, telling docker how to run the containers

You only need to provide the files.
The directory is created by docker compose on the first run.

docker-compose

docker-compose.yml

services:
  unifi:
    image: linuxserver/unifi-controller
    container_name: unifi
    hostname: unifi
    restart: unless-stopped
    env_file: .env
    volumes:
      - ./config:/config
    ports:
      - 8443:8443
      - 3478:3478/udp
      - 10001:10001/udp
      - 8080:8080
      - 1900:1900/udp #optional
      - 8843:8843 #optional
      - 8880:8880 #optional
      - 6789:6789 #optional
      - 5514:5514/udp #optional

networks:
  default:
    name: $DOCKER_MY_NETWORK
    external: true

.env

# GENERAL
DOCKER_MY_NETWORK=caddy_net
TZ=Europe/Bratislava

#LINUXSERVER.IO
PUID=1000
PGID=1000
MEM_LIMIT=1024
MEM_STARTUP=1024

Reverse proxy

Caddy v2 is used, details here.

Caddyfile

unifi.{$MY_DOMAIN} {
        encode gzip
        reverse_proxy unifi:8443 {
                transport http {
                        tls
                        tls_insecure_skip_verify
                }
        }
}

Adoption

The controller might see your APs during initial setup, but it can not adopt them before you set your docker host IP as Override Inform Host.

  • Settings > System > Other Configuration
    Override Inform Host check the Enable checbox
  • enter docker-host IP
  • adopt devices

Some Settings

  • Old interface > Wifi > advanced settings > disable "High Performance Devices"
    When enabled it forces devices to ignore 2ghz band which obviously causes problems at range. Fucking monstrous stupidity.
  • DTIM sets to 3 for apple devices

Update

Manual image update:

  • docker-compose pull
  • docker-compose up -d
  • docker image prune

Backup and restore

Backup

Using borg that makes daily snapshot of the entire directory.

Restore

  • down the unifi container docker-compose down
  • delete the entire unifi directory
  • from the backup copy back the unifi directory
  • start the container docker-compose up -d