Skip to content

Instantly share code, notes, and snippets.

@amjadafanah
Last active July 30, 2016 12:18
Show Gist options
  • Save amjadafanah/5e880ca1d8ba2afcb193 to your computer and use it in GitHub Desktop.
Save amjadafanah/5e880ca1d8ba2afcb193 to your computer and use it in GitHub Desktop.
Docker Java Names Directory application. This 3-Tier Docker Java Application is deployed on Docker Nginx, Tomcat Application Server and MariaDB. Once the application is deployed, get access to monitoring, alerts and notifications, continuous delivery using Jenkins, application backups, scale in/out, in-browser terminal to access the containers, …
LB:
image: nginx:latest
publish_all: true
mem_min: 50m
host: host1
plugins:
- !plugin
id: 0H1Nk
restart: true
lifecycle: on_create, post_scale_out:AppServer, post_scale_in:AppServer, post_start:AppServer, post_stop:AppServer
arguments:
# Use container_private_ip if you're using Docker networking
- servers=server {{AppServer | container_private_ip}}:8080;
# Use container_hostname if you're using Weave networking
#- servers=server {{AppServer | container_hostname}}:8080;
AppServer:
image: tomcat:8.0.21-jre8
mem_min: 600m
host: host1
cluster_size: 1
environment:
- database_driverClassName=com.mysql.jdbc.Driver
- database_url=jdbc:mysql://{{MariaDB|container_hostname}}:3306/{{MariaDB|MYSQL_DATABASE}}
- database_username={{MariaDB|MYSQL_USER}}
- database_password={{MariaDB|MYSQL_ROOT_PASSWORD}}
plugins:
- !plugin
id: oncXN
restart: true
arguments:
- file_url=https://github.com/dchqinc/dchq-docker-java-example/raw/master/dbconnect.war
- dir=/usr/local/tomcat/webapps/ROOT.war
- delete_dir=/usr/local/tomcat/webapps/ROOT
MariaDB:
image: mariadb:latest
host: host1
mem_min: 400m
environment:
- MYSQL_USER=root
- MYSQL_DATABASE=names
- MYSQL_ROOT_PASSWORD={{alphanumeric|8}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment