Skip to content

Commit 8dc82e6

Browse files
author
smothiki
committed
docs(mesos): describe Marathon installation and integration with deis
1 parent f6c06b8 commit 8dc82e6

7 files changed

Lines changed: 108 additions & 50 deletions

File tree

controller/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ setproctitle==1.1.8
1818
static==1.1.1
1919
South==1.0.2
2020
python-ldap==2.4.19
21-
marathon
21+
marathon==0.6.15

deisctl/cmd/cmd.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ func Start(targets []string, b backend.Backend) error {
7575
return StartPlatform(b, true)
7676
} else if targets[0] == swarm {
7777
return StartSwarm(b)
78-
}
79-
if targets[0] == mesos {
78+
} else if targets[0] == mesos {
8079
return StartMesos(b)
8180
}
8281
}
@@ -184,8 +183,7 @@ func Stop(targets []string, b backend.Backend) error {
184183
return StopPlatform(b, true)
185184
} else if targets[0] == swarm {
186185
return StopSwarm(b)
187-
}
188-
if targets[0] == mesos {
186+
} else if targets[0] == mesos {
189187
return StopMesos(b)
190188
}
191189
}
@@ -289,8 +287,7 @@ func Install(targets []string, b backend.Backend, checkKeys func() error) error
289287
return InstallPlatform(b, checkKeys, true)
290288
} else if targets[0] == swarm {
291289
return InstallSwarm(b)
292-
}
293-
if targets[0] == mesos {
290+
} else if targets[0] == mesos {
294291
return InstallMesos(b)
295292
}
296293
}
@@ -353,8 +350,7 @@ func Uninstall(targets []string, b backend.Backend) error {
353350
return UninstallPlatform(b, true)
354351
} else if targets[0] == swarm {
355352
return UnInstallSwarm(b)
356-
}
357-
if targets[0] == mesos {
353+
} else if targets[0] == mesos {
358354
return UninstallMesos(b)
359355
}
360356
}

deisctl/units/deis-mesos-marathon.service

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ RestartSec=20
1010
TimeoutStartSec=0
1111
ExecStartPre=-/bin/sh -c "etcdctl get /deis/scheduler/mesos/marathon >/dev/null 2>&1 || etcdctl mk /deis/scheduler/mesos/marathon"
1212
ExecStartPre=/bin/sh -c "etcdctl set /deis/scheduler/mesos/marathon $COREOS_PRIVATE_IPV4"
13-
ExecStartPre=-/usr/bin/docker kill coreos-mesos-marathon
14-
ExecStartPre=-/usr/bin/docker rm coreos-mesos-marathon
15-
ExecStartPre=/usr/bin/docker pull aledbf/mesos-marathon:0.22.1
16-
ExecStart=/usr/bin/sh -c "/usr/bin/docker run \
13+
ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/mesos-marathon` && docker history $IMAGE >/dev/null 2>&1 || docker pull $IMAGE"
14+
ExecStartPre=-/usr/bin/docker kill deis-mesos-marathon
15+
ExecStartPre=-/usr/bin/docker rm deis-mesos-marathon
16+
ExecStart=/usr/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/mesos-marathon` && docker run \
1717
--name=coreos-mesos-marathon \
1818
--net=host \
1919
-e HOST=$COREOS_PRIVATE_IPV4 \
20-
aledbf/mesos-marathon:0.22.1"
21-
ExecStop=-/usr/bin/docker stop coreos-mesos-marathon
20+
$IMAGE"
21+
ExecStop=-/usr/bin/docker stop deis-mesos-marathon
2222

2323
[Install]
2424
WantedBy=multi-user.target

deisctl/units/deis-mesos-master.service

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ EnvironmentFile=/etc/environment
88
Restart=on-failure
99
RestartSec=20
1010
TimeoutStartSec=0
11-
ExecStartPre=-/usr/bin/docker kill coreos-mesos-master
12-
ExecStartPre=-/usr/bin/docker rm coreos-mesos-master
13-
ExecStartPre=/bin/sh -c "docker inspect coreos-mesos-master-data >/dev/null 2>&1 || docker run --name coreos-mesos-master-data -v /tmp/mesos-master alpine:3.1 /bin/true"
14-
ExecStartPre=/usr/bin/docker pull aledbf/mesos-master:0.22.1
15-
ExecStart=/usr/bin/sh -c "/usr/bin/docker run \
16-
--volumes-from=coreos-mesos-master-data \
17-
--name=coreos-mesos-master \
11+
ExecStartPre=-/usr/bin/docker kill deis-mesos-master
12+
ExecStartPre=-/usr/bin/docker rm deis-mesos-master
13+
ExecStartPre=/bin/sh -c "docker inspect deis-mesos-master-data >/dev/null 2>&1 || docker run --name deis-mesos-master-data -v /tmp/mesos-master alpine:3.1 /bin/true"
14+
ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/mesos-master` && docker history $IMAGE >/dev/null 2>&1 || docker pull $IMAGE"
15+
ExecStart=/usr/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/mesos-master` && docker run \
16+
--volumes-from=deis-mesos-master-data \
17+
--name=deis-mesos-master \
1818
--privileged \
1919
--net=host \
2020
-e HOST=$COREOS_PRIVATE_IPV4 \
21-
aledbf/mesos-master:0.22.1"
22-
ExecStop=-/usr/bin/docker stop coreos-mesos-master
21+
$IMAGE"
22+
ExecStop=-/usr/bin/docker stop deis-mesos-master
2323

2424
[Install]
2525
WantedBy=multi-user.target

deisctl/units/deis-mesos-slave.service

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ EnvironmentFile=/etc/environment
88
Restart=on-failure
99
RestartSec=20
1010
TimeoutStartSec=0
11-
ExecStartPre=-/usr/bin/docker kill coreos-mesos-slave
12-
ExecStartPre=-/usr/bin/docker rm coreos-mesos-slave
13-
ExecStartPre=/usr/bin/docker pull aledbf/mesos-slave:0.22.1
14-
ExecStart=/usr/bin/sh -c "/usr/bin/docker run \
15-
--name=coreos-mesos-slave \
11+
ExecStartPre=-/usr/bin/docker kill deis-mesos-slave
12+
ExecStartPre=-/usr/bin/docker rm deis-mesos-slave
13+
ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/mesos-slave` && docker history $IMAGE >/dev/null 2>&1 || docker pull $IMAGE"
14+
ExecStart=/usr/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/mesos-slave` && docker run \
15+
--name=deis-mesos-slave \
1616
--net=host \
1717
--privileged \
1818
-e HOST=$COREOS_PRIVATE_IPV4 \
1919
-v /sys:/sys \
2020
-v /usr/bin/docker:/usr/bin/docker:ro \
2121
-v /var/run/docker.sock:/var/run/docker.sock \
2222
-v /lib64/libdevmapper.so.1.02:/lib/libdevmapper.so.1.02:ro \
23-
aledbf/mesos-slave:0.22.1"
23+
$IMAGE"
2424
ExecStop=/usr/bin/docker stop coreos-mesos-slave
2525

2626
[Install]

deisctl/units/deis-mesos-zk.service

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ Restart=on-failure
99
RestartSec=20
1010
TimeoutStartSec=0
1111
ExecStartPre=/bin/sh -c "docker inspect zookeeper-data >/dev/null 2>&1 || docker run --name zookeeper-data -v /opt/zookeeper-data alpine:3.1 /bin/true"
12-
ExecStartPre=-/usr/bin/docker kill zookeeper
13-
ExecStartPre=-/usr/bin/docker rm zookeeper
14-
ExecStartPre=/usr/bin/docker pull aledbf/zookeeper:3.5.0
15-
ExecStart=/bin/sh -c "/usr/bin/docker run -e EXTERNAL_PORT=2181 -e HOST=$COREOS_PRIVATE_IPV4 -e LOG_LEVEL=debug --net=host --rm --name zookeeper --volumes-from=zookeeper-data aledbf/zookeeper:3.5.0"
16-
ExecStop=/usr/bin/docker stop zookeeper
12+
ExecStartPre=-/usr/bin/docker kill deis-zookeeper
13+
ExecStartPre=-/usr/bin/docker rm deis-zookeeper
14+
ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/zookeeper` && docker history $IMAGE >/dev/null 2>&1 || docker pull $IMAGE"
15+
ExecStart=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/zookeeper` && docker run -e EXTERNAL_PORT=2181 -e HOST=$COREOS_PRIVATE_IPV4 -e LOG_LEVEL=debug --net=host --rm --name deis-zookeeper --volumes-from=zookeeper-data $IMAGE"
16+
ExecStop=/usr/bin/docker stop deis-zookeeper
1717

1818
[Install]
1919
WantedBy=multi-user.target

docs/customizing_deis/choosing-a-scheduler.rst

Lines changed: 77 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@ of your app. For example, a command such as ``deis scale web=3`` tells the
1212
scheduler to run three containers from the Docker image for your app.
1313

1414
Deis defaults to using the `Fleet Scheduler`_. A tech preview of the `Swarm Scheduler`_
15-
is available for testing. Work is ongoing on `Kubernetes`_ and `Mesos`_-based
16-
schedulers with the intent to test those alternatives in future releases of Deis.
15+
and `Mesos with Marathon framework`_ is available for testing. Work is ongoing on `Kubernetes`_-based
16+
scheduler with the intent to test those alternatives in future releases of Deis. Keep watching `dynamic metadata fleet PR 1077`_
17+
for support of runtime changes to metadata.
1718

19+
.. note::
20+
21+
If you are using a scheduler other than fleet app containers will not be rescheduled if deis-registry is unavailable.
22+
For more information look at `deis-registry issue 3619`.
1823

1924
Settings set by scheduler
2025
-------------------------
@@ -23,12 +28,13 @@ The following etcd keys are set by the scheduler module of the controller compon
2328

2429
Some keys will exist only if a particular ``schedulerModule`` backend is enabled.
2530

26-
============================= ================================================
27-
setting description
28-
============================= ================================================
29-
/deis/scheduler/swarm/host the swarm manager's host IP address
30-
/deis/scheduler/swarm/node used to identify other nodes in the cluster
31-
============================= ================================================
31+
=================================== ======================================================
32+
setting description
33+
=================================== ======================================================
34+
/deis/scheduler/swarm/host the swarm manager's host IP address
35+
/deis/scheduler/swarm/node used to identify other nodes in the cluster
36+
/deis/scheduler/mesos/marathon used to identify Marathon framework's host IP address
37+
=================================== ======================================================
3238

3339

3440
Settings used by scheduler
@@ -39,8 +45,8 @@ The following etcd keys are used by the scheduler module of the controller compo
3945
==================================== ===============================================
4046
setting description
4147
==================================== ===============================================
42-
/deis/controller/schedulerModule scheduler backend, either "fleet" or "swarm"
43-
(default: "fleet")
48+
/deis/controller/schedulerModule scheduler backend, either "fleet" or "swarm" or
49+
mesos_marathon (default: "fleet")
4450
==================================== ===============================================
4551

4652

@@ -97,10 +103,7 @@ to `enable the remote API`_.
97103
**Known Issues**
98104

99105
- It is not yet possible to change the default affinity filter.
100-
- If swarm can't create all the containers requested, Deis returns an error
101-
and leaves some containers in the "created" state. Until this behavior is fixed,
102-
be mindful of resource limitations on your cluster.
103-
- App containers will not be rescheduled if deis-registry is unavailable.
106+
- If swarm can't create all the containers requested during scale, deis rolls back the scale operation.
104107

105108
To test the Swarm Scheduler backend, first install and start the swarm components:
106109

@@ -132,9 +135,68 @@ component, or spy on Docker events directly on the swarm-manager machine:
132135
2015-04-30T17:31 61e59c: (from 172.17.8.100:5000/hungry-variable:v5 node:deis-02) start
133136
134137
138+
Mesos with Marathon framework
139+
-----------------------------
140+
141+
.. important::
142+
143+
The Mesos with Marathon framework Scheduler is a technology preview and is not recommended for
144+
production use.
145+
146+
`Mesos`_ is a distributed system kernel:
147+
148+
Mesos provides APIs for resource management and scheduling. A framework interacts with Mesos master
149+
and schedules and task. A Zookeeper cluster elects Mesos master node. Mesos slaves are installed on
150+
each node and they communicate to master with available resources.
151+
152+
`Marathon`_ is a Mesos_ framework for long running applications:
153+
154+
Marathon provides a Paas like feel for long running applications and features like high-availablilty, host constraints,
155+
service discovery, load balancing and REST API to control your Apps.
156+
157+
Deis uses the Marathon framework to schedule containers. Since Marathon is a framework for long-running
158+
jobs, Deis uses the `Fleet Scheduler`_ to run batch processing jobs. ``deisctl`` installs a standalone Mesos
159+
cluster. To install an HA Mesos cluster, follow the directions at `aledbf-mesos`_, and set the etcd key
160+
``/deis/scheduler/mesos/marathon`` to any Marathon node IP address. If a request is received by a regular
161+
Marathon node, it is proxied to the master Marathon node.
162+
163+
To test the Marathon Scheduler backend, first install and start the mesos components:
164+
165+
.. code-block:: console
166+
167+
$ deisctl install mesos && deisctl start mesos
168+
169+
Then set the controller's ``schedulerModule`` to "mesos_marathon":
170+
171+
.. code-block:: console
172+
173+
$ deisctl config controller set schedulerModule=mesos_marathon
174+
175+
The Marathon framework is now active. Commands such as ``deis destroy`` or
176+
``deis scale web=9`` will use `Marathon`_ to manage app containers.
177+
178+
Deis starts Marathon on port 8180. You can manage apps through the Marathon UI, which is accessible at http://<Marathon-node-IP>:8180
179+
180+
.. note::
181+
182+
**Known Issues**
183+
184+
- deisctl installs a standalone mesos cluster as fleet doesn't support runtime change to metadata.
185+
You can specify this in cloud-init during the deployment of the node. keep watching `dynamic metadata fleet PR 1077`_.
186+
- If you want to access Marathon UI, you'll have to expose port 8180 in the security group settings.
187+
This is blocked off by default for security purposes.
188+
- Deis does not yet use Marathon's docker container API to create containers.
189+
- CPU shares are integers representing the number of CPUs. Memory limits should be specified in MB.
190+
191+
135192
.. _Kubernetes: http://kubernetes.io/
136-
.. _Mesos: http://mesos.apache.org/
193+
.. _Mesos: http://mesos.apache.org
194+
.. _Marathon: https://github.com/mesosphere/marathon
137195
.. _fleet: https://github.com/coreos/fleet#fleet---a-distributed-init-system
138196
.. _swarm: https://github.com/docker/swarm#swarm-a-docker-native-clustering-system
139197
.. _`soft affinity`: https://docs.docker.com/swarm/scheduler/filter/#soft-affinitiesconstraints
140198
.. _`enable the remote API`: https://coreos.com/docs/launching-containers/building/customizing-docker/
199+
.. _`deis-kubernetes issue 3850`: https://github.com/deis/deis/issues/3850
200+
.. _`dynamic metadata fleet PR 1077`: https://github.com/coreos/fleet/pull/1077
201+
.. _`aledbf-mesos`: https://github.com/aledbf/coreos-mesos-zookeeper
202+
.. _`deis-registry issue 3619`: https://github.com/deis/deis/issues/3619

0 commit comments

Comments
 (0)