Skip to content

Instantly share code, notes, and snippets.

@Licenser
Last active June 14, 2020 17:11
Show Gist options
  • Save Licenser/9c9de420298811b536f2 to your computer and use it in GitHub Desktop.
Save Licenser/9c9de420298811b536f2 to your computer and use it in GitHub Desktop.
unifi-smartos
cd /opt/local/
curl -O http://dl.ubnt.com/unifi/4.6.3/UniFi.unix.zip
pkgin install mongodb-2.6.7 unzip openjdk7 git gmake gcc47 apache-maven javacc
unzip UniFi.unix.zip
cd UniFi
rm bin/mongod
ln -s /opt/local/bin/mongod /opt/local/UniFi/bin/
## The snappy library isn't working on Solaris/SmartOS here is how to get a new one.
git clone https://github.com/xerial/snappy-java.git
cd snappy-java
## yes wrong version but it works!
git checkout 1.1.1.7
export JAVA_HOME=/opt/local/java/openjdk7
## This too is kind of ugly but it works (yes twice!)
cp target/snappy-java-1.1.1.7.jar /opt/local/UniFi/lib/
cp target/snappy-java-1.1.1.7.jar /opt/local/UniFi/lib/snappy-java-1.0.5.jar
#!/bin/sh
## Goes to: /opt/local/lib/svc/method/unifi
. /lib/svc/share/smf_include.sh
case "$1" in
'start')
cd /opt/local/UniFi
/opt/local/bin/java -jar lib/ace.jar start &
;;
'stop')
cd /opt/local/UniFi
/opt/local/bin/java -jar lib/ace.jar stop
;;
*) echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit $SMF_EXIT_OK
{
"autoboot": true,
"brand": "joyent",
"image_uuid": "24648664-e50c-11e4-be23-0349d0a5f3cf",
"indestructible_zoneroot": true,
"max_physical_memory": 1024,
"cpu_cap": 100,
"alias": "unifi",
"hostname": "unifi",
"quota": "40",
"resolvers": [
"8.8.8.8",
"8.8.4.4"
],
"nics": [
{
"interface": "net0",
"nic_tag": "admin",
"ip": "192.168.0.250",
"gateway": "192.168.0.1",
"netmask": "255.255.255.0"
}
]
}
<!-- goes to: /opt/local/lib/svc/manifest/unifi.xml -->
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='unifi:default'>
<service name='network/unifi' type='service' version='4.6.3'>
<create_default_instance enabled='false' />
<single_instance />
<dependency name='Network' grouping='require_all'
restart_on='none' type='service'>
<service_fmri value='svc:/milestone/network:default' />
</dependency>
<exec_method type='method' name='start'
exec='/opt/local/lib/svc/method/unifi start'
timeout_seconds="60" />
<exec_method type='method' name='stop'
exec='/opt/local/lib/svc/method/unifi stop'
timeout_seconds="60" />
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang='C'>UniFi</loctext>
</common_name>
<documentation>
<doc_link name='homepage' uri='https://www.ubnt.com/enterprise/' />
</documentation>
</template>
</service>
</service_bundle>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment