mesosphere / marathon

Deploy and manage containers (including Docker) on top of Apache Mesos at scale.
https://mesosphere.github.io/marathon/
Apache License 2.0
4.07k stars 845 forks source link

Make Marathon docker container Marathon-ready #2159

Closed bobrik closed 7 years ago

bobrik commented 9 years ago

Let's pick up PORT and HOST env variables if they are set. This make possible to run marathon on marathon without any wrapper scripts.

I can make a PR if this sounds good.

sample commented 9 years ago

+1

kolloch commented 9 years ago

There are actually all kinds of ports that Marathon can use. See this for a template using a port for HTTP, one for libprocess and one for HTTPS:

https://github.com/mesosphere/universe/blob/version-1.x/repo/packages/M/marathon/3/marathon.json

So its kind of hard to make a general useful image that already maps these environment variables to something useful.

Or am I wrong?

bobrik commented 9 years ago

I only care about http port since it's used for service discovery and health checks. Making all of them work is an option as well.

bobrik commented 9 years ago

Btw, using cmd without exec instead of env variables doesn't look like a good idea.

aquamatthias commented 9 years ago

Hey @bobrik we are using MOM all the time - not exactly sure what is missing. But it would be great if you could provide a PR.

bobrik commented 9 years ago

@aquamatthias are your running it on a well known port? We assign random ports and set nginx with zoidberg in front.

aquamatthias commented 9 years ago

@bobrik no well known port. We use a proxy component which reads the framework info from mesos state.json and delegate to that host/port. That is probably the reason we don't see that problem...

bobrik commented 9 years ago

It's a good time to remind about reading state.json: https://issues.apache.org/jira/browse/MESOS-3307

Continuing on the topic: can you show me your app config? I don't see how PORT env variable propagates to --http_port cli argument of Marathon.

gkleiman commented 9 years ago

@bobrik: this is the template that DCOS uses to start MOM: https://github.com/mesosphere/universe/blob/version-1.x/repo/packages/M/marathon/4/marathon.json

bobrik commented 9 years ago

Ah, I see, you mess with cmd. I don't want to touch cmd since it rewrites entrypoint for no reason and breaks container encapsulation. I want it to work outside of the box when I just rewrite some of env variables like I do now.

In your link you have cmd line that is 4912 characters long. Instead of doing this, you could have several independent env variables that are much easier to understand. This would be even nicer with yaml, but that's another story (that we solved internally).

To better illustrate what I want, here's my ENTRYPOINT script for marathon:

#!/bin/sh -e

# Ready to run on Marathon
export MARATHON_HTTP_PORT="${PORT}"

exec /marathon/bin/start

Point of this issue is to use stock marathon image that does the same thing. Does it make sense now?

jasongilanfarr commented 7 years ago

We have quite a few ways of doing this now... marathon_extra_args, marathoncmd{option} etc. closing out.

bobrik commented 7 years ago

@jasongilanfarr can you provide an example?

gkleiman commented 7 years ago

@jasongilanfarr I don't think we support this yet, see this comment from @bobrik:

Continuing on the topic: can you show me your app config? I don't see how PORT env variable propagates to --http_port cli argument of Marathon.

meichstedt commented 7 years ago

Note: This issue has been migrated to https://jira.mesosphere.com/browse/MARATHON-2898. For more information see https://groups.google.com/forum/#!topic/marathon-framework/khtvf-ifnp8.