Skip to content

This is provided as a very simple application that can be used to demonstrate Cisco Mantl.

Notifications You must be signed in to change notification settings

hpreston/myhero_demo

Repository files navigation

MyHero Microservice Demo Application

MyHero Demo Application

Links

Background

This is provided as a very simple application that can be used to demonstrate the concepts behind a cloud native application that can be deployed onto Cisco Mantl. Though designed with Mantl in mind, there is nothing specific to the application and underlying services that require Mantl to function. Any platform for deploying container based microservices should be acceptable.

Cisco Devnet provides a Mantl Sandbox for anyone to use for testing, learning and developing that can be easily leveraged with the MyHero application. Details on Mantl can be found at Mantl @ DevNet. And you can access the Sandbox details at Mantl Sandbox.

The application provides a simple interface for gathering and reporting votes about the best movie superheros.

The application is built in a microservice style wrapping each service in a docker container that can be deployed and run in Mantl. In its initial form the applicaiton has three services.

  1. myhero/data - This service stores all the data about candidates and votes cast.
  2. myhero/app - This service provides the basic logic layer for accessing and recording votes.
  3. myhero/web - This is the main user interface for casting votes.

There is an optional deployment mode where votes are processed through an MQTT Server by being published by the myhero/app service, and processed by myhero/ernst service that subscribes to the queue. In this mode, these additional services are deployed.

  1. myhero/mosca - MQTT Server based on Mosca
  2. myhero/ernst - Vote processing services

MyHero Queueing Arch

All of the demo details here make use of the Mantl or Marathon APIs to build and manage applciations. If you prefer to use the different GUIs to execute the demos, you can use the JSON files to find the details needed to configure manually.

Optional Additional Services

A great application today allows users to interact with the service in whichever way the end user prefers. No longer should we be satisfied with simply a web interface on a desktop or laptop. Users are looking for options such as:

  • Mobile - smartphones and tablets
  • Wearables - smartwatches
  • Realtime Chat
  • Voice Interaction
  • Gesture Based
  • and more

So with this in mind, MyHero offers some optional additional services for a fuller experienece. Check back often as the list of optional services will grow overtime.

Cisco Spark Bot

Realtime Chat is becoming very popular with consumer as well as professional world. Cisco Spark is an enterprise collaboration platform offering text, voice, and video options for group and one on one communciations. MyHero now can leverage Cisco Spark to allow users to Chat with a Spark Bot to learn about the voting service, find out current results, and cast votes.

MyHero SparkBot

To setup the Spark Bot visit Spark Bot Setup

NOTE: To leverage the Spark Bot Service, your Mantl Cluster MUST be configured for deployed applications to be accessible from the public Internet. This is because it relies on the Spark Cloud to be able to send a WebHook to the myhero_spark application you run in Mantl*

Cisco Tropo Service

Mobile phones are everywhere, and SMS/TXT continues to be a method for interacting with services. Cisco Tropo is a SaaS solution that provides Voice and SMS services that can be integrated to any applciation through a very easy to use API. MyHero has an optional Tropo service that allows users to send SMS messages to the MyHero applciation to learn abou the voting service, find out current results, and cast votes.

MyHero Tropo Service

To setup the Tropo Service visit Tropo Service Setup

NOTE: To leverage the Tropo Service, your Mantl Cluster MUST be configured for deployed applications to be accessible from the public Internet. This is because it relies on the Tropo Cloud to be able to send a REST call to the myhero_tropo application you run in Mantl*

Prerequisites

In order to leverage this demonstration, you will need to have a Mantl cluster up and functional already. For help with this visit the Docs site available at http://mantl.io. You will need to have the address for the control nodes and a username and password for an active account.

Setup

Run source myhero_setup to enter and record the deployment name, address, application domain, username, and password for your Mantl instance as non-persistent Environment Variables. This means you will need to run this command everytime you open an new terminal session.

Application Deployment

Full MyHero Application Architecture

Install

Run ./myhero-install.sh to deploy the default configuration to your Mantl Cluster. This includes:

  • myhero_data
  • myhero_app
  • myhero_ernst
  • myhero_queue
  • myhero_ui

After running the install it will take a 2-5 minutes for all three services to fully deploy and become "healthy". You can monitor this in the Marathon Web GUI.

You should be able to reach the web interface for the application at http://DEPLOYMENTNAME-ui.YOUR-DOMAIN where DEPLOYMENTNAME refers to the deployment name provided at setup and YOUR-DOMAIN refers to the application domain configured for Traefik.

Basic Scaling Demo

A script is included to show how you can easily scale services with Mantl.

Run ./myhero-scale-demo.sh to have options to change the number of ui and app instances deployed. You can scale up or down with this script.

Advanced Demos

Scaling a Service

  • To scale up the ui service

    curl -k -X PUT -u $MANTL_USER:$MANTL_PASSWORD \
       https://$MANTL_CONTROL:8080/v2/apps/$DEPLOYMENT_NAME/ui \
       -H "Content-type: application/json" \
       -d '{"instances":5}' 
    

Getting Details on a Service

  • To get the details on one of the services

    curl -k -X GET -u $MANTL_USER:$MANTL_PASSWORD \
       https://$MANTL_CONTROL:8080/v2/apps/$DEPLOYMENTNAME/ui \
       -H "Content-type: application/json" 
    

Interfacing with the App Tier API

A strength of Modern Applications are that you can interact with any of the services directly through APIs if the native interface isn't desireable. Here are some examples interacting with the app service directly.

  • View the list of potential Superheros to vote for.

    curl -H "key: SecureApp" http://$DEPLOYMENT_NAME-app.$MANTL_DOMAIN/options
    
  • View the current standings.

    curl -H "key: SecureApp" http://$DEPLOYMENT_NAME-app.$MANTL_DOMAIN/v2/results
    
  • Place a vote for a hero

    curl -H "key: SecureApp" -X POST http://$DEPLOYMENT_NAME-app.$MANTL_DOMAIN/vote/Batman
    

MyHero Application Code and Containers

GitHub Repos

Docker Containers

Other Mantl Demo Ideas

There are many other ideas for demo's to run with Mantl. Several of these leverage example content delivered with the Mantl code in the examples/ directory. Others deploy Mesos frameworks using the Mantl API. Review these directories as well as the documentation at docs.mantl.io.

Uninstallation

Run ./myhero-uninstall.sh to remove all services from Marathon.

About

This is provided as a very simple application that can be used to demonstrate Cisco Mantl.

Resources

Stars

Watchers

Forks

Packages

No packages published