Skip to content

Instantly share code, notes, and snippets.

@chenhong805
Created March 11, 2018 06:54
Show Gist options
  • Save chenhong805/963f5a2c80b96c3a6c0530ea4eb28047 to your computer and use it in GitHub Desktop.
Save chenhong805/963f5a2c80b96c3a6c0530ea4eb28047 to your computer and use it in GitHub Desktop.
my docker dev stack: standalone spark cluster + zookeeper + kafka + kafka manager + cassandra + jenkins + sshd proxy + switchyOmega to access docker network
Host composestack-proxy
Hostname localhost
Port 2223
User root
DynamicForward 8085
# Please note we are using Docker Compose version 3
version: '3'
services:
# Configuration for our seed cassandra node. The node is call DC1N1
# .i.e Node 1 in Data center 1.
cassandra-node-1-composestack-service:
hostname: cassandra-node-1-composestack-service
# Cassandra image for Cassandra version 3.1.0. This is pulled
# from the docker store.
image: cassandra:3.10
# In case this is the first time starting up cassandra we need to ensure
# that all nodes do not start up at the same time. Cassandra has a
# 2 minute rule i.e. 2 minutes between each node boot up. Booting up
# nodes simultaneously is a mistake. This only needs to happen the firt
# time we bootup. Configuration below assumes if the Cassandra data
# directory is empty it means that we are starting up for the first
# time.
command: bash -c 'if [ -z "$$(ls -A /var/lib/cassandra/)" ] ; then sleep 0; fi && /docker-entrypoint.sh cassandra -f'
# Network for the nodes to communicate
networks:
- composestack-net
# Maps cassandra data to a local folder. This preserves data across
# container restarts. Note a folder n1data get created locally
volumes:
- ./n1data:/var/lib/cassandra
# Docker constainer environment variable. We are using the
# CASSANDRA_CLUSTER_NAME to name the cluster. This needs to be the same
# across clusters. We are also declaring that DC1N1 is a seed node.
environment:
- CASSANDRA_CLUSTER_NAME=composestack-cluster
- CASSANDRA_SEEDS=cassandra-node-1-composestack-service
# Exposing ports for inter cluste communication
expose:
- 7000
- 7001
- 7199
- 9042
- 9160
# Cassandra ulimt recommended settings
ulimits:
memlock: -1
nproc: 32768
nofile: 100000
cassandra-node-2-composestack-service:
hostname: cassandra-node-2-composestack-service
# Cassandra image for Cassandra version 3.1.0. This is pulled
# from the docker store.
image: cassandra:3.10
# In case this is the first time starting up cassandra we need to ensure
# that all nodes do not start up at the same time. Cassandra has a
# 2 minute rule i.e. 2 minutes between each node boot up. Booting up
# nodes simultaneously is a mistake. This only needs to happen the firt
# time we bootup. Configuration below assumes if the Cassandra data
# directory is empty it means that we are starting up for the first
# time.
command: bash -c 'if [ -z "$$(ls -A /var/lib/cassandra/)" ] ; then sleep 60; fi && /docker-entrypoint.sh cassandra -f'
# Network for the nodes to communicate
networks:
- composestack-net
# Maps cassandra data to a local folder. This preserves data across
# container restarts. Note a folder n1data get created locally
volumes:
- ./n2data:/var/lib/cassandra
# Docker constainer environment variable. We are using the
# CASSANDRA_CLUSTER_NAME to name the cluster. This needs to be the same
# across clusters. We are also declaring that DC1N1 is a seed node.
environment:
- CASSANDRA_CLUSTER_NAME=composestack-cluster
- CASSANDRA_SEEDS=cassandra-node-1-composestack-service
# Since DC1N1 is the seed node
depends_on:
- cassandra-node-1-composestack-service
# Exposing ports for inter cluste communication. Note this is already
# done by the docker file. Just being explict about it.
expose:
# Intra-node communication
- 7000
# TLS intra-node communication
- 7001
# JMX
- 7199
# CQL
- 9042
# Thrift service
- 9160
# Cassandra ulimt recommended settings
ulimits:
memlock: -1
nproc: 32768
nofile: 100000
spark-master-composestack-service:
hostname: spark-master-composestack-service
image: jinhongc/spark-master:2.2.0-hadoop2.7
networks:
- composestack-net
volumes:
- /Users:/Users
expose:
- 6066
- 7077
- 8080
- 4040
spark-worker-1-composestack-service:
hostname: spark-worker-1-composestack-service
links:
- spark-master-composestack-service:spark-master
image: jinhongc/spark-worker:2.2.0-hadoop2.7
networks:
- composestack-net
depends_on:
- spark-master-composestack-service
volumes:
- /Users:/Users
expose:
- 6066
- 7077
- 8080
- 4040
spark-worker-2-composestack-service:
hostname: spark-worker-2-composestack-service
links:
- spark-master-composestack-service:spark-master
image: jinhongc/spark-worker:2.2.0-hadoop2.7
networks:
- composestack-net
depends_on:
- spark-master-composestack-service
volumes:
- /Users:/Users
expose:
- 6066
- 7077
- 8080
- 4040
zookeeper-node-1-composestack-service:
hostname: zookeeper-node-1-composestack-service
image: zookeeper:3.4
networks:
- composestack-net
volumes:
- /Users:/Users
expose:
- 2181
kafka-node-1-composestack-service:
hostname: kafka-node-1-composestack-service
image: ches/kafka
networks:
- composestack-net
volumes:
- /Users:/Users
expose:
- 9092
environment:
- ZOOKEEPER_IP=zookeeper-node-1-composestack-service
kafka-manager-composestack-service:
hostname: kafka-manager-composestack-service
image: dockerkafka/kafka-manager
networks:
- composestack-net
volumes:
- /Users:/Users
ports:
- "9004:9000"
expose:
- 9000
environment:
- ZK_HOSTS=zookeeper-node-1-composestack-service
portainer-composestack-service:
hostname: portainer-composestack-service
image: portainer/portainer
networks:
- composestack-net
volumes:
- /Users:/Users
- /var/run/docker.sock:/var/run/docker.sock
ports:
- "10002:9000"
expose:
- 9000
sshd-proxy-composestack-service:
hostname: sshd-proxy-composestack-service
image: rastasheep/ubuntu-sshd:14.04
networks:
- composestack-net
dns:
- 8.8.8.8
- 9.9.9.9
# command: bash -c 'apt-get install -y software-properties-common python-software-properties && add-apt-repository ppa:webupd8team/java && apt-get update && apt-get install -y oracle-java8-installer && apt install nohup && wget www.scala-lang.org/files/archive/scala-2.11.8.deb && sudo dpkg -i scala-2.11.8.deb && echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list && sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823 && sudo apt-get update && sudo apt-get install sbt'
volumes:
- /Users:/Users
- /var/run/docker.sock:/var/run/docker.sock
ports:
- "2223:22"
expose:
- 9000
jenkins-composestack-service:
hostname: jenkins-composestack-service
image: jenkins/jenkins:lts
networks:
- composestack-net
volumes:
- /Users:/Users
- /Users/jchen/.containers-data/jenkins:/var/jenkins_home
expose:
- 8080
networks:
composestack-net:
var FindProxyForURL = function(init, profiles) {
return function(url, host) {
"use strict";
var result = init, scheme = url.substr(0, url.indexOf(":"));
do {
result = profiles[result];
if (typeof result === "function") result = result(url, host, scheme);
} while (typeof result !== "string" || result.charCodeAt(0) === 43);
return result;
};
}("+auto switch", {
"+auto switch": function(url, host, scheme) {
"use strict";
if (/-compoststack-service$/.test(host)) return "+compostack";
return "DIRECT";
},
"+compostack": function(url, host, scheme) {
"use strict";
if (/^127\.0\.0\.1$/.test(host) || /^::1$/.test(host) || /^localhost$/.test(host)) return "DIRECT";
return "SOCKS5 localhost:8085; SOCKS localhost:8085";
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment