You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
3.1 KiB
Markdown

4 years ago
# UniFi Controller
###### guide-by-example
![logo](https://i.imgur.com/xm6yo3I.png)
# Purpose & Overview
2 years ago
Ubiquiti managment software for wifi access points and other ubiquiti hardware.<br>
4 years ago
* [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)
4 years ago
UniFi is a web based managment software for Ubiquiti devices.</br>
4 years ago
It is written in Java, utilizing the Spring Framework
and using MongoDB as a database.
4 years ago
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:
2 years ago
unifi:
image: linuxserver/unifi-controller
4 years ago
container_name: unifi
hostname: unifi
restart: unless-stopped
env_file: .env
2 years ago
volumes:
- ./config:/config
4 years ago
ports:
2 years ago
- 8443:8443
4 years ago
- 3478:3478/udp
- 10001:10001/udp
- 8080:8080
2 years ago
- 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
4 years ago
```
`.env`
```bash
# GENERAL
2 years ago
DOCKER_MY_NETWORK=caddy_net
4 years ago
TZ=Europe/Bratislava
#LINUXSERVER.IO
PUID=1000
PGID=1000
2 years ago
MEM_LIMIT=1024
MEM_STARTUP=1024
4 years ago
```
2 years ago
# Adoption
4 years ago
2 years ago
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`.
4 years ago
2 years ago
* *Settings > System > Other Configuration*<br>
2 years ago
`Override Inform Host` check the Enable checbox<br>
2 years ago
* enter docker-host IP
* adopt devices
2 years ago
# 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
}
}
}
```
4 years ago
# 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`