Git Product home page Git Product logo

dw-demo-app's Introduction

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}

dw-demo-app's People

Contributors

dduportal avatar matteoumatche 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.