kohend / dcos-commons

Simplifying stateful services

Home Page:https://mesosphere.github.io/dcos-commons/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quick Start | Developer Guide | FAQ | Javadocs | Contributing | Slack


DC/OS SDK is a collection of tools, libraries, and documentation for easy integration of technologies such as Kafka, Cassandra, HDFS, Spark, and TensorFlow with DC/OS.


Understanding the Hello World Service Specification

The service specification declaratively defines the helloworld service:

name: "helloworld"
pods:
  helloworld:
    count: {{COUNT}}
    tasks:
      server:
        goal: RUNNING
        cmd: "echo 'Hello World!' >> helloworld-container-volume/output && sleep 10"
        cpus: {{SERVER_CPU}}
        memory: 32
        volume:
          path: "helloworld-container-volume"
          type: ROOT
          size: 64

In the above YAML file, we have:

  • Defined a service with the name helloworld
  • Defined a pod specification for our helloworld pod using:
pods:
  helloworld:
    count: {{COUNT}}
    tasks:
      ...
  • Declared that we need atleast {{COUNT}} instances of the helloworld pod running at all times, where COUNT is the environment variable that is injected into the scheduler process at launch time via Marathon. It defaults to 1 for this example.
  • Defined a task specification for our server task using:
tasks:
  server:
    goal: RUNNING
    cmd: "echo 'Hello World!' >> helloworld-container-volume/output && sleep 10"
    cpus: {{SERVER_CPU}}
    memory: 32

We have configured it to use {{SERVER_CPU}} CPUs (which defaults to 0.5 for this example) and 32 MB of memory.

  • And finally, configured a 64 MB persistent volume for our server task where the task data can be persisted using:
volume:
  path: "helloworld-container-volume"
  type: ROOT
  size: 64

References


Contributions

Contributions are welcome! See CONTRIBUTING.


License

DC/OS SDK is licensed under the Apache License, Version 2.0.

About

Simplifying stateful services

https://mesosphere.github.io/dcos-commons/

License:Apache License 2.0


Languages

Language:Java 73.7%Language:Python 18.1%Language:Go 4.1%Language:HTML 2.5%Language:Shell 1.6%Language:Ruby 0.0%Language:Makefile 0.0%