Skip to content

Instantly share code, notes, and snippets.

@amjadafanah
Last active January 18, 2016 00:03
Show Gist options
  • Save amjadafanah/55e9892979e6c8537d55 to your computer and use it in GitHub Desktop.
Save amjadafanah/55e9892979e6c8537d55 to your computer and use it in GitHub Desktop.
Docker Java application template with Apache HTTP Server for load balancing, Tomcat application server, Solr for full-text search and Mongo as the underlying database. The service discovery is provided through DCHQ's plug-in framework. The service discovery framework in DCHQ provides event-driven life-cycle stages that executes custom scripts to…
HTTP-LB:
image: httpd:latest
publish_all: true
mem_min: 50m
host: host1
plugins:
- !plugin
id: uazUi
restart: true
lifecycle: on_create, post_scale_out:AppServer, post_scale_in:AppServer
arguments:
# Use container_private_ip if you're using Docker networking
- BalancerMembers=BalancerMember http://{{AppServer | container_private_ip}}:8080
# Use container_hostname if you're using Weave networking
#- BalancerMembers=BalancerMember http://{{AppServer | container_hostname}}:8080
AppServer:
image: tomcat:8.0.21-jre8
mem_min: 600m
host: host1
cluster_size: 1
environment:
- mongo_url={{Mongo|container_private_ip}}:27017/dchq
- solr_host={{Solr|container_private_ip}}
- solr_port=8983
plugins:
- !plugin
id: oncXN
restart: true
arguments:
- file_url=https://github.com/dchqinc/dchq-docker-java-solr-mongo-cassandra-example/raw/master/dbconnect.war
- dir=/usr/local/tomcat/webapps/ROOT.war
- delete_dir=/usr/local/tomcat/webapps/ROOT
Solr:
image: solr:latest
mem_min: 300m
host: host1
publish_all: false
plugins:
- !plugin
id: doX8s
restart: true
arguments:
- file_url=https://github.com/dchqinc/dchq-docker-java-solr-mongo-cassandra-example/raw/master/names.zip
Mongo:
image: mongo:latest
host: host1
mem_min: 400m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment