Skip to content

Instantly share code, notes, and snippets.

View tamirko's full-sized avatar

Tamir Korem tamirko

  • www.whitesourcesoftware.com
View GitHub Profile
@tamirko
tamirko / petclinic-application.groovy
Created January 29, 2012 13:45
Application recipe
application {
name="petclinic-mongo"
service {
name = "mongod"
}
service {
name = "mongoConfig"
}
service {
name = "mongos"
@tamirko
tamirko / exposeMongosService.groovy
Created January 29, 2012 13:50
Exposing the mongos service
// In <cloudify root>/recipes/apps/petclinic/mongos/mongos_install.groovy
import com.gigaspaces.cloudify.dsl.context.ServiceContextFactory
// ...
// Getting the mongos service instance ID
instanceID = serviceContext.getInstanceId()
// Calculating the mongos port and storing it in the serviceContext for later use
// (by the service and by other services).
serviceContext.attributes.thisInstance["port"] = config.basePort+instanceID
// ...
@tamirko
tamirko / retrieveMongosServie.groovy
Created January 29, 2012 13:52
Retrieving the mongos service
import com.gigaspaces.cloudify.dsl.context.ServiceContextFactory
// ...
// Getting the tomcat service instance ID
instanceID = serviceContext.getInstanceId()
// Waiting for the mongos service for 20 seconds
mongoService = serviceContext.waitForService(config.mongoService, 20, TimeUnit.SECONDS)
// Waiting for the mongos service instances for 60 seconds (In this case,
// there's only one mongos instance, but we support more).
@tamirko
tamirko / install_app_on_cloudify.sh
Created January 29, 2012 14:02
Install application on Cloudify
install-application -timeout 10 <Cloudify root>/examples/petclinic
@tamirko
tamirko / uninstallApplicationPetclinic.sh
Created January 29, 2012 14:09
Uninstall the Pet Clinic Application
cloudify@default> uninstall-application petclinic
@tamirko
tamirko / teardownLocalcloud.sh
Created January 29, 2012 14:10
Teardown localcloud
cloudify@default> teardown-localcloud
@tamirko
tamirko / bootstrapLocalcloud.sh
Created January 29, 2012 14:28
Bootstrap localcloud
cloudify@default> bootstrap-localcloud
@tamirko
tamirko / getServiceContext.groovy
Created January 29, 2012 20:00
Get Service Context
import org.cloudifysource.dsl.context.ServiceContextFactory;
def context = ServiceContextFactory.getServiceContext()
@tamirko
tamirko / wait4Cassandra.groovy
Created January 29, 2012 20:18
Wait 4 Cassandra
def serviceName = "cassandra"
def service = context.waitForService(serviceName, 20, TimeUnit.SECONDS)
@tamirko
tamirko / serviceMethods.groovy
Created January 29, 2012 20:25
Service Methods
public String getName();
public int getNumberOfPlannedInstances();
public int getNumberOfActualInstances();
public ServiceInstance[] waitForInstances(final int howmany,
final long timeout, final TimeUnit timeUnit);
public ServiceInstance[] getInstances();