17 March 2018

Unifi Controller

I have a small home/ranch network that is built on Ubiquiti hardware. An Edgerouter Lite as the entry point with Unifi switches and access points in the house and barn and shop. The barn and shop access points are linked in with a couple of Nanobeams. I use the Ubiquiti Unifi Controller to manage the Unifi components.

The Controller runs on Docker on my home workstation, a Fedora 27 based system. I do not run the Controller 24x7, only starting it periodically to check system status and do any needed updates.

The Controller runs under my user ID on the system. I use Jacob Alberty's unifi-docker image for the controller (https://hub.docker.com/r/jacobalberty/unifi/).

The shell script used to start the Controller is:

#!/bin/bash
# run unifi controller
#
# version 3
#
uUID=$(id -u)
uGID=$(id -g)
docker run --rm --init -p 8080:8080 -p 8443:8443 -p 3478:3478/udp //
   -p 10001:10001/udp -e TZ=America/Pacific //
   -e RUNAS_UID0=false -e UNIFI_UID=$uUID -e UNIFI_GID=$uGID //
   -v $PWD/unifi-vol:/unifi:Z -v $PWD/run:/var/run/unifi:Z   //
   --name unifi jacobalberty/unifi:latest

The :Z postfix on the volume settings is needed for correct selinux behaviour.  uUID and gUID pick up the user and group ID of my account at run time.

Hope this helps someone.

Brad

No comments:

Post a Comment