Unifi: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Brian Wilson (talk | contribs)
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
2023-09-09 Now using [[Vilo]] access point. Go to that page.
I use a Ubiquiti WAP and it talks Unifi.
I use a Ubiquiti WAP and it talks Unifi.
I run the controller here: https://bellman:8443/
I run the controller here: https://bellman:8443/
Line 6: Line 8:
and I can see (on Debian anyway) that MAC when the Debian system tries to connect to it.
and I can see (on Debian anyway) that MAC when the Debian system tries to connect to it.


== Dockerized ==
== History ==


2019-06-26 upgraded the AP firmware
* 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.


2019-06-26 changed from the docker config described below to one that lives in docker-compose. I had problems so I did two things: I "abandoned" the AP
== Reverse proxy ==
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
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.


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,
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.
I think the AP could not see Unifi.


This is what my ~/source/docker/docker-compose.yml looks like today:
== Adoption ==
<pre>
version: '3.7'
services:
  unifi:
    container_name: unifi
    image: jacobalberty/unifi
    environment:
      TZ: "Americas/Los_Angeles"
    network_mode: "host"
    ports:
      - "8080:8080"
      - "8443:8443"
      - "3478:3478"
      - "10001:10001"
    volumes:
      - unifi_data:/var/lib/unifi
      - unifi_log:/var/unifi/data
    restart: unless-stopped


volumes:
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)
  unifi_data:
    name: unifi_data
  unifi_log:
    name: unifi_log
</pre>


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
set-inform http://192.168.123.2:8080/inform


2018-03-21 built a systemctl file for it
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.


2017-08-16 it's now dockerized.
== Dockerization ==


Originally I ran Unifi locally so I just reused its data and log folders. Today I copied them into Docker volumes instead.
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
Here is how I copied the log files into the volume

Latest revision as of 02:33, 10 September 2023

2023-09-09 Now using Vilo access point. Go to that page.

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.