Skip to content

DropWizard + AngularJS demo application, run with Docker, built with Maven as demo purpose

Notifications You must be signed in to change notification settings

mirkofranco/dw-demo-app

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

DropWizard Demo Application

Welcome to the DropWizard Demo Application !

The goal of this repository is to show a tiny application example to illustrate build pipelines and tools

How to build it ?

Requirements

To be built, this application needs:

  • JDK 8 (OpenJDK is fine) as SDK
  • Maven 3.3 as build tool

Get the code

Clone the repository wherever Maven + JDK is available

Build it

From the root of the repository:

  • Whole building process is as simple as
mvn clean install
  • Just compiling classes:
mvn clean compile
  • Running unit tests (implies compiling):
mvn test
  • Running Integration tests (implies compiling but NO unit tests):
mvn verify
  • Generating the standalone application:
mvn package
  • "Installing" application in the local Maven repository:
mvn install

How to run it ?

Bare-metal

The awesome DropWizard framework makes the generated application a standalone one.

You can run it with just a Java JRE 8 installed:

java -jar ./target/demoapp.jar server ./hello-world.yml

The application will then be available on http://localhost:8080/ if everything went smoothly

Docker run

They are a lot of reasons that would make you NOT wanting to launch application in Bare Metal:

  • Developer Syndrom (portability concerns): "It works on my machine" (your JDK and Maven installation)
  • Security concerns: "What is this application doing ?"
  • Ease of run: If any application is already running on the 8080 port of your machine, you'll be required to dig into the codebase + documentation to change listening ports.

This is why you can run the application with your own baked Docker image.

  • A Dockerfile is provided at the root of the repository
  • First step is to "build" the Docker image:
docker build -t dw-demo-app:latest ./
  • Then run it in background, letting Docker selecting a port:
CID=$(docker run -d -P dw-demo-app:latest)
  • Fetch the allocated port by asking docker:
    • Note that a simple docker ps could be sufficient, but not very machine-readable
docker port ${CID} 8080

Example: 0.0.0.0:37567

  • Browse to the application homepage, using the fetched port: http://{DOCKER SERVICE IP}:37567

    • {DOCKER SERVICE IP} is the IP address of your Docker service:
      • localhost on Docker4Mac or Docker4Windows
      • The result of boot2docker ip using Docker toolbox
  • Stop and clean the application:

docker stop ${CID} && docker rm -v ${CID}

About

DropWizard + AngularJS demo application, run with Docker, built with Maven as demo purpose

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 92.9%
  • HTML 3.4%
  • Dockerfile 2.4%
  • JavaScript 1.3%