GithubHelp home page GithubHelp logo

davidwittman / ansible-mesos-playbook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mhamrah/ansible-mesos-playbook

0.0 2.0 0.0 392 KB

An ansible playbook for launching a mesos cluster with docker and marathon support.

License: MIT License

Ruby 100.00%

ansible-mesos-playbook's Introduction

ansible-mesos-playbook

An ansible playbook for launching a mesos cluster with native docker and mesos executors, along with Marathon), Consul and HAProxy support. Run this on Ubuntu 14.04 LTS (preferred) or Centos/RHEL 6. Read the blog post for a descriptive overview.

Getting Started

  • Install ansible, version >= 1.7.
  • Install librarian-ansible via gem install librarian-ansible
  • Run librarian-ansible install
  • Spin up a bunch of Ubuntu 14.04 servers, say 5, on your favorite cloud provider.
  • cp hosts.sample hosts and update the mesos_masters and mesos_slaves groups.
  • cp ansible.cfg.sample ansible.cfg to ensure librarian_roles is in the ansible path (ansible.cfg is git-ignored).
  • Run ansible-playbook playbook.yml.

The Setup

  • zookeeper, haproxy, mesos-master, consul and marathon with ha mode run on nodes in the mesos_primaries group. The zoo_id host variable is used to configure zookeeper, and consul_bootstrap is set on one node to initialize the cluster.
  • mesos-slave runs in the mesos_workers group and are passed the list of mesos_primaries for coordination.
  • Docker and native mesos are configured as containerizers on mesos-slaves.
  • A cron job on each master is set up to query the marathon api and configure HAProxy.
  • HAProxy routes a frontend (listening on port 80) to backends based on marathon tasks.
  • Consul for service discovery. It's not hooked into any other services, just part of the default setup.
  • You probably want to tweak the HAProxy configuration script (in /opt/marathon/bin) for your needs. With the current setup you can have a wildcard dns prefix route to a backend matching the marathon name: i.e. www.example.com would do a least-connection proxy to the www task.

Altering the Playbook

There are a variety of tweaks you can make to this playbook for your needs.

  • Don't want Marathon, Consul or HAProxy? Simply remove roles from mesos_primaries.yml
  • Don't want to overload the primaries? Simply add new groups and remap roles appropriately.

Troubelshooting

If you have trouble, /var/log/syslog on Ubuntu and /var/log/messages on RHEL is your friend. For Zookeeper, try /var/log/zookeeper/zookeeper.log. You can try re-running the playbook; the roles aren't perfect but most are idempotent.

Ansible lets you perform actions on groups of servers. You can try query or restart zookeeper and/or mesos:

$ ansible mesos_primaries -a "sudo status zookeeper"
$ ansible mesos_primaries -a "sudo restart zookeeper"

Notes

Currently this installs Mesos 0.20.1 with Marathon 0.7.3.

Launching a Container

POST to /v2/apps:

{
    "id": "mlh", 
    "container": {
        "docker": {
            "image": "mhamrah/mesos-sample",
            "network": "BRIDGE",
            "portMappings": [
                { "containerPort": 8080, "hostPort": 0, "protocol": "tcp" }
            ]
        },
        "type": "DOCKER"
    },
    "cpus": 0.5,
    "mem": 512,
    "instances": 1
}

ansible-mesos-playbook's People

Contributors

adammeghji avatar jakedahn avatar maccam912 avatar mhamrah avatar

Watchers

 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.