Tuesday, July 15, 2014

Getting started with Bluemix!

No, honestly... I never thought it would be that simple!

Bluemix is currently in open beta. You need to register to get started.

To register go to: https://ace.ng.bluemix.net/
The free trial version is available for 30 days.

Once you have logged in, you will see a nice dashboard.
Just explore around to your heart's content when you have time, the DOCS are exhaustive, yet very useful.

Quick steps for your first app:
    • Click on Create an App; you will be presented with the Catalog, with Boilerplates* and Runtimes.

    • Let's start with 'Liberty for Java'.

    •  Give it a name.   
      • P.S. myTestApp will most likely be taken! Chose a better one ;) 
    • Give it a few minutes and you will see the 'health' of your app turn green.
    • Click on the app and click on VIEW QUICK START. 
    • Now go to myTestApp.bluemix.net  and Voila! That's your very first app there.
    • Ok. It has some code written for you already. Just as an example. So let's just continue to add our bit to this app.
    • Blindly follow the steps given there UNTIL STEP #3.
    • Extract the zip file and add a simple HTML file of your own in WebContent folder. Let me just add this simple HTML file that takes a word and says 'Hello'.
    • Generate a war file. You can use eclipse or run 'ant build-war' from command prompt.
    •  Now the following simple commands in your terminal:
    • cf api https://api.ng.bluemix.net
    • cf login -u <user-name>
    • Give your password
    • cd to your project path where the war file resides
    • cf push <app-name> -p <war file name>
    • On bluemix dashboard, you can see the health of the app turning red for a while and then back to green. That means your app is running now!
    • Congratulations! That took about 2 minutes and that is how is easy it is!
    • http://pd-javaapp1.mybluemix.net/SayHello.html here is my app for you all to test!

    Try it out and let me know the results and questions if you have any! :)

    *Boilerplates: Just a fancy word for 'getting started applications'.
    Here is a youtube link that shows how to add a servlet. Thank you Ryan Baxter!

    1 comment:

    1. EDIT:
      A colleague faced this issue.

      When ANT build was run build failed with this error: /WebContent/WEB-INF/lib does not exist.

      Since this is just the starter package and you really do not need SQLDB right now, you can remove this line: ~lib dir="WebContent/WEB-INF/lib"/~ from build.xml.
      Replace ~ with left and right angle brackets!

      This should fix the build failure.

      Pooja

      ReplyDelete