}}

Deploying Public Services

Updated: February 16, 2017

DC/OS agent nodes can be designated as public or private during installation. Public agent nodes provide public access to your DC/OS applications. By default apps are launched on private agent nodes.

To launch an app on a public node, you must create a Marathon app definition with the "acceptedResourceRoles":["slave_public"] parameter specified.

Prerequisite:

  1. Create a Marathon app definition with the "acceptedResourceRoles":["slave_public"] parameter specified. For example:
    {
        "id": "/product/service/myapp",
        "container": {
        "type": "DOCKER",
        "docker": {
              "image": "group/image",
              "network": "BRIDGE",
              "portMappings": [
                { "hostPort": 80, "containerPort": 80, "protocol": "tcp"}
              ]
            }
        },
        "acceptedResourceRoles": ["slave_public"],
        "instances": 1,
        "cpus": 0.1,
        "mem": 64
    }
    

    For more information about the acceptedResourceRoles parameter, see the Marathon REST API documentation.

  2. Add the your app to Marathon by using this command, where myapp.json is your app:

    $ dcos marathon app add myapp.json
    

    If this is added successfully, there is no output.

    Tip: You can also add your app by using the Services tab of DC/OS GUI.

  3. Verify that the app is added with this command:

    $ dcos marathon app list
    

    The output should look like this:

    ID      MEM  CPUS  TASKS  HEALTH  DEPLOYMENT  CONTAINER  CMD
        /myapp   64  0.1    0/1    ---      scale       DOCKER   None
    

    Tip: You can also view deployed apps by using the Services tab of DC/OS GUI.