Data Service for Simple Superhero Voting Application
50K+
This is the Data Service for a basic microservice demo application. This provides a data storage layer for a voting system where users can vote for their favorite movie superhero.
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
Required
pip install -r requirements.txt
In order to run, the service needs 1 piece of information to be provided:
This detail can be provided in one of three ways.
python myhero_data/myhero_data.py --datasecret "DATA AUTH KEY" export myhero_data_key="DATA AUTH KEY"python myhero_data/myhero_data.pypython myhero_data/myhero_data.pyData Server Key: DATA 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.
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: DATA AUTH KEY" http://localhost:5000/optionscurl -X PUT -H "key: DATA AUTH KEY" http://localhost:5000/options -d '{"option":"Deadpool"}'curl-X POST -H "key: DATA AUTH KEY" http://localhost:5000/options -d @sample_post.jsoncurl -X DELETE -H "key: DATA AUTH KEY" http://localhost:5000/options/Deadpoolcurl -X POST -H "key: DATA AUTH KEY" http://localhost:5000/vote/Deadpoolcurl -X GET -H "key: DATA 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: DevData" http://localhost:15000/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.1 MB
Last updated
over 9 years ago
docker pull hpreston/myhero_data