From f338ae4b823bc3cb3ad3ff672ea5fea02eedd630 Mon Sep 17 00:00:00 2001 From: szimano Date: Sat, 25 Feb 2012 20:41:26 +0200 Subject: [PATCH] - StartNewInstance changed for the jozi jug thing - readme filled in --- README.mediawiki | 42 ++++++++++++++++++- .../joziawsdemo/tools/StartNewInstance.java | 15 ++++--- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/README.mediawiki b/README.mediawiki index 030d08f..9eabb76 100644 --- a/README.mediawiki +++ b/README.mediawiki @@ -1,9 +1,47 @@ += Jozi JUG AWS sample application = + +== Setup JBoss == Start JBoss AS 7.1+ - ./standalone.sh [-Dlocal] --server-config=standalone-full.xml +Fix the slf4j module, by editing ${JBOSS_HOME}/modules/org/jboss/logging/main/module.xml and add those two to the dependencies: + + + + +'' This might be fixed by JBoss one day, but still for JBoss AS 7.1-Final does not work properly'' + +== Build & Deploy the war == + +Build the project with + + mvn clean install + +And put '''target/jozi-aws-demo-1-SNAPSHOT.war''' in ''''${JBOSS_HOME}/standalone/deployments''' + +== Run the application == + +=== JMS & Hibernate version === -The optional '''-Dlocal''' will use JPA/JMS services instead of SDB/SQS +Run the server with + + ./standalone.sh -Dlocal --server-config=standalone-full.xml Deploy JMS queue with add-jms-queue --name=JoziJUGQueue --entries=queues/MessageQueue + +This will use JPA/JMS services. + +=== SQS & SDB version === + +Fill in aws.properties and sqs.conf in the resources folder (use .sample files) + +Create an empty '''messages''' domain in SDB. + +Run the server with + + ./standalone.sh + +== Access the application == + +Go to [http://localhost:8080/jozi-aws-demo-1-SNAPSHOT/home/index http://localhost:8080/jozi-aws-demo-1-SNAPSHOT/home/index] diff --git a/src/main/java/pl/softwaremill/jozijug/joziawsdemo/tools/StartNewInstance.java b/src/main/java/pl/softwaremill/jozijug/joziawsdemo/tools/StartNewInstance.java index 5586e3e..c92259b 100644 --- a/src/main/java/pl/softwaremill/jozijug/joziawsdemo/tools/StartNewInstance.java +++ b/src/main/java/pl/softwaremill/jozijug/joziawsdemo/tools/StartNewInstance.java @@ -1,6 +1,11 @@ package pl.softwaremill.jozijug.joziawsdemo.tools; -import com.xerox.amazonws.ec2.*; +import com.xerox.amazonws.ec2.EC2Exception; +import com.xerox.amazonws.ec2.Jec2; +import com.xerox.amazonws.ec2.LaunchConfiguration; +import com.xerox.amazonws.ec2.LoadBalancing; +import com.xerox.amazonws.ec2.LoadBalancingException; +import com.xerox.amazonws.ec2.ReservationDescription; import pl.softwaremill.jozijug.joziawsdemo.impl.sdb.AwsAccessKeys; import java.io.IOException; @@ -30,9 +35,9 @@ private Jec2 createJec2() { } public List startInstance(Jec2 ec2) throws EC2Exception { - LaunchConfiguration launchConfiguration = new LaunchConfiguration("ami-6d477b19"); - launchConfiguration.setSecurityGroup(Arrays.asList("SoftDevCon")); - launchConfiguration.setKeyName("confitura"); + LaunchConfiguration launchConfiguration = new LaunchConfiguration("ami-75300901"); + launchConfiguration.setSecurityGroup(Arrays.asList("quicklaunch-1")); + launchConfiguration.setKeyName("aws-jozi-jug"); launchConfiguration.setAvailabilityZone("eu-west-1c"); ReservationDescription reservationDescription = ec2.runInstances(launchConfiguration); @@ -47,7 +52,7 @@ public List startInstance(Jec2 ec2) throws EC2Exception { public void registerWithElb(List instanceIds) throws LoadBalancingException { LoadBalancing loadBalancing = createLoadBalancing(); - loadBalancing.registerInstancesWithLoadBalancer("SoftDevConLB", instanceIds); + loadBalancing.registerInstancesWithLoadBalancer("JoziLB", instanceIds); System.out.println("Registered " + instanceIds + " with the load balancer."); }