Code Monkey home page Code Monkey logo

java-in-container's Introduction

Java in Container

Repository contains pptx presentation and users-app Java application used in my talk: "Java in Container - Best Practicies for containerized Java Apps" which I gave at JDD

Presentation

JavaInContainer.pptx

Java Application

Application used as Demo in my presentation is located HERE. It's simple REST API application, features:

  • Spring Boot App
  • Uses MySQL as storage
  • REST API
  • Purpose - CRUD operations over Users dataset

Prerequisits

  • Java 8+
  • Docker
  • Maven

Database deploy

cd users-app/db
./mysql.sh start # starts docker image with MySQL locally
./mysql.sh create-db  # creates DB in docker image with MySQL
./mysql.sh test  # tests whether the DB is working properly, the output should be:
+----+-----------+------------+------------+
| id | firstName | secondName | birthDate  |
+----+-----------+------------+------------+
|  1 | Tom       | Tailor     | 1962-07-04 |
|  2 | Tommy     | Hilfiger   | 1976-01-28 |
|  3 | Coco      | Chanel     | 1917-02-14 |
+----+-----------+------------+------------+

Application deploy

Application uses mysql as address of DB, so to configure your local development please add 127.0.0.1 mysql entry in your /etc/hosts file to make it working locally.

Please note that all commands are run from users-app directory.

Build java app:

./mvnw clean install

Run Java app:

java -jar target/users-app-1.0.jar

To test whether application works, open: http://localhost:8080/api/users - 3 users should be shown to you.

To build docker image with appropriate Dockerfile:

docker build -f v1.Dockerfile --tag="mateuszdyminski/users-app:v1" .

where v1 if prefix for Dockerfile, there are 6 different Dockerfiles provided.

To run application in Docker:

docker run -d --link db:mysql -p 8080:8080 "mateuszdyminski/users-app:v1"

Credits

This presentation would not have been possible without:

Images comes from: https://unsplash.com/

java-in-container's People

Contributors

mateuszdyminski avatar

Stargazers

 avatar  avatar

Watchers

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