Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save amjadafanah/d4f094dd8446fdd7c2016b8301b1815b to your computer and use it in GitHub Desktop.
Save amjadafanah/d4f094dd8446fdd7c2016b8301b1815b to your computer and use it in GitHub Desktop.
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:
- database_driverClassName=org.postgresql.Driver
# Use this configuration with Docker networking
#- database_url=jdbc:postgresql://{{postgres_master|container_private_ip}}:5432/{{postgres_master|DB_NAME}}
# Use this configuration with Weave
- database_url=jdbc:postgresql://{{postgres_master|container_hostname}}:5432/{{postgres_master|DB_NAME}}
- database_username={{postgres_master|DB_USER}}
- database_password={{postgres_master|DB_PASS}}
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
postgres_master:
restart: always
host: host2
#ports:
# - 5432:5432
image: dchq/postgres:latest
environment:
- DEBUG=false
- DB_USER=root
- DB_PASS={{alphanumeric | 8}}
- DB_NAME=names
- DB_UNACCENT=false
- REPLICATION_MODE=master
- REPLICATION_USER=replicator
- REPLICATION_PASS={{alphanumeric | 8}}
volumes:
- "/var/lib/rexray/volumes/dchq-postgres-master/data:/var/lib/postgresql"
plugins:
- !plugin
# Only mounts volume
#id: CmA35
# Create and mount volume
id: 8CF1C
lifecycle: exec_on_machine pre_create
arguments:
- VOLUME_NAME=dchq-postgres-master
- VOLUME_SIZE=5
# Nightly snapshot
#- !plugin
# id: dE4qG
# lifecycle: exec_on_machine cron(0 1 1 * * ?)
# arguments:
# - VOLUME_NAME=dchq-postgres-master
postgres_slave:
restart: always
host: host3
#ports:
# - 5432:5432
image: dchq/postgres:latest
environment:
- DEBUG=false
- REPLICATION_MODE=slave
# Use this configuration with Docker networking
#- REPLICATION_HOST={{postgres_master | container_private_ip}}
# Use this configuration with Weave
- REPLICATION_HOST={{postgres_master | container_hostname}}
- REPLICATION_USER={{postgres_master | REPLICATION_USER}}
- REPLICATION_PASS={{postgres_master | REPLICATION_PASS}}
- REPLICATION_PORT=5432
volumes:
- "/var/lib/rexray/volumes/dchq-postgres-slave/data:/var/lib/postgresql"
plugins:
- !plugin
# Only mounts volume
#id: CmA35
# Create and mount volume
id: 8CF1C
lifecycle: exec_on_machine pre_create
arguments:
- VOLUME_NAME=dchq-postgres-slave
- VOLUME_SIZE=5
# Nightly snapshot
#- !plugin
# id: dE4qG
# lifecycle: exec_on_machine cron(0 1 1 * * ?)
# arguments:
# - VOLUME_NAME=dchq-postgres-master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment