5 // This file and its contents are supplied under the terms of the
6 // Common Development and Distribution License ("CDDL"), version 1.0.
7 // You may only use this file in accordance with the terms of version
10 // A full copy of the text of the CDDL should have accompanied this
11 // source. A copy of the CDDL is also available via the Internet at
12 // http://www.illumos.org/license/CDDL.
15 // Copyright 2016-2018 by Jim Klimov
18 <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
19 <service_bundle type='manifest' name='jenkins-standalone'>
26 Because we may have multiple instances of network/http
27 provided by different implementations, we keep dependencies
28 and methods within the instance.
31 <instance name='jenkins' enabled='false'>
33 Note that while there may be automated deployments of Jenkins
34 managed as a web-application in a container like Tomcat, it
35 would likely not be a separate SMF service, so names are not
36 likely to collide - while this shorthand default is convenient.
40 Wait for network interfaces to be initialized.
42 <dependency name='network'
43 grouping='require_all'
46 <service_fmri value='svc:/milestone/network:default'/>
50 Wait for all local filesystems to be mounted.
52 <dependency name='filesystem-local'
53 grouping='require_all'
57 value='svc:/system/filesystem/local:default'/>
61 Wait for automounting to be available, as we may be
62 serving data from home directories or other remote
65 <dependency name='autofs'
66 grouping='optional_all'
70 value='svc:/system/filesystem/autofs:default'/>
73 <!-- TODO: Wrap this in a script? There are many possible CLI options to consider,
74 both for JAVA and the JAR itself... Or keep it simple? -->
75 <exec_method type='method'
77 exec='/usr/bin/java -DsessionTimeout=%{httpd/sessionTimeout} -DsessionEviction=%{httpd/sessionEviction} -jar %{httpd/jenkins_war_file} --httpPort=%{httpd/httpPort} --httpListenAddress=%{httpd/httpHost} --webroot=%{httpd/jenkins_war_dir} &'
78 timeout_seconds='240'>
80 <method_credential user='jenkins' group='jenkins' privileges='basic,net_privaddr'/>
81 <!-- TODO: Configure these by properties? See also a wrap-script TODO above -->
83 <envvar name='JENKINS_HOME' value='/var/lib/jenkins/home'/>
84 <envvar name='LIBZFS4J_ABI' value='openzfs'/>
89 <!-- Note: Jenkins has a CLI and scriptable REST API that can e.g. schedule
90 a graceful exit, after all running jobs are finished (and blocking
91 creation of new executions), or to do an immediate exit. If a wrapper
92 script is made for the SMF methods, use of this should be an option.
93 Otherwise, handling of SIGTERM is also graceful, though abrupt :)
95 <exec_method type='method'
100 <method_credential user='jenkins' group='jenkins' />
104 <!-- At the bare minimum, we want to restart and redeploy the WAR file and
105 its Jetty container when the service is refreshed (e.g. package update).
106 So we just kill it (if running) and hope SMF restart would do the rest.
108 <exec_method type='method'
111 timeout_seconds='60'>
113 <method_credential user='jenkins' group='jenkins' />
117 <!-- Note: the jenkins.war startup options are documented at:
118 https://wiki.jenkins-ci.org/pages/viewpage.action?pageId=73533946
119 Parameters not recognized by the WAR are passed to Winstone container:
120 http://winstone.sourceforge.net/#commandLine
121 If you plan to shield the Jenkins application server by a reverse proxy
122 like nginx, apache mod_proxy, etc. running in the same zone - consider
123 setting httpHost=127.0.0.1 below. Conversely, to run Jenkins as "the"
124 webserver in this operating environment, note that this SMF service is
125 sufficiently privileged to use httpPort numbers under 1024 (e.g. 80).
127 <property_group name='httpd' type='application'>
128 <stability value='Evolving' />
129 <propval name='httpPort' type='count' value='8080' />
130 <propval name='httpHost' type='astring' value='0.0.0.0' />
131 <propval name='jenkins_war_file' type='astring' value='/usr/share/jenkins/war/jenkins.war' />
132 <!-- Directory into which Jetty webserver would unpack the WAR file -->
133 <propval name='jenkins_war_dir' type='astring' value='/var/lib/jenkins/standalone-war' />
134 <!-- There are two options in winstone server, one for overall
135 session duration (remember me), another for session-eviction
136 after a window/tab with Jenkins was closed in browser -->
137 <propval name='sessionTimeout' type='count' value='1440' />
138 <propval name='sessionEviction' type='count' value='1440' />
141 <property_group name='startd' type='framework'>
142 <!-- sub-process core dumps shouldn't restart
144 <propval name='ignore_error' type='astring'
145 value='core,signal' />
146 <propval name='duration' type='astring' value='contract' />
151 <loctext xml:lang='C'>Jenkins CI - standalone service</loctext>
157 <stability value='Evolving' />