Skip to content

Commit

Permalink
[system] Add a basic nginx system
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecki committed Jul 9, 2013
1 parent 7812dbb commit fdda9f7
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
28 changes: 28 additions & 0 deletions http/nginx/files/nginx-smf.xml
@@ -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>
31 changes: 31 additions & 0 deletions http/nginx/scripts/install.sh
@@ -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
2 changes: 2 additions & 0 deletions http/nginx/scripts/start.sh
@@ -0,0 +1,2 @@
#!/bin/sh
svcadm enable network/nginx
5 changes: 5 additions & 0 deletions http/nginx/system.json
@@ -0,0 +1,5 @@
{
"name": "nginx",
"version": "1.0.0",
"description": "nginx"
}

0 comments on commit fdda9f7

Please sign in to comment.