2020-06-04 23:19:15 +00:00
|
|
|
# UniFi Controller
|
|
|
|
|
|
|
|
###### guide-by-example
|
|
|
|
|
|
|
|
![logo](https://i.imgur.com/xm6yo3I.png)
|
|
|
|
|
|
|
|
# Purpose & Overview
|
|
|
|
|
2022-08-13 20:36:00 +00:00
|
|
|
Ubiquiti managment software for wifi access points and other ubiquiti hardware.<br>
|
2020-06-04 23:19:15 +00:00
|
|
|
|
|
|
|
* [Official site](https://www.ui.com/software/)
|
|
|
|
* [Manual](https://dl.ui.com/guides/UniFi/UniFi_Controller_V5_UG.pdf)
|
|
|
|
* [linuxserver github](https://github.com/linuxserver/docker-unifi-controller)
|
|
|
|
|
2020-06-13 10:34:25 +00:00
|
|
|
UniFi is a web based managment software for Ubiquiti devices.</br>
|
2020-06-13 10:33:34 +00:00
|
|
|
It is written in Java, utilizing the Spring Framework
|
|
|
|
and using MongoDB as a database.
|
2020-06-04 23:19:15 +00:00
|
|
|
|
|
|
|
Docker image used here is provided by [linuxserver.io](https://www.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.</br>
|
|
|
|
The directory is created by docker compose on the first run.
|
|
|
|
|
|
|
|
# docker-compose
|
|
|
|
|
|
|
|
`docker-compose.yml`
|
|
|
|
```yml
|
|
|
|
services:
|
2022-08-13 20:36:00 +00:00
|
|
|
unifi:
|
|
|
|
image: linuxserver/unifi-controller
|
2020-06-04 23:19:15 +00:00
|
|
|
container_name: unifi
|
|
|
|
hostname: unifi
|
|
|
|
restart: unless-stopped
|
|
|
|
env_file: .env
|
2022-08-13 20:36:00 +00:00
|
|
|
volumes:
|
|
|
|
- ./config:/config
|
2020-06-04 23:19:15 +00:00
|
|
|
ports:
|
2022-08-13 20:36:00 +00:00
|
|
|
- 8443:8443
|
2020-06-04 23:19:15 +00:00
|
|
|
- 3478:3478/udp
|
|
|
|
- 10001:10001/udp
|
|
|
|
- 8080:8080
|
2022-08-13 20:36:00 +00:00
|
|
|
- 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
|
2020-06-04 23:19:15 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
`.env`
|
|
|
|
```bash
|
|
|
|
# GENERAL
|
2022-08-13 20:36:00 +00:00
|
|
|
DOCKER_MY_NETWORK=caddy_net
|
2020-06-04 23:19:15 +00:00
|
|
|
TZ=Europe/Bratislava
|
|
|
|
|
|
|
|
#LINUXSERVER.IO
|
|
|
|
PUID=1000
|
|
|
|
PGID=1000
|
2022-08-13 20:36:00 +00:00
|
|
|
MEM_LIMIT=1024
|
|
|
|
MEM_STARTUP=1024
|
2020-06-04 23:19:15 +00:00
|
|
|
```
|
|
|
|
|
2022-08-13 20:36:00 +00:00
|
|
|
# Adoption
|
2020-06-04 23:19:15 +00:00
|
|
|
|
2022-08-13 20:36:00 +00:00
|
|
|
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`.
|
2020-06-04 23:19:15 +00:00
|
|
|
|
2022-08-13 20:58:08 +00:00
|
|
|
* *Settings > System > Other Configuration*<br>
|
2022-08-13 20:36:00 +00:00
|
|
|
`Override Inform Host` check the Enable checbox<br>
|
2022-08-13 20:58:08 +00:00
|
|
|
* enter docker-host IP
|
|
|
|
* adopt devices
|
2022-08-13 20:36:00 +00:00
|
|
|
|
|
|
|
# Reverse proxy
|
|
|
|
|
|
|
|
Caddy v2 is used, details
|
|
|
|
[here](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/caddy_v2).</br>
|
|
|
|
|
|
|
|
`Caddyfile`
|
|
|
|
```
|
|
|
|
unifi.{$MY_DOMAIN} {
|
|
|
|
encode gzip
|
|
|
|
reverse_proxy unifi:8443 {
|
|
|
|
transport http {
|
|
|
|
tls
|
|
|
|
tls_insecure_skip_verify
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
2020-06-04 23:19:15 +00:00
|
|
|
|
|
|
|
# Update
|
|
|
|
|
|
|
|
Manual image update:
|
|
|
|
|
|
|
|
- `docker-compose pull`</br>
|
|
|
|
- `docker-compose up -d`</br>
|
|
|
|
- `docker image prune`
|
|
|
|
|
|
|
|
# Backup and restore
|
|
|
|
|
|
|
|
#### Backup
|
|
|
|
|
|
|
|
Using [borg](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/borg_backup)
|
|
|
|
that makes daily snapshot of the entire directory.
|
|
|
|
|
|
|
|
#### Restore
|
|
|
|
|
|
|
|
* down the unifi container `docker-compose down`</br>
|
|
|
|
* delete the entire unifi directory</br>
|
|
|
|
* from the backup copy back the unifi directory</br>
|
|
|
|
* start the container `docker-compose up -d`
|