From Documentation

Jump to: navigation, search




  • Author
    Sotohiro Terashima


Sera.png
Sotohiro graduated from the Tokyo Institute of Technology and was employed to NHK(Japan Broadcasting Corporation) in 1972. He engaged in all round Broadcasting engineering and experienced many computer technologies, from a micro computer (Z80) to a main frame (IBM370). After NHK, he went to NHK Media Technology where he studied Java and Flash technology. At this time he worked on numerous systems and became enchanted by the ZK Framework. Sotohiro is the owner of the ZK development plug-in for NetBeans, REM.


</span>

  • Date
    January 19, 2010
  • Version
    ZK 5

Contents

Introduction

I succeeded in running the ZK Demo program on Amazon EC2 and wanted to share my experiences with the community. Using Cloud Foundry, it was very easy to install Apache + Tomcat + MySQL on the Cloud.

About CloudFoundry

  • The founder of CloudFoundry is Chris Richardson
  • CloudFoundry was acquired by SpringSource last year
  • SpringSource was acquired by VMWare soon after above event
    • CloudFoundry is now VMWare's "Automated Deployment and Management for Java applications on Amazon EC2" tool
    • It is currently in beta and we can use it with no charge

Registration

In order to try Amazon EC2 using CloudFoundry we have to register with CloudFoundry. To register on Cloud Foundry we need Amazon Web Services Credentials.

Steps

  • Sign up for AWS and retrieve both the key id and secret key id
  • Create an EC2 private keypair using the AWS Manage Console or ElasticFox plug-in
  • We need to reuse the Database definition after re-running the virtual server instance. Therefore we must use Amazon EBS(Elastic Block Store) to sustain the Database.


Notes

  • In the step of this article, we use Putty and WinSCP to communicate with the virtual server instance
  • The EC2 private keypair cannot be applied as is to Putty and WinSCP
    • We must convert it to a Putty private key(ppk) using Puttygen.exe(Putty SSH key generation utility)
  • We make ports 22 and 80 available in the Security Groups of the AWS Manage Console
    • Port 22 is for SSH communication
    • Port 80 is for Web Browsing
  • The default account of the virtual server instance is root and no password
    • I kept these credentials as I was just testing and only running for a short time

Deployment

As I mentioned first,on 2009 Dec 3,I deployed 2 applications,ZK3.6.3 Demo and JPetstore which uses MySQL. Today 2010 Jan 5,I will add more ZK application which uses MySQL


  • This ZK application is named ZKtodoMySQL, which is derived from the tutorial Your first ZK application "To-do" list
  • This tutorial is a sample of "A real-world application with a database", and uses HSQLDB as the database.
    • I migrated this to MySQL version.
    • The complete NetBeans Project(Using REM 3.6.3) is here.

Steps

Home Page of CloundFoundry(after log-in)

Home.png


Then click the applications tab

Applications.png

Then click the Edit Icon (image of a pencil)

BeforeAdd.png

Now,I will add a new application, ZKtodoMySQL

AddWarButton.png

Next we click the Save Button and the Upgrading message is displayed

UPdating.png

Next we click the Deploy Button (green triangle).

Before we click the Launch Button,we add the Existing EBS Volume to the Database Storage

  • Device /dev/sdh
  • Volume vol-f73ec59e - JPetsto
  • Back Frequency Manual

DeployUp.png


DeployDown.png


Before Launch Deployment, we open the AWS Management Console

AWS.png

Before clicking the Launch Button, we need to input the name "JPetStoreandZKtodo" at the Stage 6

After clicking the Launch Button we notice that the instance which appears here is the same as the one in the AWS Management Console.

Launched.png

We then use SSH by Putty to issue commands to MySQL

We use WinSCP to transport the script file into server instance and when we start Putty, we get next message.

Security.png

When we answer yes to this dialog we get the next window

CloudFoundry.png

We transfer the script file "createtable.sql" to the server instance using WinSCP

  • At server console
    • Create database zkmysql in MySQL
        1. mysqladmin -u root create zkmysql
    • Create table in zkmysql using scriptfile
        1. mysql -uroot zkmysql < createtable.sql
  • At MySQL console,check database
      1. mysql
    • mysql>show database;

CloudFoundryCMDS.png

All the tasks are completed

If we look at the server instance address by Browser,we get next page.    If we look at the http://[server instance address]/ZKtodoMySQL then we get ZK application.


BrowseCloudFoundry.png

ZKonCloudFoundry.png

Download

The complete project can be found here.

Comments



Copyright © Sotohiro Terashima. This article is licensed under GNU Free Documentation License.

You got stuck here?
Let us know how we can improve this page
For specific questions please use the forum