Wednesday, 9 May 2012

vfabric Application Director 3 Tier Spring Travel Blueprint

Here are the steps used to create a 3 tier application using Spring travel with a MYSQL database. This is based on the screen shots from the previous blog entry.

1. Log into "vFabric Application Director" home page
2. Click on "Manage Applications".
3. Locate "Spring Travel" and select the icon for "Copy this application version" under the "Actions" column
4. Select radio option "Save as new application" and enter details as follows.



5. Click ok.
6. Click on the symbol  IMG6 "Convert to node array" to ensure we create a cluster of these VM's.
7. Set the cluster size to 2.
8. Click on the "Memory" column and set each VM to 1024M as shown below

IMG7

9. Press the "Save" button at the top right hand corner of the blueprint editor.

Note: Ignore any warning and save the changes.

10. Under "Logical Templates -> OS Templates" drop "CentOS56 32 bit 1.0.0" onto the canvas.
11.  Name it "load_balancer" and set the memory to 512M as shown below.

IMG8


12. Save the blueprint
13. Under "Services -> Web Servers" drop "Apache 2.2.0"
14. Name it "Apache_LB" for the "Details" column
15. In the top right hand corner use the icon IMG9to create a relationship from "Apache_LB" to "SpringTravelApp" as shown below.

IMG10

16. Save the blueprint
17. Click on "Apache_LB" and select the "Properties" column
18. Edit the property "http_node_ips" and ensure the blueprint property is set as shown below. This will we setup our http.conf for Apache to bind to the 2 tc Server VM's using the correct ip address.

IMG11

19. Edit the property "jvm_routes" and edit it use the blueprint value "all(SpringTravel:tcServer:JVM_ROUTE)". You should have something as follows.

IMG12

20. Save the blueprint.
21. Under "Logical Templates -> OS Templates" drop "CentOS56 32 bit 1.0.0" onto the canvas.
22. Name it "MySQLTier" and change the "Memory" to 1024M.
23. Under "Services -> Database Servers" drop "MySQL 5.0.0" onto the template
24. Under the "Properties"column edit the "db_root_password" to "welcome1" as shown below.

IMG13

25. Save the blueprint
26. In the top right hand corner use the icon IMG9to create a relationship from "SpringTravelApp" to "Mysql".
27. Drop from "Application Components" a "SQL Script" onto "Mysql"
28. In the top right hand corner use the icon IMG9to create a relationship from "SQL_SCRIPT" to "Mysql" which should give you a blueprint as follows at this point.

IMG14

29. Select "SpringTravelApp" and add a property as shown below to ensure we bind to the "MySQLTier" ip address.

IMG15

30. Edit the "war" property and set it's "Blueprint Value" to "http://dl.dropbox.com/u/15829935/se-demos/app-director/mysql/mysql-swf-booking-mvc.war"
31. Click on the "Actions" column
32. Double click on the "script" column for the lifecycle stage "CONFIGURE" and add contents as shown below.


#!/bin/sh

env > /tmp/env.txt

sleep 10

export mysqlip="${dbip}"

echo "mysql ip is ${mysqlip}"

cd $installdir/working/springsource-tc-server-standard/instance1/webapps/mysql-swf-booking-mvc/WEB-INF/config
sed -e "s/localhost/${mysqlip}/g" data-access-config.xml > data-access-config-NEW.xml
mv data-access-config-NEW.xml data-access-config.xml

33. Double click on the "script" column for the lifecycle stage "START" and add contents as shown below.

#!/bin/sh

env > /tmp/env.txt

cd $installdir/working/springsource-tc-server-standard/instance1/bin

./tcruntime-ctl.sh stop

./tcruntime-ctl.sh start


34. Click on "SQL_SCRIPT" on the "MySQLTier"
35. Click on the "Actions" column
36. Double click on the "script" column for the lifecycle stage "INSTALL" and add contents as shown below

#!/bin/bash

mysql -h localhost -u root -pwelcome1 < create database travel;
CREATE USER 'travel'@'%' IDENTIFIED BY 'travel';
GRANT ALL ON travel.* TO 'travel'@'%';
!

37. Save the blueprint
38. Click on the icon in the top right hand corner IMG16 to deploy the blueprint
39. Enter a deployment profile name as "SpringTravelMysql"
40. Click Ok
41. Click on "Map Details" button
42. Click Next
43. Click Next
44. Click Next
45. Click Deploy

A successfull deployment will look as follows once complete.



1 comment:

Anonymous said...

Great job Pas. These steps were really easy to follow