Git Product home page Git Product logo

mesos-consul's Introduction

mesos-consul

Mesos to Consul bridge for service discovery.

Mesos-consul automatically registers/deregisters services run as Mesos tasks.

This means if you have a Mesos task called application, this program will register the application in Consul, and it will be exposed via DNS as application.service.consul.

This program also does Mesos leader discovery, so that leader.mesos.service.consul will point to the current leader.

Table of Contents

Comparisons to other discovery software

This project is similar to mesos-dns in that it polls Mesos to get information about tasks. However, instead of exposing this information via a built-in DNS server, we populate Consul service discovery with this information. Consul then exposes the services via DNS and via its API.

Benefits of using Consul:

  • Integration with other tools like consul-template
  • Multi-DC DNS lookups
  • Configurable health checks that run on each system

Registrator is another tool that populates Consul (and other backends like etcd) with the status of Docker containers. However, Registrator is currently limited to reporting on Docker containers and does not track Mesos tasks.

Building

docker build -t mesos-consul . 

Running

Mesos-consul can be run in a Docker container via Marathon. If your Zookeeper and Marathon services are registered in consul, you can use .service.consul to find them, otherwise change the vaules for your environment:

curl -X POST [email protected] -H "Content-Type: application/json" http://marathon.service.consul:8080/v2/apps'

Where mesos-consul.json is similar to (replacing the image with your image):

{
  "args": [
    "--zk=zk://zookeeper.service.consul:2181/mesos"
  ],  
  "container": {
    "type": "DOCKER",
    "docker": {
      "network": "BRIDGE",
      "image": "{{ mesos_consul_image }}:{{ mesos_consul_image_tag }}"
    }   
  },  
  "id": "mesos-consul",
  "instances": 1,
  "cpus": 0.1,
  "mem": 256 
}


You can add options to authenticate via basic http or Consul token.

Usage

Options

Option Description
refresh Time between refreshes of Mesos tasks
registry-auth The basic authentication username (and optional password), separated by a colon.
registry-ssl Use HTTPS while talking to the registry.
registry-ssl-verify Verify certificates when connecting via SSL.
registry-ssl-cert Path to an SSL certificate to use to authenticate to the registry server
registry-ssl-cacert Path to a CA certificate file, containing one or more CA certificates to use to valid the reigstry server certificate
registry-token The registry ACL token
zk* Location of the Mesos path in Zookeeper. The default value is zk://127.0.0.1:2181/mesos

Consul Registration

Leader, Master and Follower Nodes

Role Registration
Leader leader.mesos.service.consul, master.mesos.service.consul
Master master.mesos.service.consul
Follower follower.mesos.service.consul

Mesos Tasks

Tasks are registered as task_name.service.consul

Todo

  • Add support for tags
  • Use task labels for metadata
  • Support for multiple port tasks

mesos-consul's People

Contributors

chrisaubuchon avatar rncry avatar stevendborrelli avatar brianhicks avatar barthoda avatar

Watchers

James Cloos avatar Yongbok Kim avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.