Unifi

From Bellman
Jump to navigation Jump to search

I use a Ubiquiti WAP and it talks Unifi. I run the controller here: https://bellman:8443/ and I have a page on its features Presence detection

My access point's MAC is 80:2a:a8:90:cd:65 and I can see (on Debian anyway) that MAC when the Debian system tries to connect to it.

History

  • 2020-01-02 upgraded the AP firmware 4.0.69
  • 2020-01-01 rebuild the docker container with new Unifi and readopted the AP
  • 2019-06-26 upgraded the AP firmware 3.something
  • 2019-06-26 changed from the docker config described below to one that lives in docker-compose.
  • 2019-02-20 removed systemctl files and changed to using 'restart'. Moved to the volumes documented below, used to use system files in /var/log/unifi and /home/unifi. Removed port 8080
  • 2018-03-21 built a systemctl file for it
  • 2017-08-16 it's now dockerized.

Reverse proxy

Running the usual reverse proxy set up that I use does not work with Unifi because it does an automatic REDIRECT from port 8080 to port 8443. Then the certs are wrong.

And the other problem is that adoption does not work if Unifi is running on a Docker network. It has to be on the host network.

Adoption

After the docker-compose shift I had problems seeing the AP so I did two things: I "abandoned" the AP and readopted it. I used ssh to connect to the AP (same user/pass as unifi) and issued this command (once before and once after adoption in Unifi)

set-inform http://192.168.123.2:8080/inform

I also changed the network mode in Unifi docker to network-mode: "host" and restarted it. I think this might actually be what did the trick, I think the AP could not see Unifi even with all the ports exposed.

Dockerization

Originally I ran Unifi locally so I just reused its data and log folders. Eventually I copied them into Docker volumes instead.

Here is how I copied the log files into the volume

cd /var/log/unifi
docker run -v unifi_data:/data busybox helper
docker cp . helper:/data
docker stop helper
docker rm helper

When I started it up it migrated my old database to the 5.5 version of UniFi. It was able to successfully detect my UniFi AP and updated its IP address to my new address scheme and then provisioned it. EXCELLENT.

See https://hub.docker.com/r/jacobalberty/unifi/

docker volume create unifi_data
docker volume create unifi_logs
docker run -d --dns=192.168.123.2 -p 8443:8443 -p 3478:3478 -p 10001:10001 -e TZ='Americas/Los_Angeles' \
-v unifi_data:/var/lib/unifi -v unifi_logs:/var/log/unifi --name=unifi jacobalberty/unifi
docker update --restart always unifi

Troubleshooting

Watch the daemon.log on Bellman and you can watch devices try to associate with the WAP.