Skip to content

Instantly share code, notes, and snippets.

@itaifrenkel
Created May 14, 2012 16:28
Show Gist options
  • Save itaifrenkel/2694919 to your computer and use it in GitHub Desktop.
Save itaifrenkel/2694919 to your computer and use it in GitHub Desktop.
Cloudify Tomcat recipe DSL file
// Create a new Service object and initialize it with this closure
service {
//calls setName(), setType(), etc...
name "tomcat"
type "WEB_SERVER"
numInstances 1
// context is injected automatically
def portIncrement =
context.isLocalCloud() ? context.getInstanceId()-1 : 0
// httpPort and ajpPort are injected
// from an external properties file
def currHttpPort = httpPort + portIncrement
def currAjpPort = ajpPort + portIncrement
// create a new LifeCycle object ,initialize it with the closue
// and inject the result to setLifecycle()
lifecycle {
// calls setInstall() of the LifeCycle object.
install "tomcat_install.groovy"
start "tomcat_start.groovy"
preStop "tomcat_stop.groovy"
startDetectionTimeoutSecs 240
startDetection {
//ServiceUtils import statement is injected automatically
!ServiceUtils.arePortsFree([ currHttpPort, currAjpPort ])
}
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment