Skip to content

Instantly share code, notes, and snippets.

@wolstena
Created November 1, 2012 03:23
Show Gist options
  • Save wolstena/3991436 to your computer and use it in GitHub Desktop.
Save wolstena/3991436 to your computer and use it in GitHub Desktop.
SMF manifest for elasticsearch
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='elasticsearch'>
<service name='application/elasticsearch' 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='elasticsearch' restart_on='none' grouping='optional_all'>
<service_fmri value='svc:/milestone/multi-user'/>
</dependent>
<method_context working_directory='/opt/local/elasticsearch'>
<method_credential user='elastic' group='elastic'/>
<method_environment>
<envvar name='PATH' value='/usr/bin:/bin:/opt/csw/bin:/opt/local/bin'/>
<envvar name='ES_USER' value='elastic'/>
<envvar name='ES_GROUP' value='elastic'/>
<envvar name='ES_HEAP_SIZE' value='4096'/>
<envvar name='LOG_DIR' value='/var/log/elasticsearch'/>
<envvar name='DATA_DIR' value='/var/lib/elasticsearch'/>
<envvar name='WORK_DIR' value='/tmp/elasticsearch'/>
</method_environment>
</method_context>
<exec_method name="start" type="method" exec="/opt/local/elasticsearch/bin/elasticsearch %{min_heap} %{max_heap} -p %{pid}" timeout_seconds="60" />
<exec_method type="method" name="stop" exec=":kill" timeout_seconds="60" />
<exec_method type="method" name="refresh" exec=":kill -HUP" timeout_seconds="60" />
<property_group name="application" type="application">
<propval name="min_heap" type="astring" value="-Xms4g" />
<propval name="max_heap" type="astring" value="-Xmx4g" />
<propval name="pid" type="astring" value="/var/run/elasticsearch/elasticsearch.pid" />
</property_group>
<stability value='Evolving'/>
<template>
<common_name>
<loctext xml:lang='C'>Elasticsearch</loctext>
</common_name>
<documentation>
<doc_link name='incubator.apache.org' uri='http://www.elasticsearch.org/'/>
</documentation>
</template>
</service>
</service_bundle>
@wolstena
Copy link
Author

Shouldn't have used some of the environmental variables. Requires a modification to the elasticsearch.in.sh file. Shouldn't does set the variables is the yml file. Maybe via moustache.

PW: Use envirnment variables from manifest

if [ "x$LOG_DIR" != "x" ]; then
JAVA_OPTS="$JAVA_OPTS -Des.default.path.logs=${LOG_DIR}"
fi

if [ "x$DATA_DIR" != "x" ]; then
JAVA_OPTS="$JAVA_OPTS -Des.default.path.data=${DATA_DIR}"
fi

if [ "x$WORK_DIR" != "x" ]; then
JAVA_OPTS="$JAVA_OPTS -Des.default.path.work=${WORK_DIR}"
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment