Vote Processing Service for the MyHero Demo
100K+
IN DEVELOPMENT NOT READY FOR WIDE SPREAD USE YET
This is the Vote Processing Service for a basic microservice demo application. This service subscribes to an MQTT Server where votes are waiting for processing.
Details on deploying the entire demo to a Mantl cluster can be found at
The application was designed to provide a simple demo for Cisco Mantl. It is written as a simple Python Flask application and deployed as a docker container.
Other services are:
The docker containers are available at
This service requires an MQTT server or broker to be available that can be subscribed, where votes will be published by the APP service. The larger MyHero Demo application leverages Mosca as a MQTT server for this purpose, though any MQTT server or broker should work.
The Vagrant environment for local development of this service deploys a Mosca container along with the ernst service itself and leverages it for local development work.
NOT DONE YET
Required
pip install -r requirements.txt
In order to run, the service needs 3 pieces of information to be provided:
These details can be provided in one of three ways.
python myhero_ernst/myhero_ernst.py --dataserver "http://myhero-data.server.com" --datakey "DATA AUTH KEY" --appsecret "APP AUTH KEY" --mqtthost "192.168.1.10" --mqttport "1883" --mqttserver "mqtt.service.consul" export myhero_data_server="http://myhero-data.server.com"export myhero_data_key="DATA AUTH KEY"export myhero_mqtt_host=192.168.1.10export myhero_mqtt_port=1883export myhero_mqtt_server=mqtt.service.consulpython myhero_ernst/myhero_ernst.pypython myhero_ernst/myhero_ernst.pyWhat is the data server address? http://myhero-data.server.comData Server Key: DATA AUTH KEYApp Server Key: APP AUTH KEYA command line argument overrides an environment variable, and raw input is only used if neither of the other two options provide needed details.
For determining the MQTT Server IP and Port, explicitly setting them through Command Line Arguements or through ENV variables will be preferred over a DNS lookup
Initial and Basic APIs. These are v1 APIs that require no authentication and will eventually be removed
curl http://localhost:5000/hero_listcurl http://localhost:5000/resultscurl http://localhost:5000/vote/<HERO>New v2 APIs These newer APIs require authentication as well as support more features
curl -X GET -H "key: APP AUTH KEY" http://localhost:5000/optionscurl -X PUT -H "key: APP AUTH KEY" http://localhost:5000/options -d '{"option":"Deadpool"}'curl-X POST -H "key: APP AUTH KEY" http://localhost:5000/options -d @sample_post.jsoncurl -X DELETE -H "key: APP AUTH KEY" http://localhost:5000/options/Deadpoolcurl -X POST -H "key: APP AUTH KEY" http://localhost:5000/vote/Deadpoolcurl -X GET -H "key: APP AUTH KEY" http://localhost:5000/resultsI've included the configuration files needed to do local development with Vagrant in the repo. Vagrant will still use Docker for local development and is configured to spin up a CentOS7 host VM for running the container.
To start local development run:
vagrant up
curl -H "key: DevApp" http://localhost:15001/optionsEach of the services in the application (i.e. myhero_web, myhero_app, and myhero_data) include Vagrant support to allow working locally on all three simultaneously.
Content type
Unrecognized
Digest
Size
27 MB
Last updated
over 9 years ago
docker pull hpreston/myhero_ernst