dcos-commons

module
v0.0.0-...-85711f0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2021 License: Apache-2.0

README

Build Status

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


DC/OS SDK is a collection of tools, libraries, and documentation for easy integration and automation of stateful services, such as databases, message brokers, and caching services.

Status

DC/OS SDK is currently in alpha stage: it can run services, but APIs change regularly, and features are under active development.

Benefits

  • Simple and Flexible: The SDK provides the simplicity of a declarative YAML API as well as the flexibility to use the full Java programming language.

  • Automate Maintenance: Stateful services need to be maintained. With the SDK, you can automate maintenance routines, such as backup and restore, to simplify operations.

  • Production-Proven: Building reliable services is hard. Uber and Bing platform teams use the SDK for mission-critical databases and message brokers.


Quick Start

From a workstation with 8GB Memory, Git, VirtualBox 5.1.x, and Vagrant 1.9.x:

  1. Download the DC/OS SDK.
git clone https://github.com/mesosphere/dcos-commons.git
  1. Create your local development environment.
cd dcos-commons/ && ./get-dcos-docker.sh
  • Visit the DC/OS cluster dashboard to verify your development environment is running.
  1. Enter your development environment.
cd tools/vagrant/ && vagrant ssh
  1. Build your hello-world example project.
cd /dcos-commons/frameworks/helloworld/ && ./build.sh local
  1. Start your hello-world DC/OS service.
dcos package install hello-world
  1. Explore your hello-world service.
  • Visit the dashboard to see your hello-world service running.
  • Click through to one of your tasks (e.g. world-server-1-<uuid>), select the Files tab, select world-container-path, and finally select the output file.

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.

Directories

Path Synopsis
cli
Package cli is the entrypoint to writing a custom CLI for a service built using the DC/OS SDK.
Package cli is the entrypoint to writing a custom CLI for a service built using the DC/OS SDK.
client
Package client implements a set of common functionality that are used by DC/OS SDK commands to talk to schedulers built using the SDK or other DC/OS components (e.g.
Package client implements a set of common functionality that are used by DC/OS SDK commands to talk to schedulers built using the SDK or other DC/OS components (e.g.
frameworks
govendor
github.com/BurntSushi/toml
Package toml provides facilities for decoding and encoding TOML configuration files via reflection.
Package toml provides facilities for decoding and encoding TOML configuration files via reflection.
github.com/alecthomas/template
Package template implements data-driven templates for generating textual output.
Package template implements data-driven templates for generating textual output.
github.com/alecthomas/template/parse
Package parse builds parse trees for templates as defined by text/template and html/template.
Package parse builds parse trees for templates as defined by text/template and html/template.
github.com/alecthomas/units
Package units provides helpful unit multipliers and functions for Go.
Package units provides helpful unit multipliers and functions for Go.
github.com/aryann/difflib
Package difflib provides functionality for computing the difference between two sequences of strings.
Package difflib provides functionality for computing the difference between two sequences of strings.
github.com/containernetworking/cni/pkg/skel
Package skel provides skeleton code for a CNI plugin.
Package skel provides skeleton code for a CNI plugin.
github.com/davecgh/go-spew/spew
Package spew implements a deep pretty printer for Go data structures to aid in debugging.
Package spew implements a deep pretty printer for Go data structures to aid in debugging.
github.com/nicksnyder/go-i18n/i18n
Package i18n supports string translations with variable substitution and CLDR pluralization.
Package i18n supports string translations with variable substitution and CLDR pluralization.
github.com/nicksnyder/go-i18n/i18n/bundle
Package bundle manages translations for multiple languages.
Package bundle manages translations for multiple languages.
github.com/nicksnyder/go-i18n/i18n/language
Package language defines languages that implement CLDR pluralization.
Package language defines languages that implement CLDR pluralization.
github.com/nicksnyder/go-i18n/i18n/translation
Package translation defines the interface for a translation.
Package translation defines the interface for a translation.
github.com/pelletier/go-toml
Package toml is a TOML parser and manipulation library.
Package toml is a TOML parser and manipulation library.
github.com/pmezard/go-difflib/difflib
Package difflib is a partial port of Python difflib module.
Package difflib is a partial port of Python difflib module.
github.com/stretchr/testify/assert
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
github.com/stretchr/testify/require
Package require implements the same assertions as the `assert` package but stops test execution when a test fails.
Package require implements the same assertions as the `assert` package but stops test execution when a test fails.
github.com/stretchr/testify/suite
Package suite contains logic for creating testing suite structs and running the methods on those structs as tests.
Package suite contains logic for creating testing suite structs and running the methods on those structs as tests.
github.com/vishvananda/netlink
Package netlink provides a simple library for netlink.
Package netlink provides a simple library for netlink.
github.com/vishvananda/netlink/nl
Package nl has low level primitives for making Netlink calls.
Package nl has low level primitives for making Netlink calls.
github.com/vishvananda/netns
Package netns allows ultra-simple network namespace handling.
Package netns allows ultra-simple network namespace handling.
gopkg.in/alecthomas/kingpin.v3-unstable
Package kingpin provides command line interfaces like this:
Package kingpin provides command line interfaces like this:
gopkg.in/yaml.v2
Package yaml implements YAML support for the Go language.
Package yaml implements YAML support for the Go language.
sdk
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL