Sysadmin > VarnIsh > SolarisVarnishManifest

Solaris 10 Manifest for Varnish

root@host:/var/svc/manifest/network> cat  http-varnish.xml
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
    Copyright 2011 Stephan Pietzko http://s2p.de/Sysadmin.  All rights reserved.
    Use is subject to license terms.

    ident       "@(#)http-varnish.xml   1.3     10/11/08 SMI"
-->

<service_bundle type='manifest' name='varnish'>

<service
        name='network/http'
        type='service'
        version='1'>

        <!--
          Because we may have multiple instances of network/http
          provided by different implementations, we keep dependencies
          and methods within the instance.
        -->

        <instance name='varnish' enabled='false'>
                <!--
                  Wait for apache2 webserver to be started.
                -->
                <dependency name='network'
                    grouping='require_all'
                    restart_on='error'
                    type='service'>
                    <service_fmri value='svc:/network/http:apache2:default'/>
                </dependency>

                <exec_method
                        type='method'
                        name='start'
                        exec='/opt/varnish/sbin/varnishd -P /var/run/varnishd.pid -f /opt/varnish/etc/varnish/default.vcl -S /opt/varnish/etc/varnish/secret -s malloc,1G'
                        timeout_seconds='60' />

                <exec_method
                        type='method'
                        name='stop'
                        exec='/usr/bin/kill `cat /var/run/varnishd.pid`'
                        timeout_seconds='60' />

                <property_group name='httpd' type='application'>
                        <stability value='Evolving' />
                        <propval name='ssl' type='boolean' value='false' />
                </property_group>

                <property_group name='startd' type='framework'>
                        <!-- sub-process core dumps shouldn't restart
                                session -->
                        <propval name='ignore_error' type='astring'
                                value='core,signal' />
                </property_group>

        </instance>

        <stability value='Evolving' />

        <template>
                <common_name>
                        <loctext xml:lang='C'>
                                Varnish 3 reverse proxy server
                        </loctext>
                </common_name>
                <documentation>
                        <manpage title='httpd' section='8'
                                manpath='/usr/apache2/man' />
                        <doc_link name='apache.org'
                                uri='https://www.varnish-cache.org/' />
                </documentation>
        </template>
</service>

</service_bundle>

Enable this manifest

svccfg validate http-varnish.xml
svccfg import http-varnish.xml
svcs varnish
STATE          STIME    FMRI
disabled       11:30:48 svc:/network/http:varnish

The service can be started and controlled using svcadm:

svcadm enable http-varnish
svcs http:varnish
STATE          STIME    FMRI
online         11:33:36 svc:/network/http:varnish
ps -edalf | grep varnish
 0 S     root  9591     1   0  40 20        ?  22232        ? 11:33:36 ?           0:00 /opt/varnish/sbin/varnishd -P /var/
 0 S   nobody  9592  9591   0  40 20        ?  22781        ? 11:33:36 ?           0:00 /opt/varnish/sbin/varnishd -P /var/