UniFi Controller: Difference between revisions

From Alpine Linux
No edit summary
No edit summary
Line 1: Line 1:
{{Draft}}
{{Draft}}


= Install Prerequisites =
= Prerequisite Packages =


== OpenJDK 8 JRE ==
== OpenJDK 8 JRE ==
Line 62: Line 62:


= Service Management =
= Service Management =
Create an s6 service directory for UniFi.
<code>mkdir -p /etc/unifi/log</code>
Add the <code>run</code> script, using your favourite editor.
<code>vim /etc/unifi/run</code>
Copy and paste the following into it.
<pre>
#!/bin/ash
user='unifi'
group='unifi'
exec 2>&1
base='/srv/unifi'
if [ -d $base ]; then
    cd $base
    chown -R $user:$group .
    version=`head -1 webapps/ROOT/app-unifi/.version`
    echo "Starting UniFi Controller $version"
    exec s6-setuidgid $user java -jar lib/ace.jar start
else
    echo "Missing $base ... aborting"
    touch down
fi
</pre>
Ensure that the run script is executable:
<code>chmod 755 /etc/unifi/run</code>
Add the <code>log/run</code> script, using your favourite editor.
<code>vim /etc/unifi/log/run</code>
Copy and paste the following into it.
<pre>
#!/bin/ash
log_user='log'
exec s6-setuidgid $log_user s6-log -b n20 s1000000 t /var/log/unifi
</pre>
Ensure that the log/run script is executable:
<code>chmod 755 /etc/unifi/run</code>
Add the <code>log</code> user

Revision as of 21:25, 10 December 2017

This material is work-in-progress ...

Do not follow instructions here until this notice is removed.
(Last edited by Zoot on 10 Dec 2017.)

Prerequisite Packages

OpenJDK 8 JRE

Install openjdk8-jre from the community repository.

Edit /etc/apk/respositories and uncomment the appropriate community repository for your Alpine version:

http://host.name/alpine_version/community

Update the package cache.

apk update

Install the package.

apk add openjdk8-jre

MongoDB

Install MongoDB

apk add mongodb

s6

Install s6

apk add s6

Install UniFi Controller

Create the unifi user and group.

adduser -D -H /srv/unifi -g unifi unifi

Change to the parent folder within which you wish to install the UniFi Controller.

cd /srv

Download the generic unix archive of the VERSION you wish to install.

wget http://www.ubnt.com/downloads/unifi/VERSION/UniFi.unix.zip

Unpack the archive.

unzip UniFi.unix.zip

Rename the unpacked directory.

mv UniFi unifi

Change ownership.

chown unifi:unifi unifi

Lock down permissions.

chmod o-rwx unifi

Service Management

Create an s6 service directory for UniFi.

mkdir -p /etc/unifi/log

Add the run script, using your favourite editor.

vim /etc/unifi/run

Copy and paste the following into it.

#!/bin/ash

user='unifi'
group='unifi'

exec 2>&1

base='/srv/unifi'

if [ -d $base ]; then
    cd $base
    chown -R $user:$group .
    version=`head -1 webapps/ROOT/app-unifi/.version`
    echo "Starting UniFi Controller $version"
    exec s6-setuidgid $user java -jar lib/ace.jar start
else
    echo "Missing $base ... aborting"
    touch down
fi

Ensure that the run script is executable:

chmod 755 /etc/unifi/run

Add the log/run script, using your favourite editor.

vim /etc/unifi/log/run

Copy and paste the following into it.

#!/bin/ash

log_user='log'

exec s6-setuidgid $log_user s6-log -b n20 s1000000 t /var/log/unifi

Ensure that the log/run script is executable:

chmod 755 /etc/unifi/run

Add the log user