Skip to content

Commit

Permalink
- StartNewInstance changed for the jozi jug thing
Browse files Browse the repository at this point in the history
- readme filled in
  • Loading branch information
szimano committed Feb 25, 2012
1 parent d6240a6 commit f338ae4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
42 changes: 40 additions & 2 deletions README.mediawiki
Original file line number Diff line number Diff line change
@@ -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:

<module name="org.apache.log4j"/>
<module name="org.slf4j"/>
'' 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]
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -30,9 +35,9 @@ private Jec2 createJec2() {
}

public List<String> 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);

Expand All @@ -47,7 +52,7 @@ public List<String> startInstance(Jec2 ec2) throws EC2Exception {

public void registerWithElb(List<String> instanceIds) throws LoadBalancingException {
LoadBalancing loadBalancing = createLoadBalancing();
loadBalancing.registerInstancesWithLoadBalancer("SoftDevConLB", instanceIds);
loadBalancing.registerInstancesWithLoadBalancer("JoziLB", instanceIds);
System.out.println("Registered " + instanceIds + " with the load balancer.");
}

Expand Down

0 comments on commit f338ae4

Please sign in to comment.