Skip to content

Instantly share code, notes, and snippets.

@jasonlai
Created April 8, 2017 20:21
Show Gist options
  • Save jasonlai/f10d97377285b77658e49f1dfa153b6a to your computer and use it in GitHub Desktop.
Save jasonlai/f10d97377285b77658e49f1dfa153b6a to your computer and use it in GitHub Desktop.
Mesos build scripts with Docker
echo 'deb http://httpredir.debian.org/debian jessie-backports main contrib non-free' >> /etc/apt/sources.list
apt-get update
apt-get install -y apt-transport-https ca-certificates
apt-get install -y linux-image-4.7.0-0.bpo.1-amd64 linux-headers-4.7.0-0.bpo.1-amd64 linux-base=4.3~bpo8+1
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo 'deb https://apt.dockerproject.org/repo debian-jessie main' > /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install -y docker-engine
apt-get install -y git jq vim
apt-get install -y htop netcat-openbsd tmux tree
# Mesos Build
apt-get update
apt-get install -y curl git netcat-openbsd tar tree wget
apt-get install -y openjdk-7-jdk
apt-get install -y autoconf libtool
apt-get install -y build-essential python-dev libcurl4-nss-dev libsasl2-dev libsasl2-modules maven libapr1-dev libsvn-dev libz-dev
# Mesos Master
sudo docker run --net=host -it --rm --name=mesos-master -w /mnt -v ~/mesos:/mnt -v ~/build-cache/m2:/root/.m2 -v ~/build-cache/pip:/root/.cache/pip mesos-build
docker run -dit --name=mesos-master --net=host -v ~/mesos:/mnt -v /var/lib/mesos:/var/lib/mesos -w /var/lib/mesos --entrypoint=bash mesos-build -c 'tar zxvf /mnt/build/pkg/mesos.tar.gz -C /; ldconfig; exec mesos master --work_dir=/var/lib/mesos/x`master --ip=172.17.8.101'
docker run -dit --name=mesos-agent --pid=host --privileged -v ~/mesos:/mnt -v /run/systemd:/run/systemd -v /var/lib/mesos:/var/lib/mesos -w /var/lib/mesos --entrypoint=bash mesos-build -c 'tar zvf /mnt/build/pkg/mesos.tar.gz -C /; ldconfig; exec mesos agent --work_dir=/var/lib/mesos/agent --master=172.17.8.101:5050'
docker run -it --rm --name=mesos-agent --pid=host --privileged -e MESOS_SYSTEMD_ENABLE_SUPPORT=false -v ~/mesos:/mnt -v /run/systemd:/run/systemd -v /sys:/sys -v /var/lib/mesos:/var/lib/mesos -w /var/lib/mesos --entrypoint=bash mesos-build -c 'tar zxf /mnt/build/pkg/mesos.tar.gz -C /; ldconfig; exec bash'
docker run -it --rm --name=mesos-executor -v ~/mesos:/mnt -v /var/lib/mesos:/var/lib/mesos -w /var/lib/mesos --entrypoint=bash mesos-build -c 'tar zxf /mnt/build/pkg/mesos.tar.gz -C /; ldconfig; exec bash'
docker run -it --rm --name=mesos -v ~/mesos/build:/mnt -v /var/lib/mesos:/var/lib/mesos -w /var/lib/mesos --entrypoint=bash mesos-build -c 'tar zxf /mnt/pkg/mesos.tar.gz -C /; ldconfig; exec bash'
# Mesos Master
docker run \
--name=mesos-master \
--net=host \
-dit \
-v /var/lib/mesos:/var/lib/mesos \
-v /var/run/mesos:/var/run/mesos \
mesos \
master \
--work_dir=/var/lib/mesos/master \
--ip=172.17.8.101
# Mesos Agent
docker run \
--name=mesos-agent \
--pid=host \
--privileged \
-dit \
-e MESOS_SYSTEMD_ENABLE_SUPPORT=false \
-v /usr/bin/docker:/usr/bin/docker \
-v /var/lib/docker:/var/lib/docker \
-v /var/lib/mesos:/var/lib/mesos \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/run/mesos:/var/run/mesos \
-v /sys:/sys \
mesos \
agent \
--work_dir=/var/lib/mesos/agent \
--master=172.17.8.101:5050 \
--isolation=cgroups/cpu,cgroups/mem,cgroups/blkio,namespaces/pid,docker/runtime,filesystem/linux \
--image_providers=docker \
--docker_store_dir=/var/lib/mesos/store
# Mesos from source image
apt-get update
apt-get install -y netcat-openbsd tree
apt-get install -y curl git libcurl3-nss libsvn1 tar wget
tar zxf /mnt/build/pkg/mesos.tar.gz -C /
# Mesos build
sudo docker run --rm -it --name mesos-build -w /mnt -v ~/mesos:/mnt -v ~/build-cache/m2:/root/.m2 -v ~/build-cache/pip:/root/.cache/pip mesos-build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment