├── sample ├── hello-world.sh └── hello-world.json ├── README.md ├── LICENSE └── docker-compose.yml /sample/hello-world.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | curl -X POST -H "Content-Type: application/json" 127.0.0.1:8080/v2/apps -d @sample/hello-world.json 4 | -------------------------------------------------------------------------------- /sample/hello-world.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "hello-world", 3 | "container": { 4 | "type": "DOCKER", 5 | "docker": { 6 | "image": "dockercloud/hello-world", 7 | "network": "BRIDGE", 8 | "portMappings": [ 9 | { "containerPort": 80, "hostPort": 0, "protocol": "tcp"} 10 | ], 11 | "privileged": false, 12 | "parameters": [ 13 | { "key": "memory", "value": "32m" } 14 | ] 15 | } 16 | }, 17 | "cpus": 0.1, 18 | "mem": 16.0, 19 | "disk": 0.0, 20 | "maxLaunchDelaySeconds": 600, 21 | "instances": 1 22 | } 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mesos-marathon Demo 2 | 3 | docker-compose on mesos with marathon 4 | 5 | ## Dependencies 6 | 7 | * Docker Engine 1.13.0+ 8 | * Docker Compose 1.10.0+ 9 | 10 | ## QuickStart 11 | 12 | * Clone the repo: `git clone git@github.com:uzyexe/mesos-marathon-demo.git && cd mesos-marathon-demo` 13 | * Run the local environment: `docker-compose up` 14 | * Web Browser Access: 15 | - Marathon WebUI: [http://127.0.0.1:8080/ui/#/apps](http://127.0.0.1:8080/ui/#/apps) 16 | - Mesos WebUI: [http://127.0.0.1:5050](http://127.0.0.1:5050) 17 | * Run the hello-world: `./sample/hello-world.sh` 18 | 19 | # Authors 20 | 21 | * Shuji Yamada () 22 | 23 | ## License 24 | 25 | This project is licensed under the terms of the MIT license. 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2016 Shuji Yamada 2 | All Rights Reserved. 3 | 4 | MIT LICENSE 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | zookeeper: 5 | image: zookeeper:3.4.13 6 | hostname: zookeeper 7 | ports: 8 | - "2181:2181" 9 | networks: 10 | app_net: 11 | ipv4_address: 172.16.121.2 12 | 13 | mesos-master: 14 | image: mesosphere/mesos-master:1.7.1 15 | privileged: true 16 | hostname: localhost 17 | ports: 18 | - "5050:5050" 19 | networks: 20 | app_net: 21 | ipv4_address: 172.16.121.3 22 | links: 23 | - zookeeper 24 | depends_on: 25 | - zookeeper 26 | environment: 27 | MESOS_ZK: zk://zookeeper:2181/mesos 28 | MESOS_QUORUM: 1 29 | MESOS_CLUSTER: docker-compose 30 | # MESOS_REGISTRY: replicated_log # default is in_memory for some reason 31 | MESOS_HOSTNAME: localhost 32 | MESOS_WORK_DIR: /var/tmp/mesos 33 | MESOS_LOG_DIR: /var/log/mesos 34 | LIBPROCESS_IP: 172.16.121.3 35 | 36 | mesos-slave: 37 | image: mesosphere/mesos-slave:1.7.1 38 | privileged: true 39 | hostname: localhost 40 | ports: 41 | - "5051:5051" 42 | networks: 43 | app_net: 44 | ipv4_address: 172.16.121.4 45 | links: 46 | - zookeeper:zookeeper 47 | - mesos-master:master.mesos 48 | depends_on: 49 | - zookeeper 50 | - mesos-master 51 | environment: 52 | MESOS_MASTER: zk://zookeeper:2181/mesos 53 | MESOS_CONTAINERIZERS: docker 54 | MESOS_PORT: 5051 55 | MESOS_RESOURCES: ports(*):[11000-11999] 56 | MESOS_HOSTNAME: localhost 57 | MESOS_WORK_DIR: /var/tmp/mesos 58 | MESOS_LOG_DIR: /var/log/mesos 59 | MESOS_SYSTEMD_ENABLE_SUPPORT: "false" 60 | LIBPROCESS_IP: 172.16.121.4 61 | volumes: 62 | - /var/run/docker.sock:/var/run/docker.sock 63 | 64 | marathon: 65 | image: mesosphere/marathon:v1.8.667 66 | entrypoint: 67 | - ./bin/start 68 | - --disable_ha 69 | hostname: localhost 70 | ports: 71 | - "8080:8080" 72 | networks: 73 | app_net: 74 | ipv4_address: 172.16.121.5 75 | links: 76 | - zookeeper 77 | - mesos-master 78 | depends_on: 79 | - zookeeper 80 | - mesos-master 81 | - mesos-slave 82 | environment: 83 | - MARATHON_ZK=zk://zookeeper:2181/marathon 84 | - MARATHON_MASTER=zk://zookeeper:2181/mesos 85 | - LIBPROCESS_IP=172.16.121.5 86 | 87 | networks: 88 | app_net: 89 | driver: bridge 90 | ipam: 91 | driver: default 92 | config: 93 | - 94 | subnet: 172.16.121.0/24 95 | --------------------------------------------------------------------------------