d2iq-archive / 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 843 forks source link

Cannot seem to change defaults through upstart or env variables #2291

Closed cmluciano closed 9 years ago

cmluciano commented 9 years ago

I am trying to change a few environment variables to pass to the marathon run script. According to the docs I should be able to create a file under /etc/default/marathon with vars like this

MARATHON_APP_MASTER=zk://localhost:2181/mesos
MARATHON_APP_ZK_HOST=zk://localhost:2181/mesos
MARATHON_APP_HTTP_PORT=8070
MARATHON_APP_WEBUI_URL=http://localhost:8070/index.html

and they should be parsed and turned into run cmds according to the bin script.

This does not happen when I start the service. The http port is still at 8080 and the interface has not changed.

I also tried to create my own upstart config with the following file at /etc/init/marathon

description "marathon"

start on runlevel [2345]
stop on runlevel [!2345]

export MY_IP=10.0.2.15
export ZK_HOST=`cat /etc/mesos/zk`

exec /usr/bin/marathon \
 --master $ZK_HOST \
 --zk $ZK_HOST \
 --hostname $MY_IP \
 --http_port 8070 \
 --webui_url http://$MY_IP:8070/index.html \
 --logging_level info```

This works for a few seconds and then I get the following errors in syslog

syslog:Sep 21 18:11:50 vagrant marathon[6538]: [2015-09-21 18:11:50,190] INFO Starting Marathon 0.10.1 (mesosphere.marathon.Main$:87)
syslog:Sep 21 18:11:51 vagrant marathon[6538]: [scallop] Error: Failed to parse the trailing argument list: '--master zk://localhost:2181/mesos --zk zk://localhost:2181/mesos --hostname 10.0.2.15 --http_port 8070 --webui_url http://10.0.2.15:8070/index.html --logging_level info'
syslog:Sep 21 18:12:36 vagrant marathon[7542]: [2015-09-21 18:12:36,030] INFO Starting Marathon 0.10.1 (mesosphere.marathon.Main$:87)
syslog:Sep 21 18:12:37 vagrant marathon[7542]: [scallop] Error: Failed to parse the trailing argument list: '--master zk://localhost:2181/mesos --zk zk://localhost:2181/mesos --hostname 10.0.2.15 --http_port 8070 --webui_url http://10.0.2.15:8070/index.html --logging_level info'
syslog:Sep 21 18:23:38 vagrant marathon[21649]: [2015-09-21 18:23:38,594] INFO Starting Marathon 0.10.1 (mesosphere.marathon.Main$:87)
syslog:Sep 21 18:23:40 vagrant marathon[21649]: [scallop] Error: Bad arguments for option 'hostname': '' - you should provide exactly one argument for this option
syslog:Sep 21 18:24:54 vagrant marathon[23216]: [2015-09-21 18:24:54,852] INFO Starting Marathon 0.10.1 (mesosphere.marathon.Main$:87)
syslog:Sep 21 18:24:56 vagrant marathon[23216]: [scallop] Error: Bad arguments for option 'hostname': '' - you should provide exactly one argument for this option
syslog:Sep 21 18:27:52 vagrant marathon[26677]: [2015-09-21 18:27:52,751] INFO Starting Marathon 0.10.1 (mesosphere.marathon.Main$:87)
syslog:Sep 21 18:27:54 vagrant marathon[26677]: [scallop] Error: Bad arguments for option 'zk': '' - you should provide exactly one argument for this option
syslog:Sep 21 18:28:28 vagrant marathon[27420]: [2015-09-21 18:28:28,571] INFO Starting Marathon 0.10.1 (mesosphere.marathon.Main$:87)
syslog:Sep 21 18:28:30 vagrant marathon[27420]: [scallop] Error: Validation failure for 'zk' option parameters:

Note this is on an Ubuntu 14.04 box with the mesosphere packages marathon:amd64 (0.10.1-1.0.416.ubuntu1404)

kolloch commented 9 years ago

Hi @cmluciano, that's weird.

I think that you need a "run_jar" argument after the marathon command.

description "marathon"

start on runlevel [2345]
stop on runlevel [!2345]

export MY_IP=10.0.2.15
export ZK_HOST=`cat /etc/mesos/zk`

exec /usr/bin/marathon \
 run_jar \
 --master $ZK_HOST \
 --zk $ZK_HOST \
 --hostname $MY_IP \
 --http_port 8070 \
 --webui_url http://$MY_IP:8070/index.html \
 --logging_level info```
cmluciano commented 9 years ago

@kolloch The service unfortunately still is not staying up with that format. In /var/log/upstart/marathon.log

2015-09-22 19:55:47,129] INFO Starting Marathon 0.10.1 (mesosphere.marathon.Main$:87) [scallop] Error: Bad arguments for option 'hostname': '' - you should provide exactly one argument for this option

cmluciano commented 9 years ago
MARATHON_MASTER=zk://localhost:2181/mesos
MARATHON_ZK_HOST=zk://localhost:2181/mesos
MARATHON_HTTP_PORT=8070
MARATHON_WEBUI_URL=http://localhost:8070/index.html

in /etc/default/marathon does not work either

cmluciano commented 9 years ago

Quoting gives a different error too

description "marathon"

start on runlevel [2345]
stop on runlevel [!2345]

export MY_IP=10.0.2.15
export ZK_HOST=`cat /etc/mesos/zk`

exec /usr/bin/marathon \
  run_jar \
  --master "$ZK_HOST" \
  --zk "$ZK_HOST" \
  --hostname "$MY_IP" \
  --http_port "8070" \
  --webui_url "http://$MY_IP:8070/index.html" \
  --logging_level info
[2015-09-22 21:01:11,052] INFO Starting Marathon 0.9.0 (mesosphere.marathon.Main$:87)
[scallop] Error: Validation failure for 'zk' option parameters:
[2015-09-22 21:01:42,432] INFO Starting Marathon 0.9.0 (mesosphere.marathon.Main$:87)
[scallop] Error: Validation failure for 'zk' option parameters:
aquamatthias commented 9 years ago

Hey @cmluciano you did not export your parameters to the environment, thats why they are not visible to the start script. Please define the file /etc/default/marathon like that:

export MARATHON_MASTER=zk://localhost:2181/mesos
export MARATHON_ZK_HOST=zk://localhost:2181/mesos
export MARATHON_HTTP_PORT=8070
export MARATHON_WEBUI_URL=http://localhost:8070/index.html