Skip to content
Permalink
Browse files

[system] Add a basic `nginx` system

  • Loading branch information...
mmalecki committed Jul 9, 2013
1 parent 7812dbb commit fdda9f7e806888d6d37d856bb3591e2e2f4f162b
Showing with 66 additions and 0 deletions.
  1. +28 −0 http/nginx/files/nginx-smf.xml
  2. +31 −0 http/nginx/scripts/install.sh
  3. +2 −0 http/nginx/scripts/start.sh
  4. +5 −0 http/nginx/system.json
@@ -0,0 +1,28 @@
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='network/nginx' type='service' version='0'>
<create_default_instance enabled='true'/>
<single_instance/>
<dependency name='fs' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<dependency name='net' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/network/loopback'/>
</dependency>
<dependent name='nginx' restart_on='none' grouping='optional_all'>
<service_fmri value='svc:/milestone/multi-user'/>
</dependent>
<exec_method name='start' type='method' exec='/opt/local/sbin/nginx -c /opt/local/conf/nginx.conf' timeout_seconds='60'>
<method_context working_directory='/var/log'>
<method_credential user='root' group='root'/>
<method_environment>
<envvar name='PATH' value='/usr/bin:/bin:/opt/csw/bin:/opt/local/bin'/>
</method_environment>
</method_context>
</exec_method>
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'>
<method_context/>
</exec_method>
</service>
</service_bundle>
@@ -0,0 +1,31 @@
#!/bin/sh
VERSION=1.5.2

PREFIX=/opt/local

NGINX_FILE="nginx-$VERSION.tar.gz"
NGINX_DIR="nginx-$VERSION"

PCRE_FILE="pcre-8.33.tar.gz"
PCRE_DIR="pcre-8.33"

pkgin -y install gcc-compiler gmake

# nginx requires newer PCRE
curl "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/$PCRE_FILE" -o "$PCRE_FILE"
tar -xf "$PCRE_FILE"

cd $PCRE_DIR
./configure --prefix=$PREFIX && gmake && gmake install
cd ..

# fetch and install nginx
curl "http://nginx.org/download/$NGINX_FILE" -o "$NGINX_FILE"
tar -xf "$NGINX_FILE"

cd "$NGINX_DIR"
./configure --prefix=$PREFIX && gmake && gmake install
cd ..

# install service manifest
svccfg import ../files/nginx-smf.xml
@@ -0,0 +1,2 @@
#!/bin/sh
svcadm enable network/nginx
@@ -0,0 +1,5 @@
{
"name": "nginx",
"version": "1.0.0",
"description": "nginx"
}

0 comments on commit fdda9f7

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.