Skip to content

Instantly share code, notes, and snippets.

@siepkes
Created June 28, 2020 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save siepkes/895aec2886cec8b1c40d42e932c64500 to your computer and use it in GitHub Desktop.
Save siepkes/895aec2886cec8b1c40d42e932c64500 to your computer and use it in GitHub Desktop.
Keycloak SMF
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='keycloak'>
<service
name='network/keycloak'
type='service'
version='1'>
<create_default_instance enabled='false' />
<single_instance />
<dependency
name='fs'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/filesystem/minimal' />
</dependency>
<dependency
name='network_initial'
grouping='optional_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/network/routing-setup:default' />
<service_fmri value='svc:/network/initial:default' />
</dependency>
<dependency
name='network_ipfilter'
grouping='optional_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/network/ipfilter:default' />
</dependency>
<!-- Use a timeout of '0' because Keycloak (Wildfly) doesn't detach itself from the console. -->
<exec_method
type='method'
name='start'
exec='/opt/keycloak/bin/standalone.sh --server-config=standalone-ha.xml -Djboss.http.port=80 -Djboss.https.port=443 -Djboss.bind.address=0.0.0.0'
timeout_seconds='0'>
<method_context working_directory="/opt/keycloak">
<!-- Allow keycloak to use the privileged ports (TCP 80 and 443 for HTTP and HTTPS). -->
<method_credential
user='keycloak'
group='keycloak'
privileges='basic,net_privaddr' />
<method_environment>
<envvar name="JAVA_HOME" value="/opt/local/java/openjdk11" />
</method_environment>
</method_context>
</exec_method>
<exec_method
type='method'
name='refresh'
exec=':kill -HUP'
timeout_seconds='0'>
</exec_method>
<!-- Sending an interrupt signal (SIGINT) gracefully stops Keycloak (Wildfly). -->
<exec_method
type='method'
name='stop'
exec=':kill -INT'
timeout_seconds='60'>
</exec_method>
<!-- keycloak does not detach from the console (ie. does not daemonize). -->
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='child' />
</property_group>
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang='C'>
Keycloak (running on Wildfly)
</loctext>
</common_name>
</template>
</service>
</service_bundle>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment