Skip to content

Instantly share code, notes, and snippets.

@xiaods
Last active April 5, 2017 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xiaods/c5a11e3ab51e89a9609edc2c477f7ea8 to your computer and use it in GitHub Desktop.
Save xiaods/c5a11e3ab51e89a9609edc2c477f7ea8 to your computer and use it in GitHub Desktop.
MESOS-7210_test-case-steps

firstly install minimesos, then use minimesos to get overrall mesos image. then stop all containers.

HOST_IP=172.28.128.3


### Mesos Master
./bin/mesos-master.sh --hostname=${HOST_IP} --ip=${HOST_IP} --zk=zk://${HOST_IP}:2181/mesos --port=5050 --quorum=1 --work_dir=/tmp/mesos --log_dir=/tmp/log/mesos


### Zookeeper
docker run -d \
-p 2181:2181 \
-p 2888:2888 \
-p 3888:3888 \
jplock/zookeeper:3.4.6

### Marathon
docker run \
-d \
-p 8080:8080 \
mesosphere/marathon:v1.4.2 --master zk://${HOST_IP}:2181/mesos --zk zk://${HOST_IP}:2181/marathon

for testing mesos agent, we should add a trick to mount build dir from mesos source.

docker run -it \
  		-e MESOS_EXECUTOR_REGISTRATION_TIMEOUT=5mins \
  		-e MESOS_HOSTNAME=${HOST_IP} \
  		-e MESOS_LOGGING_LEVEL=WARNING \
  		-e MESOS_WORK_DIR=/tmp/mesos \
  		-e MESOS_CONTAINERIZERS=docker,mesos \
  		-e MESOS_LOG_DIR=/tmp/log/mesos \
  		-e MESOS_IP=${HOST_IP} \
  		-e MESOS_DOCKER_REMOVE_DELAY=60mins \
  		-e MESOS_ISOLATION=cgroups/cpu,cgroups/mem \
  		-e MESOS_PORT=5051 \
  		-e MESOS_MASTER=zk://${HOST_IP}:2181/mesos \
  		-e MESOS_SYSTEMD_ENABLE_SUPPORT=false \
  		--log-driver=json-file \
  		--name test-agent \
        --net host \
        --privileged \
        --restart always \
  		-v /data/docker:/data/docker \
  		-v /var/run/docker.sock:/var/run/docker.sock \
  		-v /usr/bin/docker:/usr/bin/docker \
 		-v /sys/fs/cgroup:/sys/fs/cgroup \
  		-v /tmp/mesos:/tmp/mesos \
        -v /home/vagrant/build:/home/vagrant/build \
        --entrypoint=bash \
		mesosphere/mesos-slave:1.2.0-rc2

then setup some missing:

apt-get update

apt-get  -y install g++

ldconfig -v|grep libsvn_delta-1.so.0

cd /usr/lib/x86_64-linux-gnu

ln -s libsasl2.so.2.0.25  libsasl2.so.3

ln -s libsvn_subr-1.so.1.0.0   libsvn_subr-1.so.0

ln -s libsvn_delta-1.so.1.0.0  libsvn_delta-1.so.0

ln -s /bin/sed /usr/bin/sed

then we can start mesos agent again:

### Mesos Slave
./bin/mesos-slave.sh --master=zk://${HOST_IP}:2181/mesos --log_dir=/tmp/log/mesos --logging_level=INFO --work_dir=/tmp/mesos --systemd_enable_support=false --hostname=${HOST_IP} --ip=${HOST_IP} --containerizers=docker,mesos --executor_registration_timeout=5mins --isolation=cgroups/cpu,cgroups/mem --docker_mesos_image=mesosphere/mesos-slave:1.2.0-rc2

then use marathon to send a nginx task with MESOS_HTTP native health check.

{
  "id": "/nginx",
  "cmd": null,
  "cpus": 1,
  "mem": 128,
  "disk": 0,
  "instances": 1,
  "acceptedResourceRoles": [
    "*"
  ],
  "container": {
    "type": "DOCKER",
    "volumes": [],
    "docker": {
      "image": "nginx",
      "network": "BRIDGE",
      "portMappings": [
        {
          "containerPort": 80,
          "hostPort": 0,
          "servicePort": 10000,
          "protocol": "tcp",
          "name": "web",
          "labels": {}
        }
      ],
      "privileged": false,
      "parameters": [],
      "forcePullImage": false
    }
  },
  "healthChecks": [
    {
      "gracePeriodSeconds": 300,
      "intervalSeconds": 60,
      "timeoutSeconds": 20,
      "maxConsecutiveFailures": 3,
      "portIndex": 0,
      "path": "/",
      "protocol": "MESOS_HTTP",
      "delaySeconds": 15
    }
  ],
  "portDefinitions": [
    {
      "port": 10000,
      "protocol": "tcp",
      "name": "default",
      "labels": {}
    }
  ]
}

then the nginx task report:

Failed to load unknown flag 'container'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment