Skip to content

Instantly share code, notes, and snippets.

@dims
Last active June 18, 2019 09:07
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dims/7ad86fb2ec12c91a4672 to your computer and use it in GitHub Desktop.
Save dims/7ad86fb2ec12c91a4672 to your computer and use it in GitHub Desktop.

Deploy Zookeeper

Save following as ~/zookeeper-3.4.8/conf/zoo.cfg

tickTime=2000
dataDir=/var/zookeeper
clientPort=2181

Start zookeeper

cd ~/zookeeper-3.4.8/
sudo bin/zkServer.sh start-foreground

Start Mesos Master

cd ~/mesos/build/
sudo ./bin/mesos-master.sh --ip=127.0.0.1 --work_dir=/var/lib/mesos --zk=zk://127.0.0.1:2181/mesos --quorum=1

Mesos Web UI : http://127.0.0.1:5050/

Start Mesos Slave

cd ~/mesos/build/
sudo ./bin/mesos-slave.sh --master=127.0.0.1:5050 --containerizers=docker,mesos --executor_registration_timeout=5mins

Start Marathon

cd ~/marathon/
sudo ./bin/start --master zk://127.0.0.1:2181/mesos --zk zk://127.0.0.1:2181/marathon

Marathon Web UI : http://127.0.0.1:8080/

Deploy Example Marathon App

Save the following into basic-3.json (Example from https://mesosphere.github.io/marathon/docs/application-basics.html)

{
  "id": "basic-3",
  "cmd": "python3 -m http.server 8080",
  "cpus": 0.5,
  "mem": 32.0,
  "container": {
    "type": "DOCKER",
    "docker": {
      "image": "python:3",
      "network": "BRIDGE",
      "portMappings": [
        { "containerPort": 8080, "hostPort": 0 }
      ]
    }
  }
}

Use curl to deploy and monitor:

curl -X POST http://127.0.0.1:8080/v2/apps -d @basic-3.json -H "Content-type: application/json"
curl http://localhost:8080/v2/apps | python -m json.tool

Check Docker container:

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                     NAMES
c09b82a92895        python:3            "/bin/sh -c 'python3 "   9 seconds ago       Up 8 seconds        0.0.0.0:31587->8080/tcp   mesos-1affdefd-256a-466d-9c54-512b0a967832-S1.371f1432-515b-47dd-ace8-71eccfe57d0e

Check Deployed Application:

$ curl http://localhost:31587

Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment