Book-reader Demo App
Java JavaScript Shell Ruby CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
common
extra
library
pricing
store
vagrant
web-client
.gitignore
BOOKER_WITH_DOCKER.md
README.md
pom.xml

README.md

Multicast

On OSX, you'll probably need to enable multicast on localhost:

sudo route add -net 230.0.0.0/4 127.0.0.1

Components

web-client

Simple, normal .war deployment that serves the React.js-based single-page-app, along with an async servlet to power the Server-Sent-Events (SSE) for Ribbon service discovery.

The React.js components communicate directly with the store and library services.

Since this application includes a main() method, and creates a WAR file instead of a JAR file, you'll need to start this application using the java -jar command.

$ java -jar target/booker-web-client-swarm.jar

store

Book inventory (pulled from Project Gutenberg) served from a JAX-RS resource from a CDI-injected service. Uses the pricing service via Ribbon to determine the price of each item in the store.

Start this using the maven command.

$ mvn wildfly-swarm:run

pricing

Simple pricing service that indicates everything is $10 if you're browsing anonymously, or $9 if you're logged in.

Start this using the maven command.

$ mvn wildfly-swarm:run

library

Tracks which items are bought by a user using JPA (via an h2 database) from a JAX-RS resource. Communicates with the store service to associate details with a given book ID.

Start this using the maven command.

$ mvn wildfly-swarm:run

keycloak

The application is built assuming that there is a running keycloak. Learn more about keycloak and download it at http://keycloak.jboss.org/

Once you have keycloak, start it using the standalone.sh command.

./bin/standalone.sh -Djboss.http.port=9090

The default user name and password when you start keycloak for the first time is admin/admin. Use this to access the keycloak console, and then select Add realm, set the name to booker and import the JSON data from this repository in extra/keycloak.

Vagrant

A Vagrantfile and support scripts to install and run booker in a virtual machine. Requires Virtualbox and Vagrant be installed.

OpenShift

Booker on OpenShift 3.x is still a work in progress, but here are the steps to try it out. These assume you have a working OpenShift 3 environment already setup and configured.

First, build the WildFly Swarm source to image container:

oc new-project booker
oc create -f https://raw.githubusercontent.com/wildfly-swarm/sti-wildflyswarm/master/1.0/wildflyswarm-sti-all.json

Wait for the WildFly Swarm image to finish building (use oc status to check the progress). Once it has finished, we can start deploying Booker using that image.

oc policy add-role-to-user -z default view
oc new-app --name=booker-keycloak --context-dir=extra/keycloak https://github.com/wildfly-swarm/booker
oc expose service booker-keycloak
oc new-app --env="SWARM_JAR=web-client/target/*-swarm.jar" --name=web wildflyswarm-10-centos7~https://github.com/wildfly-swarm/booker
oc expose service web
oc new-app --env="SWARM_JAR=library/target/*-swarm.jar" --name=library wildflyswarm-10-centos7~https://github.com/wildfly-swarm/booker
oc new-app --env="SWARM_JAR=store/target/*-swarm.jar" --name=store wildflyswarm-10-centos7~https://github.com/wildfly-swarm/booker
oc new-app --env="SWARM_JAR=pricing/target/*-swarm.jar" --name=pricing wildflyswarm-10-centos7~https://github.com/wildfly-swarm/booker

After the booker-web application deploys, use oc get routes to find its exposed hostname. Copy and paste that hostname into your browser to test out the Booker application.

We can simplify all these steps by creating an OpenShift template that allows us to create all these resources with a single command.

Docker

Booker uses https://github.com/spotify/docker-maven-plugin to enable docker build for the 4 services. Run with

mvn clean install docker:build

to build the docker images, and then run with

docker run -t -p $hostport:$containerport $dockerimage

to start the corresponding services. (Don't forget start a single keycloak server before that)