Archive for April 2012

HelloWorld deploy on Google Application Engine 1.6.4

I have seen a bunch of tutorials on how to deploy on the Google App Engine. Let me tell you my experience as well, no it does not take 5 minutes, it’s more like 15-20 minutes to get HelloWorld app going.

First you need application account, go to the location below, login with your Google account and create your own application
https://appengine.google.com/

I use Eclipse ( Indigo ), so let’s look at how you install the Google Engine / SDK and plugin from there. The App Engine just got update to version 1.6.4, naturally that’s what we will use.

Help -> Install New Software

Use the Google Eclipse Indigo ( ver 3.7 ) feed
http://dl.google.com/eclipse/plugin/3.7

You can skip the Android stuff, just check the other 3 check boxes and start your downloads, you will have to Accept the license etc, it’s self explanatory.

After a few long minutes of downloads Eclipse will ask for a restart to install everything properly and you will be in business.

Create a new project,
File -> New -> Other -> Google -> Web Application Project

This will create a sample Google Application Engine project for you.

Then simply choose the blue (g) icon from the toolbar menu, and choose Deploy to App Engine… You will be asked for account info etc, and you will connect this deployment with the app you created in the beginning. Now watch the Console portion as the info about your deployment are displayed until you get success info. Then you can go to your application URL and see your new project in action. To find the URL you can goto My Applications in the Google app dashboard, it will have links on the right ( instances ) click on the link there and it will take you to your app.

Your URL will be something like
http://yourapp.appspot.com/

Its worth to mention that Google will host your app for free, as long as you don’t exceed certain resource limits. They actually have generous free limits, you can read more about the limits and what else you can buy in terms of resources here. You can actually host your own domain on the Google App Engine as long as it’s not a naked domain, That is you will be able to host www.mydomain.com but you will not be able to host mydomain.com. That’s really because of security, you can find further reading about that here.

That’s all, happy coding !

Tomcat multiple instances on Linux, Ubuntu / Mint

I was trying to figure out how to run multiple instances of Tomcat6 the other day on my Mint Linux. After a bit of searching and poking around I came to a very slick solution. But it took a while to find it, so I figure I will share the quick and dirty here, to get you up going quickly if your searching for the same.

Lets go through the whole thing, install Tomcat6
>sudo apt-get install tomcat6

You might have to set your java path if not set already, for example
>export JAVA_HOME=/usr/java/jdk1.6.0/bin/java
To check the setting
>echo $JAVA_HOME

You probably want to install the examples as well, just to mae sure things are working servlets, jsp etc,
>sudo apt-get install tomcat6-examples

If all is well as you would fully expect, you can start your Tomcat
>sudo sh /etc/init.d/tomcat6 start

And in return you will be able to access your tomcat in your browser at
http://localhost:8080

So lets take a look at how to configure multiple instances on the same linux box. Go to a directory where you want your new tomcat instance located. Then you do something like this
>tomcat6-instance-create myInstance

This will create a new directory called myInstance which will host your new instance of Tomcat. It will have it’s own configuration files, logs, etc. The first thing you probably want to do is to go to the config directory and change the ports in the server.xml file. Once you have the ports changed from the usual 8080 you can start your instance from /myInstance/bin directory.
>sh startup.sh

Just as you would with any other instance of Tomcat and shut down with the shutdown.sh script. Next time you need another instance on another port just create a new one
>tomcat6-instance-create myInstance_8030
and so on and so forth.

All the details can be found in the Ubuntu documentation.