Code Monkey home page Code Monkey logo

booker's Introduction

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 swarm
oc create -f https://raw.githubusercontent.com/wildfly-swarm/sti-wildflyswarm/master/1.0/test/imagestream.json
oc create -f https://raw.githubusercontent.com/wildfly-swarm/sti-wildflyswarm/master/1.0/test/build-config.json
oc start-build wildflyswarm-10-centos7-build

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)

booker's People

Contributors

bbrowning avatar bobmcwhirter avatar heiko-braun avatar lance avatar kenfinnigan avatar jclingan avatar ligangty avatar jpkrohling avatar tremes avatar emag avatar

Watchers

saiki avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.