Head in the clouds presentation

At the May meetup of the Melbourne Java and JVM users group, I gave a presentation on how to get a build life cycle up and running using cloud based tools.

This post contains the slides as well as my notes on how to do the demo walkthrough.

First we need something to run

In the demo we need something we can deploy and get working, so lets try and use a Sample ROO application that gives us some basic Spring and Hibernate.

roo.sh script –file $ROO_HOME/samples/clinic.roo

This should give us a simple webapp that we can now quickly and easily launch with Jetty.

mvn jetty:run

Lets take a look at what the application is, notice it has some persistence, but running on hsql.

Before we can get builds and deployments in the cloud, we first need the ……

Source Code in the Cloud

All repositories are remote, so its not a big deal, but as a cornerstone of Cloud development we need our code accessible from anywhere, and so in this case I will use github to create a repo to store this app:

  1. Create Github Repo
  2. Init local repo
  3. Add remote
  4. Push repo remote
  5. Show commit in github UI.

So now that we have the code in the cloud, lets get to the interesting parts.

Lets work on first getting our code….

Building in the Cloud

Cloudbees are a major sponsor of the Jenkins project, and offer a solution called DEV@Cloud which offers in cloud hosted Jenkins installs.

  1. Create new Jenkins job.
  2. Configure repo from github
    1. Use http method
    2. Remove stevemac@

So now we have the code there and it builds, but this is probably not much than we are already used to.

Now it’s time to setup our …

Hosting in the Cloud

This is probably what we all came to see, and I’m sorry to say that it’s been made really easy.

Let’s start with the fully manual process.

mvn package

  1. Log onto cloudbees control panel
  2. Create a new application
  3. Browse to upload WAR file
  4. Demo the site running.

At this point we have completed the brief, we have code and builds and deployment in the cloud, but its still a little bit disjointed.

Lets take the next step and connect some dots.

Scripted deployments to the Cloud

Again the guys at CloudBees have done lots of the heavy lifting, they have a maven plugin that helps automate the deployment process.

<build>
	<finalName>myapp</finalName>
	<plugins>
		<plugin>
			<groupId>com.cloudbees</groupId>
			<artifactId>bees-maven-plugin</artifactId>
			<version>1.2.2</version>
		</plugin>
	</plugins>
</build>

<pluginRepositories>
	<pluginRepository>
		<id>bees-plugins-releases</id>
		<url>http://repository-cloudbees.forge.cloudbees.com/public-release/</url>
		<releases>
			<enabled>true</enabled>
		</releases>
		<snapshots>
			<enabled>false</enabled>
		</snapshots>
	</pluginRepository>
</pluginRepositories>

Now that we have this installed, we can use the ‘bees’ goals to control our application. Its quick and easy to deploy changes.

Lets make a change to the app so we know its deployed.

  1. Open project in eclipse
  2. Edit index page add some text.
mvn bees:deploy -Dbees.apikey=<apikey> -Dbees.secret=<secret> -Dbees.appid=stevemac/XXX

These values shown here are the api-key and secret supplied by cloudbees, and the appid we previously setup.

We now should see on our new application with changes.
We now have all the moving pieces, and a repeatable deployment, but what would be great is…

Continuous Deployment in the Cloud

Lets take this application the next step.

We now have local changes that are deployed to our test server, but there is no guarentee that the build and application are repeatable, we really should be deploying from our source repository, not developer machines.

So lets make that happen.

The custom Jenkins install offered by CloudBees contains a really nice option to enable deploying to cloudbees on successful builds.

  1. Enable the option
  2. Make another change to application
  3. Add and Commit to git
  4. Push changes
  5. Watch build occur


Now we have full roundtrip development, from developer desktop, through source control, build and test server and deployed out to hosting.

So now that we know we have a full build pipeline, but notice, the application is still pretty useless, it still runs the embedded HSQL and so on each re-deployment we lose our information.

Let’s upgrade the product to use an external database, but where will it be but….

MySQL hosted in the Cloud

Please don’t take this as an advertisement for CloudBees, but they were the first provider I found that offered the full stack for FREE that I could test out.

First we need a database to store our information on

  1. Login to cloudbees control console
  2. Create cloudbees mysqldb
  3. Open MySQL browser and login


Now we need to upgrade the application with the settings

  1. Update the persistence.xml
  2. Update the applicationContext
  3. Update web.xml
  4. Create cloudbees.xml file

Persistence.xml

<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>

ApplicationContext.xml

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
	<property name="jndiName">
		<value>java:comp/env/jdbc/melbjvm</value>
	</property>
</bean>

Web.xml

<resource-ref>
	<res-ref-name>jdbc/melbjvm</res-ref-name>
	<res-type>javax.sql.DataSource</res-type>
	<res-auth>Container</res-auth>
</resource-ref>

Cloudbees.xml

<cloudbees-web-app>
	<appid>stevemac/melbjvm</appid>
	<resource name="jdbc/melbjvm" auth="Container" type="javax.sql.DataSource">
		<param name="username" value="melbjvm" />
		<param name="password" value="melbjvm" />
		<param name="url" value="jdbc:cloudbees://melbjvm" />
	</resource>
</cloudbees-web-app>

Now you don’t want to have to push to production to test it, it would be great to be able to run this locally and make sure we have it all right first wouldn’t it.

So lets do that, the CloudBees plugin allows you to run a Tomcat container using these configurations locally.

mvn bees:run

Add now we can see in the MySQL browser the database has been created.

So let’s check in all these changes and let the application be deployed.

  1. Git add,
  2. commit,
  3. and push
  4. Watch build

But our tests fail

I know they do, so (being naughty) I’m just going to skip them, kick off the build again and watch it deploy.

 

Thats pretty much the demo

If we have time, show off Jelastic, at least the application control panel.

 

How to Setup Jelastic

Build plugin

<plugin>
<groupId>com.jelastic</groupId>
<artifactId>jelastic-maven-plugin</artifactId>
<version>1.7-SNAPSHOT</version>
<configuration>
<email>${jelastic.username}</email>
<password>${jelastic.password}</password>
<context>ROOT</context>
<environment>melbjvm</environment>
<comment>${buildNumber}</comment>
<api_hoster>app.jelastic.servint.net</api_hoster>
</configuration>
</plugin>

<pluginRepository>
<id>sonatype-oss-public</id>
<url>https://oss.sonatype.org/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>

Scrum, Story Telling and Blue Rocks

So I started thinking that I needed to find something to focus my writing on, I spend talking about solutions to lots of different problems, but unless you are heavy into ERP systems, Accounting Journals or Costing Methods you’d probably get bored very quickly.

But that’s not all I work at, you see I AM currently working for a company that’s building an ERP solution, but thats the what, not the how.  And I think its the how that is much more interesting.

I want to try and start to write about how we do the software development, and when I started thinking about where to start I looked at some of the biggest questions we are still yet to understand.  You see I’ve been a developer for 13+ years now, and its only recently that I’ve been with a company where the development team is larger than 2.

Most places I’ve worked it’s be me and someone else, and we just battle through to get the work done as fast and as good as we could do, and anything we missed, we went back and fixed, and anything that didn’t work, we worked out and then fixed, and anything that wasn’t asked for (but needed) we would work out and do.

Not a lot of process, and even less structure.

I can’t say the current team is much larger, but its getting there.  Currently 5 in the development team, a few more when you rope in the User Experiance and Design staff.

If things go the right way we’ll have even more soon, so I know I’m rambling, but what I’m getting to is process.  I don’t have a really solid, tried and tested process that extends well beyond a 2-3 man team, and we need one.

So I’m going to try and use my blog as a place to pose some questions and issues we have with software development, take some time to discuss the solutions we have proposed, and review research by others online.

We currently use a “sort of” Scrum process, we hide behind things like, “we write stories not specs”, and “things need to be small enough to fit into the sprint”, but I keep feeling that we really don’t “get it”…  I want to try and take some time to do some research into a Scrum process, and try and hash out how we can make it work within the four walls of our office.

So that’s the plan, over the next few weeks I’m going to try and write about one aspect of our current process, or a general software development area, and try and see how different solutions may solve the problem.

But what does this all have to do with Blue Rocks you say, (the title of the post… look up the top there if you missed it).

We have a story in the office about writing specs, we all come from processes where the specs were very sparse, and we all have our own way of filling in the gaps. This is becoming a major failing in our process.

The “Blue Rocks” referes to a question often thrown around as an example to highlight how vague a requirement is. “If we all had to go and get a blue rock, and I bet we would all come back with something different”. So my first task is to do a bit more research into the Scrum process of defining Stories, what make good stories, what types don’t work, and how do we all write better ones.

 

Google+ engagement

So I’ve been on Google+ for a few months now, as the rest of us have been, and I’m still not sure what to make of it.  I do find lots more interesting things here, and I think its mostly that I get a preview of what the content is instead of just a link (ala Twitter)

and while I’m basically a nobody, with <200 followers on both Twitter and Google+ I still don’t feel I get it.

See I’m a nerd at heart, love discussing technology and the like, and love the community that exists around technology online, but I still can’t seem to find my feet when it comes to engaging people.  I find that I mostly post about the footy, my family or the most boring of days events.

I really want to post things about a new password routine I’ve been working on, or my thoughts on a new framework or library that I’ve been looking into, but I either don’t seem to find the time, or feel that if I get too nerdy my current followers will disappear and then I’ll just be talking to myself.

But Google+ does seem to be different.  Seeded with the Googlers, the conversations I’m seeing (apart from the animated GIF’s) do seem to trend more technical, and so it might be time to dust of my typing cap, get some new posts on this hear blog, and get some truly nerdy engagement happening via google+.

I really do like the fact I can post this rant here, on MY blog, retain MY postings, but still offer it into the Google+ melting pot.  It will probably get lost in everybody’s time line, but atleast a share on Google+ offers the user a snippet of what the post is about instead of a vanilla link (Twitter again) that could lead to who knows where.

 

links for 2011-04-07

links for 2010-08-22

Twitter Updates for 2010-02-18

  • Damn power goes out and the 'puter turns off. What can I do with no power. At least its back now and can get my 'puter fix. #
  • @AdamHalo Nah, just was scared for a sec and thought one of the machines had a fried nic, but a bit of a kick and it came back to life. in reply to AdamHalo #
  • Missed my run this morning due to crappy weather. Hopefully its a better tonight and I can get it in before dark, otherwise it's Sat morn. #
  • @AdamHalo Ok, that make sense. Rach has decided to take on the install herself. The're roller blinds inside the frames, so should be easy. in reply to AdamHalo #