Showing posts with label Cloud. Show all posts
Showing posts with label Cloud. Show all posts

Saturday, May 12, 2012

Getting Started with OpenShift Paas Cloud

Getting Started

Couldn't be easier, in a nutshell:
  1. Create an OpenShift account.
  2. Add your public key to the OpenShift website.
  3. Setup the OpenShift Eclipse plugin.
That is about it! Deploying couldn't be easier as well. When you sign up OpenShift (very nicely) creates you a free git repo. All you need to do to deploy to your server is to push your changes to your repo, it does the rest! All very easy and very nice.

Changing Your GIT Upstream

I don't really want to deploy with every push, so I push to an 'inbetween' repo. I then push to 'upstream' (my OpenShift repo) only when I want to deploy.

To add an extra repo in between, run from your GIT folder:
  1. git remote rename origin upstream
  2. git remote add origin git@github.com/{your-account/{your-repo-name}.git
  3. git push -u origin master
After that your OpenShift project will be in GitHub, and any future pushes to GitHub you can just use 'git push'.

Now, to deploy just use:
git push upstream

I hope this has helped someone out there...

Tuesday, May 08, 2012

PaaS (Platform as as Service) Solutions Review

Well, I have decided to start (finally) playing around with PaaS solutions. I have briefly looked at GAE vs OpenShift, my initial impressions of each:

GAE (Google App Engine)

Strengths
  • Integrates well with Maven, and POM is nicely setup with a Maven Archetype
  • Will soon be offering MySQL solution, so you can have proper transactional apps on it
  • Plays well with Spring
  • Offers a NoSQL datastore (BigTable)
  • Automatically scales well with not much effort/monitoring on a devs behalf
  • Ties in well with other Google offerings, such as Drive, Maps, and even user management
Weaknesses
  • No full Java EE stack offering
  • Hard to avoid vender lock in

OpenShift

Strengths
  • Zero vendor lock-in
  • Can run basically any application. You can deploy straight to a JBoss 7.1 server easily (or PHP, Perl, whatever tickles your fancy)
  • Has a nice Eclipse plugin
  • Deploys by checking into a specific GIT repo (haven't tried yet but looks fairly easy)
  • Automatically scales well with not much effort/monitoring on a devs behalf
  • Can use MySQL, PostgreSQL or even MongoDB out of the box
Weaknesses
  • The default MySQL install doesn't automatically scale, I am sure you can some how set up replication but haven't looked into yet.
  • No built in niceties that you get with GAE, such as automatic user management
  • Relatively new, and not as well used and therefore tested as GAE (yet)

Verdict

I like both offerings to be honest, it would just depend on your requirements and personal likes/dislikes. I think I am leaning towards setting up a new application on OpenShift, mainly due to the fact you can deploy to a REAL application server (as opposed to a lightweight one such as Jetty etc). Stay tuned for how I get on...

Tuesday, September 05, 2006

CSS and Images not loading

Alrighty, my first (hopefully) helpful blog :).

I am using a hosting company for my webapp. They are using plain, good old Apache for hosting the static content such as images, css files and html pages. Requests are passed to Tomcat for processing any of the jsp files etc.

I noticed that the first time I went to my website after clearing the browser cache, the images and the CSS files were not being displayed or even found. This kept me up a few nights pulling my hair out, but I eventually noticed that when I disabled cookies the images and CSS NEVER got displayed!

The problem? After viewing the page source I noticed that without cookies enabled, the URLs included the session id in them, like so: "http://www.stroke-education.com/image/cart.gif;jsessionid=24A03F5B45814B192ABF9F7B1918B8AB.tomcat36". Of course Apache doesn't know how to deal with the jsessionid, it treats the whole thing as one URL, and it cannot find the file. The session id gets included the first time because tomcat isn't sure if cookies are enabled/disabled.

The solution? Tomcat has to get passed the requests that have jsessionid in the URL. My host company ended up forwarding all requests to Tomcat, which is overkill but it works.

A better solution is talked about here:
http://www.jguru.com/faq/view.jsp?EID=53878

They suggest adding the following to Apaches config:
<IfModule mod_rewrite.c>
RewriteEngine on
# Force URLs with a jsessionid to go to Tomcat. Necessary because
# Apache doesn't recognise that the semi-colon is special.
RewriteRule ^(/.*;jsessionid=.*)$ $1 [T=jserv-servlet]
</IfModule>