This project shows how to use Docker on your Java development environment. And how to quickly run, test and debug a whole Java EE 7 / Angular / WildFly / Redis / MySQL Application with Docker containers:
This application was used at @HanoiJUG to illustrate this talk: http://www.slideshare.net/HanoiJUG/improve-your-java-environment-with-docker
You only need Docker (version 1.9+), docker-machine and docker-compose (1.5+) installed.
# Create your docker environment
$ docker-machine create --driver virtualbox docker4dev-ee7-js
$ eval $(docker-machine env docker4dev-ee7-js)
# Get sources and Docker configuration files
$ git clone [email protected]:mgreau/docker4dev-tennistour-app.git
$ cd docker4dev-tennistour-app
# Build Maven and Angular projects
$ docker-compose -f app-build.yml up
# Starts all containers
$ docker-compose --x-networking up
# Open Batch Java EE 7 Application
# You should have some players already created
$ open http://$(docker-machine ip docker4dev-ee7-js):7777
# Open Angular Websocket Java EE 7 Application
# You should be able to bet on 4 matches of US OPEN
$ open http://$(docker-machine ip docker4dev-ee7-js):8888
-
Uncomment the following lines at the end of the file ./docker/dev/run/frontend/httpd.conf+
#BalancerMember ws://${WEBSOCKET_HOST}_2:8080 #BalancerMember ws://${WEBSOCKET_HOST}_3:8080
#BalancerMember http://${WEBSOCKET_HOST}_2:8080 #BalancerMember http://${WEBSOCKET_HOST}_3:8080
-
Execute the commands below:
#Remove and recreate the ui container
$ docker-compose rm ui
$ docker-compose build ui
# Scale the realtime container to 3 containers
$ docker-compose --x-networking scale realtime=3
$ open http://$(docker-machine ip docker4dev-ee7-js):8888
# Play with the app and kill one or two *realtime* containers
TODO:
-
Check doc (commands…) and configuration to make the scale feature works out of the box
-
Use Consul and Fabio to discover containers