Skip to content

Instantly share code, notes, and snippets.

View itaifrenkel's full-sized avatar

Itai Friendinger itaifrenkel

  • Forter
  • Tel Aviv
View GitHub Profile
@itaifrenkel
itaifrenkel / gist:1875356
Created February 21, 2012 09:15
Cloudify command that bootstraps Java Spring Travel Application on Windows Azure
azure:bootstrap-app -azure-pwd 123456 -azure-svc mytraveldemo c:/cloudify/examples/azure/travel
@itaifrenkel
itaifrenkel / gist:1875363
Created February 21, 2012 09:17
Cloudify command that installs Java Spring Travel Application on Windows Azure
install-application c:/cloudify/examples/azure/travel
@itaifrenkel
itaifrenkel / tomcat_auto_scaling.groovy
Created May 8, 2012 21:24 — forked from tamirko/tomcat_auto_scaling.groovy
tomcat auto scaling (snippet)
minAllowedInstances 1
maxAllowedInstances 2
scalingRules ([ scalingRule {
serviceStatistics {
metric "Total Requests Count"
movingTimeRangeInSeconds 20
statistics Statistics.maximumThroughput
}
@itaifrenkel
itaifrenkel / DSLReader.java
Created May 14, 2012 16:24
Pseuodo code for reading a Cloudify Service POJO from a Groovy DSL file
Service parse(
String recipeFile, List<String> classpath,
Map<String, Object> properties, ServiceContext context) {
// add POJO base class, and classpath
cc = new CompilerConfiguration();
cc.setScriptBaseClass( BaseDslScript.class.getName() );
cc.setClasspathList(classpath);
// inject default imports
@itaifrenkel
itaifrenkel / Service.java
Created May 14, 2012 16:26
Cldoufi Service DSL POJO
class Service {
String name;
String type;
int numInstances;
ServiceLifecycle lifecycle;
Map<String, Object> customCommands;
}
@itaifrenkel
itaifrenkel / tomcat-service.groovy
Created May 14, 2012 16:28
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 =
plugin {
name "jmx"
className "org.cloudifysource.usm.jmx.JmxMonitor"
config([
"Total Requests Count": [
"Catalina:type=GlobalRequestProcessor,name=\"http-bio-${httpPort}\"",
"requestCount"
],
@itaifrenkel
itaifrenkel / tomcat-service.groovy
Created May 25, 2012 15:39
Tomcat scaling rule
scalingRule {
serviceStatistics {
metric "Total Requests Count"
movingTimeRangeInSeconds 20
statistics Statistics.maximumThroughput
}
highThreshold {
value 1 // request per second
AtomicLong counter = new AtomicLong(0);
// expose counter as a monitor
monitors ([
"counter" : {
return counter.get();
}])
// inject counter value
customCommands ([
scalingRule {
serviceStatistics {
metric "counter"
movingTimeRangeInSeconds 5
statistics Statistics.averageOfAverages
}