Skip to content

Instantly share code, notes, and snippets.

View ahgittin's full-sized avatar

Alex Heneveld ahgittin

View GitHub Profile
BrooklynServerDetails details = BrooklynLauncher.newLauncher().
// to add a custom webapp
webapp("/cdh", "classpath://brooklyn-cdh-frontend.war").
webconsolePort(CommandLineUtil.getCommandLineOption(args, "--port", "8081+")).
launch();
// then things below linked to buttons / etc in app
// get the mgmt context (and also the webconsole URL) from this details container
ManagementContext mgmt;
@ahgittin
ahgittin / brooklyn-rebinding-notes.txt
Created September 20, 2012 09:58
Brooklyn RebindLocation notes, general mechanism for persistence and revivification
Rebindable (Entity)
- REBINDING_STATUS sensor -> empty (not rebinding), REBINDING, COMPLETED, FAILED
- getRebindLocationGenerator() -> returns a generator suitable for rebinding this entity
(where the generator produces a RebindLocation initially, but might also produce json/xml;
and allow interrogation about whether all descendents etc are rebindable)
RebindLocation {
/** takes no action but says whether it can rebind */
boolean canRebind(Entity);
/** sets config & sensors on entity, returns the locations where the entity should proceed to start
@ahgittin
ahgittin / pss
Last active October 10, 2015 18:47
script to quickly list find and kill processes
#/bin/bash
help() {
echo "pss [command [option]]+ -- quickly list, find and kill processes"
echo "commands:"
echo " h -- help"
echo " g X -- grep X"
echo " gi X -- grep -i X (ignore case)"
echo " gv X -- grep -v X (show non-matching)"
echo " g2 X Y -- grep for X or Y (also g3, g4)"
echo " k -- kill"
@ahgittin
ahgittin / jstack-active
Created September 16, 2012 22:19
script to run jstack but just show those threads which are active ... a poor man's profiler, or how to make eclipse beach ball slightly more exciting :)
#!/bin/bash
jstack $@ | awk '
function onTraceBegin() {
onTraceEnd()
data["lineCount"]=0
data["head"]=$0
}
function onTraceEnd() {
if ("head" in data) {
@ahgittin
ahgittin / brooklyn-dependent-entity-config.json
Created July 26, 2012 15:18 — forked from andreisavu/brooklyn-dependent-entity-config.json
Suggestions from Alex for Brooklyn dependent entitiy configuration
{
"name":"web-and-db",
"entities":[{
"type":"brooklyn.entity.webapp.ElasticJavaWebAppService",
"config":{
"java.options":{
"type":"Map",
"operation":"put",
"values":{
"brooklyn.example.db.url":{
@ahgittin
ahgittin / gist:2949025
Created June 18, 2012 15:48
hpcloud and openstack testing
new ComputeServiceContextFactory().createContext("hpcloud-compute",
keyId, credential). getComputeService(). listNodes();
gives:
ERROR java.util.NoSuchElementException:
apiType compute not found in catalog [{type=identity, name=Identity, endpoints=[{versionId=2.0, region=region-a.geo-1, publicURL=https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/, internalURL=null, adminURL=null, tenantId=null, versionInfo=https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/, versionList=https://region-a.geo-1.identity.hpcloudsvc.com:35357}]}]
@ahgittin
ahgittin / _notes.md
Created May 23, 2012 07:36
Inside the DevOps Toolshed

GLUECON CLOUDSOFT WORKSHOP SETUP

IF THE GODS OF WEB ARE SMILING

The preferred installation is when you have good internet links:

  • Fork, clone, and/or download from github.com
@ahgittin
ahgittin / thoughts.md
Created May 21, 2012 16:56
Gluecon setup

USB stick

  • maven repo
  • brooklyn repository (jboss, etc)
  • git projects (anonymous http, with history; and showing URL - jclouds-examples, brooklyn, whirr)
  • binaries
  • whirr
  • brooklyn
  • this doc
@ahgittin
ahgittin / java test
Created April 25, 2012 12:10
jclouds hang bug
@Test
public void createVm() {
String groupId = "mygroup-"+System.getProperty("user.name")+"-"+UUID.randomUUID().toString();
Properties properties = new Properties();
properties.setProperty(Constants.PROPERTY_PROVIDER, "aws-ec2");
properties.setProperty(Constants.PROPERTY_IDENTITY, identity);
properties.setProperty(Constants.PROPERTY_CREDENTIAL, credential);
properties.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, Boolean.toString(true));
properties.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, Boolean.toString(true));
@ahgittin
ahgittin / gist:2405339
Created April 17, 2012 11:15
brooklyn rest json sample 1
{ "app": {
"name": "MyWebCluster",
"entities": [
{ "name": "web",
"type": "ControlledDynamicWebAppCluster",
"config": {
"war": "classpath://hello-world-webapp.war",
"httpPort": "8080+",
"jvmOpts": {
"brooklyn.example.db.url": { "source": { "entity": "mysql", "sensor": "url" } }