Skip to content

Instantly share code, notes, and snippets.

@danajp
Created March 29, 2016 01:48
Show Gist options
  • Save danajp/5af962e4a2109ac52158 to your computer and use it in GitHub Desktop.
Save danajp/5af962e4a2109ac52158 to your computer and use it in GitHub Desktop.
Mesos/Marathon stack
# Docker compose config file. This will configure marathon for you in docker containers. Web consoles port
# numbers are:
#
# Marathon: 8080
# Mesos: 5050
# Zookeeper: 8082/exhibitor/v1/ui/index.html
#
# This file now requires that you have the DOCKER_IP environment
# variable present when you run `docker-compose up`. This should be
# set to the address of your docker virtual machine, or 'localhost' if
# you're running linux.
zookeeper:
image: netflixoss/exhibitor:1.5.2
hostname: zookeeper
restart: always
ports:
- "2181:2181"
- "2888:2888"
- "3888:3888"
- "8082:8080"
mesosmaster:
build: docker/mesos
command: "mesos-master --cluster=dev-local"
restart: always
ports:
- "5050:5050"
links:
- zookeeper:zk
environment:
- MESOS_ZK=zk://zk:2181/mesos
- MESOS_LOG_DIR=/var/log/mesos
- MESOS_QUORUM=1
- MESOS_REGISTRY=in_memory
- MESOS_WORK_DIR=/var/lib/mesos
marathon:
# We can use the latest RC, the latest release, or older versions.
image: mesosphere/marathon:v0.15.2
# image: mesosphere/marathon:latest-rc
# image: mesosphere/marathon:latest
links:
- zookeeper:zk
- mesosmaster:master
command: "--master zk://zk:2181/mesos --zk zk://zk:2181/marathon --task_launch_timeout 300000 --event_subscriber http_callback"
restart: always
ports:
- "8080:8080"
mesosslave:
build: docker/mesos
command: "mesos-slave"
restart: always
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
links:
- zookeeper:zk
entrypoint: mesos-slave
environment:
- MESOS_ATTRIBUTES=worker_type:.apps.service.web.worker.dajoku.
- MESOS_CONTAINERIZERS=docker,mesos
- MESOS_HOSTNAME=$DOCKER_IP
- MESOS_MASTER=zk://zk:2181/mesos
- MESOS_LOG_DIR=/var/log/mesos
- MESOS_LOGGING_LEVEL=INFO
ports:
- "5051:5051"
FROM ubuntu:trusty
ENV VERSION=0.26.0-0.2.145.ubuntu1404
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF && \
echo deb http://repos.mesosphere.io/ubuntu trusty main > \
/etc/apt/sources.list.d/mesosphere.list && \
apt-get update && \
apt-get -y install curl mesos=$VERSION
# http://docs.docker.com/installation/ubuntulinux/
RUN curl -fLsS https://get.docker.com/ | sh
ENV MESOS_WORK_DIR /tmp/mesos
ENV MESOS_CONTAINERIZERS docker,mesos
ENV MESOS_LOGGING_LEVEL INFO
# https://mesosphere.github.io/marathon/docs/native-docker.html
ENV MESOS_EXECUTOR_REGISTRATION_TIMEOUT 5mins
VOLUME /tmp/mesos
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
#!/bin/sh
PRINCIPAL=${PRINCIPAL:-root}
if [ -n "$SECRET" ]; then
touch /tmp/credential
chmod 600 /tmp/credential
echo -n "$PRINCIPAL $SECRET" > /tmp/credential
export MESOS_CREDENTIAL=/tmp/credential
fi
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment