Pages

Saturday, November 24, 2012

Deployed Web App version 0.000001


Since completing coding (several posts ago), my big adventure has been ramping up on the linux system administration skils needed to configure and deploy apps and services into (Amazon AWS/Cloud) Infrastructure. Along the way, I discovered that the AWS Free Usage Tier "Micro" instance server  is not enough to run my application stack on a single server so I had to upgrade to a "Medium" (aka "not-free") server instance. I'm also increasingly under the impression that this piddly app could have been executed (much more effectively) with a direct AJAX (Asynchronous JavaScript and XML) implementation like javascript+php rather than the heavy Google GWT AJAX framework plus the Java Enterprise Edition (J2EE) and SOAP Web Services platfoms that I've employed...but that's another project, possibly the next one, for Adventures in Webdevland. 

Finally, a fully deployed (but very basic & buggy) web application...

WEATHER SCOUT Version 0.000001 
Features:

Front-end/UI:
Display's real time weather for almost any city in the world.
And because it's hosted in the cloud, in the real-live-world-wide-web, its accessible from anywhere in the world!
Also, it has a cross-platform user interface so it works on phones, pc, mac, and ipads ! 
And it maintains consistent look & feel across all devices.


Back-end:
"Administrator" console for configuring application features (available cities can be configured...currently set to USA)
3 Tier Architecture: Web Browser UI, Web Server (Apache Tomcat), Enterprise Server(Oracle Glassfish)
SQL Database for data persistence. Users' available cities' are read from DB (Apache Derby) which is configurable by Application Administrator (via custom Web UI also hosted in the cloud)
Service Oriented Architecture (consumes/exposes SOAP Standard Web Services) to receive and display "live" weather data.
...and more bonus features constantly being discovered (aka bugs)

Release Notes
Corporate firewalls tend to block some amazon services. 
So, if this does not work from your work pc, please try your phone, or try from different network.
Performance is sloooow. Please be patient
Weather Scout is currently configured to work for US cities

Amazon Cloud Infrastructure (Continued)

Signing up and instantiating my first ever server in the cloud was impressively easy. Below is what the server instances look like in the admin console. The background window shows my Amazon hosted Virtual Machines or VMs. While the super imposed window is for connecting to the server instances. To get this form, right click on a server instance and select "connect". You have two options to connect SSH standalone client or SSH browser client which requires Java plug-in....and that's where I ran into my first issue (or educational opportunity).

The issue was not with AWS itself. The issue was that I did not have a Java Runtime Environment (JRE) installed nor a Java browser plug-in. The AWS popup screen was even helpful enough the detect and display this fact with links on how to get the JRE and plugin. And that's where it went awry for while. Considering how much GWT Java and J2EE development I've been doing, I was certain that "Of course, I had Java installed". I recall getting/installing both Oracle Java and Open Java dev kits. And after quite a bit of poking around, I realized that what I had were the Java development kits...aka JDKs, used by IDEs and OSs to compile/run Java programs which are quite something different from  the Java run-time environment, JRE which comes in the form of browser plug-ins for  running browser based java....doh. This is the kind of basic stuff that get's you stumbling and drains time but sigh...its how you learn. Remember, when you are not in the world of commercial Windows or Mac OS, this stuff is not automatically, taken care of for you.  So, the next challenge was getting/installing the JDK. Canonical, the makers or Ubuntu linux, have a software repository where they and any linux software supplier can register software so that download/install can be straightforward. Unfortunately, the Java JDK which used to be in this repository is no more. It would have been OK if the JDK was never in Canonical's repository but because it once was, there was all this conflicting information on the web about how to get it from Canonical. Which delayed me from simply getting it from Oracle which I was reluctant to do because my linux/ubuntu skills are still fuzzy, at best. So, I really appreciate a nice script based install which puts things in all the right directories, makes all needed symbolic links and handles shell environment variables etc. I finally stumbled on a credible  looking software repository which hosts the Oracle JDK for easy install. But first, I needed to add the repository to my Ubuntu configuration. Fortunately, I found instructions for that too. Thanks Web Upd8 for the JDK and Instructions.


sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer


Just a little bit more tinkering and I was ble to get the plug-in installed in my browser(s)....phew. Now, I could use the in-browser SSH client from Amazon Admin console to log into my brand new Amazon (Free Usage Tier) Micro Instance. I did all this, so that I would not have to figure out how to set-up SSH using the native command line application on my system. It turns out that this other approach with native SSH command line was not so hard but also much better experience. Anyway, with the plug-in Installed, everything worked like a charm, following the Amazon documentation. But it did not take long before I figured out how to use direct command line SSH. One more think I had to learn was how to transfer files from my local machine using SCP command and from this point on, accessing my Amazon VM was almost exactly same as accessing my local Ubuntu VM via command line....pretty darn cool.

Getting started with Amazon Cloud Infrastructure



Though slightly intimidated by all the (impressive) infrastructure and software-as-a-service (SAAS) offerings available from Amazon and other IT suppliers hosted on Amazon, I found the intros and documentation quite accessible. I was especially thrilled to discover Amazon's Free Usage Tier.


AWS Free Usage Tier (Per Month):
Elastic Compute Cloud (EC2)
750 hours of Amazon EC2 Linux† Micro Instance usage (613 MB of memory and 32-bit and 64-bit platform support) – enough hours to run continuously each month*
750 hours of Amazon EC2 Microsoft Windows Server‡ Micro Instance usage (613 MB of memory and 32-bit and 64-bit platform support) – enough hours to run continuously each month*
750 hours of an Elastic Load Balancer plus 15 GB data processing*
30 GB of Amazon Elastic Block Storage, plus 2 million I/Os and 1 GB of snapshot storage*
Simple Storage Service (S3)
5 GB of Amazon S3 standard storage, 20,000 Get Requests, and 2,000 Put Requests*
DynamoDB
100 MB of storage, 5 units of write capacity, and 10 units of read capacity for Amazon DynamoDB.**
Relational Database Service (RDS)
750 hours of Amazon RDS Single-AZ Micro DB Instances, for running MySQL, Oracle BYOL or SQL Server (running SQL Server Express Edition)‡‡ – enough hours to run a DB Instance continuously each month*
20 GB of database storage
10 million I/Os
20 GB of backup storage for your automated database backups and any user-initiated DB Snapshots
SimpleDB
25 Amazon SimpleDB Machine Hours and 1 GB of Storage**
Simple Workflow (SWF)
1,000 Amazon SWF workflow executions can be initiated for free. A total of 10,000 activity tasks, signals, timers and markers, and 30,000 workflow-days can also be used for free**
Simple Queue Service (SQS) and Simple Notification Service (SNS)

100,000 Requests of Amazon Simple Queue Service**
100,000 Requests, 100,000 HTTP notifications and 1,000 email notifications for Amazon Simple Notification Service**
more...

The Free Usage Tier was especially welcome after I tried the Simply Monthly Calculator with the reference web application topology selected. With the default load/configurations, the estimated monthly cost came up to the stunningly-out-of-my-budget amount of: $1,660 per month.

Even though this 3-tier web application is the topology I'm going for, I should be able to fit my web app (Weather Scout) into the Free Usage Tier offering (based on expected utillization being close to zero, no load loadbalancing, scaling group, or high availablity clusters).


Sunday, November 11, 2012

Finally...a full Web Application Stack!



Yes. Its rudimentary but...boy, did it take a while!

I have been working at this for about 10 hrs per week since my last blog post 9 weeks ago.

APPLICATION DESCRIPTION
The application use case scenario is pretty basic. An administrator uses the "Admin Console" screen on the left to select cities to make available to users. On the right, users select cities to view weather status. As the user types a city that they would like to add, the app helpfully provides suggestions. The suggestions are limited to just the cities permitted by the administrator in the Admin Console.

WHY DID IT TAKE SO LONG
Its hard to remember all the challenges but I'll try to list some. I'll probably add more to this list and get into more details on these in future posts.

Java/POJO (Plain Old Java)
Applied new (to me) concepts to handle Exceptions, Collections, XML parsing, and even variable declarations and scope (a missing use of "final" declaration was the source of 10hrs - 20hrs of tedious debugging)
Java/EJB (Enterprise Java Beans)
Challenges with consuming SOAP Web Service from J2EE/EJB which I was able to do just fine using regular Java
Java/JPA (Java Persistence API)
Challenges with Java Persistence API syntax and usage
Google GWT
Spent many hours learning the idioms of GWT framework particularly around user interactions and Client/Server Remote Procedure calls.
Apache Derby
Challenges with starting, configuring Apache Derby database as standalone server outside of Eclipse
IDE.

NEXT STEP...
Heavy sigh and deep breadth...deploy servers and services to the cloud!