CiscoCloud/marathon-cli

Name: marathon-cli

Owner: CiscoCloud

Description: A golang cli to manage apps and groups in Marathon

Created: 2015-02-13 16:11:19.0

Updated: 2017-02-07 18:48:59.0

Pushed: 2015-02-22 02:06:42.0

Homepage: null

Size: 256

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

marathon-cli

A golang cli to manage apps and groups in Marathon

Usage
ANDS:
nfo     Gets information about the marathon cluster
eader   Gets the current leader
mleader Forces current leader to abdicate
mapp    Deletes an app
sapp    List all apps or lists provided apps in the arguments
ing     Test Marathon connection
elp, h  Shows a list of commands or help for one command

AL OPTIONS:
-host "localhost:8080"  Marathon host (default localhost:8080) [$MARATHON_HOST]
-format "json"      Output format (json)
-help, -h           show help
-version, -v        print the version
Examples
Server Information
Ping the Marathon endpoint
rathon-cli --host host-01:8080 ping

[0000] Ping successful, recieved 'pong' from host-02:8080 
Get information about a Marathon cluster
rathon --host host-01:8080 info


Code": 200,
leader": "host-01:8080",
frameworkId": "20150212-005751-3034589101-5050-27381-0000",
http_config": {
  "http_port": 8080,
  "https_port": 8443
,
marathon_config": {
  "checkpoint": true,
  "executor": "//cmd",
  "failover_timeout": 604800,
  "ha": true,
  "hostname": "host-01",
  "local_port_min": 10000,
  "local_port_max": 20000,
  "master": "zk://zookeeper.service.consul:2181/mesos",
  "mesos_role": "",
  "mesos-user": "",
  "reconciliation_initial_delay": 15000,
  "reconciliation_interval": 300000,
  "task_launch_timeout": 300000
,
name": "marathon",
version": "0.8.0",
zookeeper_config": {
  "zk": "zk://zookeeper.service.consul:2181/marathon",
  "zk_future_timeout": {
     "duration": 10
  },
  "zk_hosts": "zookeeper.service.consul:2181",
  "zk_path": "/marathon",
  "zk_state": "",
  "zk_timeout": 10


Get the leader of a marathon cluster
arathon-cli --host host-01:8080 leader


Code": 200,
leader": "host-02:8080"

Force the leader step down
rathon-cli --host host-01:8080 rmleader


Code": 200,
message": "Leadership abdicted"

After a leader steps down, Marathon will perform an election to determine the next leader. You can confirm that the leadership changed:

rathon-cli --host host-01:8080 leader

Code": 200,
leader": "host-01:8080"

Managing Applications

Applications are identified by their “id” field.

List all apps running on the cluster

To shorten the command line, we can set the MARATHON_HOST environment variable:

rt MARATHON_HOST=host:8080

rathon-cli lsapp

Code": 200,
apps": [
  {
     "id": "/hello-rails",
     "cmd": "cd hello \u0026\u0026 bundle install \u0026\u0026 bundle exec unicorn -p $PORT",
     "cpus": 1,
     "env": {
        "RAILS_ENV": "production"
     },
     "instances": 1,
     "mem": 100,
     "ports": [
        10001
     ],

 .. <output omitted>
List a single app running on the cluster
rathon-cli lsapp hello-rails

Code": 200,
app": {
  "id": "/hello-rails",
  "cmd": "cd hello \u0026\u0026 bundle install \u0026\u0026 bundle exec unicorn -p $PORT",
  "cpus": 1,
  "env": {
     "RAILS_ENV": "production"
  },
  "instances": 1,
  "mem": 100,
  "ports": [

  ... <output omitted>


Delete an application

This will terminate and delete an application

rathon-cli rmapp hello-rails
[0000] Application deleted: hello-rails
Launch an application form a json description file.

Use a standard Marathon application configuration file to launch an application. The examples/ directory contains sample files.

rathon-cli app --file examples/rails.json
[0000] Application deployed app: hello-rails

Code": 201,
version": "2015-02-16T14:27:55.572Z"

Refer to the Marathon Documentation for more configuration examples.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.