Welcome to Cisco Live! US 2016. This is the guide for session DevNET-2030: "Devnet Workshop - Mantl: How to use it".
In this workshop you will learn how to deploy micro-services applications and manage them on Cisco's Mantl platform. In this workshop we expect attendees have basic knowledge of containers, microservices architecture and REST APIs. This README is divided in following three sections.
- Application Overview - This section talks about the "My Hero" application, architecture and micro-services used to compose the application.
- Application Deployment - This section starts with Mantl UI walkthrough and covers application deployment on Mantl cluster.
- Application Management - This section covers how to manage application life cycle using Mantl UI and REST APIs.
In this workshop we will be using "MyHero App" a simple web app, broken into a small number of 'microservices-like' components; to demonstrate Mantl capabilities. The MyHero App allows users to vote for their favorite super hero and gather the voting results. The application is pre-built in a microservice style and each service is packaged in a docker container; ready for deployment on Mantl.
In its most basic form, the application has three services.
- myhero/data - This service stores all the data about candidates and votes cast.
- myhero/app - This service provides the basic logic layer for accessing and recording votes.
- myhero/web - This is the main user interface for casting votes.
In this Workshop, we're using a tool called postman to talk to the MANTL API's. Just like your web browser making a HTTP request for a website (GET, POST, etc); Postman provides a graphical tool to submit requests against HTTP endpoints (such as API's, that don't return a graphical interface such as a website).
We're using postman because it's cross platform, so bring your laptop of choice and download the following!
- Google Chrome web browser.
- Google Chrome Postman extension. (Installation instructions: https://www.getpostman.com/docs/introduction)
- There is a standalone version of postman available for mac https://www.getpostman.com/
You should already have access to the Mantl UI, displaying different tiles for Mantl components such as Mesos, Martahon, Consul and Traefik which are the core open source technologies used by Mantl. You can click on these tiles one by one to explore these technologies, also notice the healchecks for each component built into Mantl and surfaced via the UI.
Download following two files locally.
- Environment File: https://raw.githubusercontent.com/CiscoCloud/clus-my-hero-app/master/CLUS_MANTL.postman_environment.json
- Mantl Collections File: https://raw.githubusercontent.com/CiscoCloud/clus-my-hero-app/master/clus-my-hero-app.postman_collection.json
Open Postman application and import Environment and Collection files.
Each of you will be deploying onto the same cluster, plus, you may want to use the postman scripts against a different mantl cluster in future. So we have split out some of the changing information into variables which you can set for the workshop.
Things like DEPLOYMENTNAME
for example, because we dont want all of you trying to create an app with the same name!
Open Environment management tab from the postman UI and click on "CLUS_MANTL" Environment. Update modify the following environment variables as needed (Please consult Cisco engineers).
- MANTL_CONTROL: Mantl control API endpoint (cumulus.clus2016.mantl.io).
- MANTL_USER: Username to authenticate ("admin")
- MANTL_PASSWORD: Password to authenticate ("Helloclus2016")
- DEPLOYMENTNAME: Use your first ane lastname (e.g. nospaces).
- MANTLDOMAIN: DNS name to access the deployed application ("dev.clus2016.mantl.io")
On the Postman application go to clus-my-hero-app > 1-myhero-install
folder and run (Send button) 1-install_myhero_data
, 2-install_myhero_app
and 3-install_myhero_web
in order. Each request to the API will deploy one of the application components.
You should be able to reach the web interface for the application at http://DEPLOYMENTNAME
-web.dev.clus2016.mantl.io where DEPLOYMENTNAME refers to the deployment name provided at setup.
Open the Mantl UI again; On this page you will see different tiles for Mesos, Martahon, Consul and Traefik which are the core open source technologies used by Mantl.
-
Click on the Mesos tile and look at the tasks, you will find tasks related to the application name you have give while setting up the environment.
-
Click on Marathon tile to open Marathon UI, here you can investigate individual services from the MyHero application. Click on the "Configuration" tab to explore about the service configuration. You can scale up/down the service from this tab as well.
####Note: Please ask help from the Cisco DevNET engineers if needed.
Mantl provide REST APIs to access its individual components (Mesos, Marathon etc...). Infact, we've already used them once to deploy the application!
Now we're going to use postman to get and change information about our deployment via the API.
Run/Send Button "1-list_apps" to list the services you have just deployed. This will return response in JSON format.
Run/Send Button "2-get_myhero_web" command to get the details about your "myhero_web" service. Look at the response there is only one instance ( "instances": 1) of the service is running.
Currently there is only one instance "instances": 1
of the service is running for our application".
This is great, but we scaling up the application will load balance more copies to help us handle more load. It also provides fault tolerence for our app should an instance die.
To scale up this service open 5-sacle_up_myhero_web
REST request and open the "Body" tab from Postman request tab. Change the instances to 3 {"instances":3}
and run/Send Button the request. This will spin up 2 more instances of the "myhero_web" service.
You can check the number of instances in Marathon (UI) or by running the API App details request in 3.2.2 above!
To scale down the service open 6-sacle_down_myhero_web
postman request and change the instance to 1 {"instances":1}
and run/Send Button the request. This will bring down service "myhero_web" back to one. In this situation, the extra two containers are killed and the load balancer points all new requests to the single remaining instance.
We bareley got to know them... In this steps we will destroy the application.
####How:
Run/Send Button requests 1-uninstall_myhero_web
, 2-uninstall_myhero_data
and 3-uninstall_myhero_app
from Postman folder 3-myhero-uninstall
to remove all three services from Marathon.
####Note:
You can verify the current state of services using 1-get_myhero_data, 2-get_myhero_app and 3-get_myhero_web REST requests or using the Mantl UI.