0

Using cURL I want to modify the number of instances a group has by passing a json file to update the config. The way my groups are set up looks something like this:

'marathon > applications > topApp'
'marathon > applications > topApp > group1'
'marathon > applications > topApp > group2'
'marathon > applications > topApp > group3 , etc'

I only want to update group2 and cannot figure out how to specify it. I'm thinking of using 'PUT /v2/groups/{groupId}' which I got from the marathon rest api doc here https://mesosphere.github.io/marathon/docs/rest-api.html#example-5

Has anyone done this and can help? Is there a better way? This is my first time doing this. Thanks!

donniemac
  • 1
  • 1

1 Answers1

0

You can do curl -XPUT localhost:8080/v2/groups/path/to/group/group2 -d @group2.json where the content of group2.json contains the change of instance count.

If you only want to change the instance count of one single application you can also do something like this (might contain quotation problems):

curl -XPUT localhost:8080/v2/apps/path/to/app/app123 -d '{"instances":20}'

unterstein
  • 79
  • 5
  • 1
    `PUT` should be replaced with `PATCH` or at least add query parameter `partialUpdate=true` becouse current default partial update for `PUT` will be changed. See [docs](https://github.com/mesosphere/marathon/blob/v1.4.2/docs/docs/rest-api/public/api/v2/apps.raml#L94-L102) – janisz Apr 24 '17 at 07:25
  • Thats correct, thanks Janisz! For the apps endpoint you probably want to use PATCH if you want to run my example. For groups HTTP PATCH is not supported. – unterstein Apr 24 '17 at 10:48
  • Thank you unterstein for your comment. I appreciate it. I will work with that and reply back. – donniemac Apr 27 '17 at 13:12