Giter VIP home page Giter VIP logo

marathon-ha-demo's Introduction

High Avaibility with Flocker and Mesos

Demo

To simplify this demonstation, we have put together a Git repository with useful utilities such as some bash files and a Makefile.

$ git clone https://github.com/ClusterHQ/marathon-ha-demo.git

Prerequisites

aws cli

To run this demonstation you should only require the AWS CLI, and have your keypair on AWS.

Installation of the AWS CLI is fairly simple. In most cases you can install AWS CLI by running:

$ pip install awscli

Note: If this is not successful, refer to the AWS CLI installation documentation.

Before we can proceed, you will need to configure the AWS CLI with your AWS API credentials.

$ aws configure

You will need to input your AWS API credentials, you can find information on how to generate this information from the AWS documentation. There's no need to specify default regions, however you may want to do this for other projects.

AWS Keypair

In order for us to communicate with the instances which you provisions, you will need to ensure your keypair is added to the US-East-1 region. We depend on this region as that is where our base AMI is located.

Preparation

Once you have created a keypair using the AWS control panel - you must define 2 variables as follows:

$ export KEY_NAME=<Key name as on AWS>
$ export KEY_PATH=<Path to private key>

Bringing the Cluster Online

Once you have set your configuration, you can begin. To initially get the cluster up we need to set a few environment variables and run make nodes.

$ make cluster

This will build a Mesos cluster with three EC2 instances. One instance will run the Flocker control service along with the Mesos master, and the other two will run a Mesos client and a Flocker agent.

Once the cluster has completed building using make, it will print some useful information which you should save for use later on in this tutorial.

Along with the EC2 instances, the Makefile will create an Elastic Load Balancer (ELB). This is so that we can always visit the application at the same address, regardless of the EC2 instance it is located on.

Running an Application

We have included a basic application manifest, app.json. This configuration includes a single container with an attached volume running "Moby Counter", the idea here is very simple:

  • Moby Counter runs a webserver with a simple Javascript application.
  • When a client browser clicks anywhere on the page, the co-ordinates are sent to the server.
  • A Docker logo is displayed at that co-ordinate
  • The co-ordinates are saved on the server to the Flocker volume.
  • When the page is reloaded, all the Docker logos are displayed on the page in the place they were clicked.

The end result is a simple stateful application saving the places on a page where the client has clicked and displayed a Docker logo in its place.

We need to inform Marathon about this application, in order to do this we will post its application manifest (app.json) to the Marathon API with CURL.

$ make app

Forcing a node to fail

Then - we will terminate the instance the application is running on and watch Marathon reschedule the container and Flocker re-attach the data volume:

$ make failure

Use the Marathon GUI to track the status of the application - it will take around 60 seconds to reschedule the container and re-attach the data-volume.

Once the Marathon GUI shows the application in grey not yellow - you can refresh the URL of the load balancer and you should see the application still with your data intact.

Cleaning up

Once the demo is complete - you can remove the instances and the load balancer using this command:

$ make destroy

commands

$ make cluster
$ make app
$ make failure
$ make info

marathon-ha-demo's People

Contributors

binocarlos avatar msh100 avatar

Watchers

James Cloos 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.