I’ve re-deployed my demos. This is more interesting than it sounds, well I hope it is anyway. I’ve already posted about each of them. This is about the pain of getting them up there and running in the cloud.
Long ago I had them running on CloudFoundry and they worked fine, then the CloudFoundry business model changed and their free option went away. Since I make no money from this stuff the demo site has to be free, so I went to AppFrog who were running the same CloudFoundry software and they lived there for a while…until the same thing happened.
Recently, after completing the Workflow project, I had some free time so I thought I’d try and get them going on Google Application Engine. But I gave up on that yesterday (yes, it was only yesterday) and loaded them onto OpenShift (Red Hat’s cloud offering). They worked first time. It was so easy. I was surprised.
The reason I was surprised was that it was so very hard to do Google Application Engine. There were two main issues.
First, GAE doesn’t like Logback, which is a commonly used logging mechanism and I use it everywhere (because commonly used means it should work everywhere, right?) GAE only likes JUL and no one I know uses JUL. JUL is the native Java logging mechanism and it is the reason for products like Logback, ie people hate JUL and want something else.
But switching to JUL was not a big deal. I wouldn’t want to have to work with it, but these demos are already debugged so that’s mostly okay.
Next GAE needs lots of classes to be serializable so it can flick sessions between servers. I see the sense of this and I went off and made all my classes serializable. It didn’t take very long, actually. Of course I tried it out using GAE’s Eclipse plugin to make sure it was working and it was.
But when I deployed it for real it complained of more classes that needed to be serializable. However these aren’t my classes, they’re libraries from other people. Spring etc. I can’t change them (well, not unless I want to maintain them ever after, and I don’t). I suspect there is a solution to that particular problem but I’d noticed that the only way to find out any of this stuff is with the remote deploy. The local test told me nothing. This was true of the Logback issue too. So I realised this might go on forever and I bailed.
Openshift, in contrast, was quite happy with Logback and didn’t care about Serialization. That may cost them something in efficiency, but it sure got up and running fast.
There seem to be two general approaches with Openshift: using Git and using scp. The Git option assumes you store your project source on their Git repository and they build and deploy from there when you tell them. Sounds fine, but I already have a public Git repository at GitHub, and my maven build works just fine. I don’t feel a pressing need to learn their build syntax etc, though it is likely easy enough.
The scp option is basically ‘I have this war file, upload it and deploy it’. Great! That’s what I did. Worked first time. I suspect the running applications are not as fast as they might be but for a free service I can live with that. I’ll even listen to arguments that GAE’s serialization requirements really help Google deliver a faster application. But working trumps speed and I have it working.