ambassador:
  image: cpuguy83/docker-grand-ambassador:0.9.1
  volumes:
  - /var/run/docker.sock:/var/run/docker.sock
  command: "-name docker_apiserver_1"
etcd:
  hostname: etcd
  image: quay.io/coreos/etcd:v2.2.1
  ports: [ "4001:4001" ]
  command: >
    --listen-client-urls 'http://etcd:4001'
    --advertise-client-urls 'http://etcd:4001'
    --initial-cluster-state new
mesosmaster1:
  hostname: mesosmaster1
  image: mesosphere/mesos:0.24.0-1.0.27.ubuntu1404
  entrypoint: [ "mesos-master" ]
  ports: [ "5050:5050" ]
  environment:
  - MESOS_HOSTNAME=mesosmaster1
  - MESOS_PORT=5050
  - MESOS_LOG_DIR=/var/log/mesos
  - MESOS_QUORUM=1
  - MESOS_REGISTRY=in_memory
  - MESOS_WORK_DIR=/var/lib/mesos
  links:
  - etcd
  - "ambassador:apiserver"
mesosslave:
  hostname: mesosslave
  privileged: true
  image: mesosphere/mesos-slave-dind:0.2.2_mesos-0.24.0_docker-1.8.2_ubuntu-14.04.3
  ports: [ "10248","10249" ]
  entrypoint:
  - bash
  - -xc
  - >
    NAME=$$(cut -f2 -d/ <<<$${MESOSMASTER1_NAME}) &&
    N=$${NAME##*_} &&
    DOCKER_NETWORK_OFFSET=0.0.$${N}.0
    exec wrapdocker mesos-slave
    --work_dir="/var/tmp/mesos/$${N}"
    --attributes="rack:$${N};gen:201$${N}"
    --hostname=$$(getent hosts mesosslave | cut -d' ' -f1 | sort -u | tail -1)
  command: []
  environment:
  - MESOS_MASTER=mesosmaster1:5050
  - MESOS_PORT=5051
  - MESOS_LOG_DIR=/var/log/mesos
  - MESOS_LOGGING_LEVEL=INFO
  - MESOS_RESOURCES=cpus:4;mem:1280;disk:25600;ports:[8000-21099]
  - MESOS_SWITCH_USER=0
  - MESOS_CONTAINERIZERS=docker,mesos
  - MESOS_ISOLATION=cgroups/cpu,cgroups/mem
  - DOCKER_DAEMON_ARGS
  links:
  - etcd
  - mesosmaster1
  - "ambassador:apiserver"
  volumes:
  - ${MESOS_DOCKER_WORK_DIR}/mesosslave:/var/tmp/mesos
apiserver:
  hostname: apiserver
  image: mesosphere/kubernetes-mesos
  entrypoint:
  - /bin/bash
  - "-ceu"
  - >
    echo "Hostname: $$(hostname -f) ($$(hostname -f | xargs resolveip))" &&
    (grep "mesos-master\s*=" /opt/mesos-cloud.conf || echo "  mesos-master = mesosmaster1:5050" >> /opt/mesos-cloud.conf) &&
    await-health-check "-t=${MESOS_DOCKER_ETCD_TIMEOUT}" http://etcd:4001/health &&
    await-health-check "-t=${MESOS_DOCKER_MESOS_TIMEOUT}" http://mesosmaster1:5050/health &&
    await-file "-t=${KUBE_KEYGEN_TIMEOUT}" /var/run/kubernetes/auth/apiserver.crt &&
    km apiserver
    --address=$$(resolveip apiserver)
    --external-hostname=apiserver
    --etcd-servers=http://etcd:4001
    --port=8888
    --admission-control=NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota
    --authorization-mode=AlwaysAllow
    --token-auth-file=/var/run/kubernetes/auth/token-users
    --basic-auth-file=/var/run/kubernetes/auth/basic-users
    --service-account-key-file=/var/run/kubernetes/auth/service-accounts.key
    --service-cluster-ip-range=10.10.10.0/24
    --service-node-port-range=30000-32767
    --cloud-provider=mesos
    --cloud-config=/opt/mesos-cloud.conf
    --tls-cert-file=/var/run/kubernetes/auth/apiserver.crt
    --tls-private-key-file=/var/run/kubernetes/auth/apiserver.key
    --runtime-config=experimental/v1alpha1
    --v=4
  ports: [ "8888:8888", "6443:6443" ]
  volumes:
  - ${MESOS_DOCKER_WORK_DIR}/auth:/var/run/kubernetes/auth:ro
  links:
  - etcd
  - mesosmaster1
controller:
  hostname: controller
  image: mesosphere/kubernetes-mesos
  entrypoint:
  - /bin/bash
  - "-ceu"
  - >
    echo "Hostname: $$(hostname -f) ($$(hostname -f | xargs resolveip))" &&
    (grep "mesos-master\s*=" /opt/mesos-cloud.conf || echo "  mesos-master = mesosmaster1:5050" >> /opt/mesos-cloud.conf) &&
    await-health-check "-t=${MESOS_DOCKER_MESOS_TIMEOUT}" http://mesosmaster1:5050/health &&
    await-health-check "-t=${MESOS_DOCKER_API_TIMEOUT}" http://apiserver:8888/healthz &&
    km controller-manager
    --address=$$(resolveip controller)
    --master=http://apiserver:8888
    --cloud-config=/opt/mesos-cloud.conf
    --service-account-private-key-file=/var/run/kubernetes/auth/service-accounts.key
    --root-ca-file=/var/run/kubernetes/auth/root-ca.crt
    --v=4
  volumes:
  - ${MESOS_DOCKER_WORK_DIR}/auth:/var/run/kubernetes/auth:ro
  links:
  - mesosmaster1
  - apiserver
scheduler:
  hostname: scheduler
  image: mesosphere/kubernetes-mesos
  entrypoint:
  - /bin/bash
  - "-ceu"
  - >
    echo "Hostname: $$(hostname -f) ($$(hostname -f | xargs resolveip))" &&
    (grep "mesos-master\s*=" /opt/mesos-cloud.conf || echo "  mesos-master = mesosmaster1:5050" >> /opt/mesos-cloud.conf) &&
    await-health-check "-t=${MESOS_DOCKER_ETCD_TIMEOUT}" http://etcd:4001/health &&
    await-health-check "-t=${MESOS_DOCKER_MESOS_TIMEOUT}" http://mesosmaster1:5050/health &&
    await-health-check "-t=${MESOS_DOCKER_API_TIMEOUT}" http://apiserver:8888/healthz &&
    km scheduler
    --address=$$(resolveip scheduler)
    --hostname-override=scheduler
    --etcd-servers=http://etcd:4001
    --mesos-user=root
    --api-servers=http://apiserver:8888
    --mesos-master=mesosmaster1:5050
    --cluster-dns=10.10.10.10
    --cluster-domain=cluster.local
    --mesos-executor-cpus=1.0
    --mesos-sandbox-overlay=/opt/sandbox-overlay.tar.gz
    --v=4
    --executor-logv=4
    --profiling=true
  links:
  - etcd
  - mesosmaster1
  - apiserver
keygen:
  image: mesosphere/kubernetes-mesos-keygen
  command:
  - apiserver
  - /var/run/kubernetes/auth
  volumes:
  - ${MESOS_DOCKER_WORK_DIR}/auth:/var/run/kubernetes/auth
  links:
  - apiserver
