{"id":15914482,"url":"https://github.com/bbengfort/ansible","last_synced_at":"2025-08-05T15:35:49.306Z","repository":{"id":15963069,"uuid":"18705714","full_name":"bbengfort/ansible","owner":"bbengfort","description":"A Twisted-Django Test Application","archived":false,"fork":false,"pushed_at":"2015-09-22T17:04:14.000Z","size":727,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-08T17:45:45.651Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbengfort.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-12T14:19:32.000Z","updated_at":"2016-07-27T09:28:14.000Z","dependencies_parsed_at":"2022-09-17T23:21:08.566Z","dependency_job_id":null,"html_url":"https://github.com/bbengfort/ansible","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbengfort%2Fansible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbengfort%2Fansible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbengfort%2Fansible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbengfort%2Fansible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbengfort","download_url":"https://codeload.github.com/bbengfort/ansible/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246933357,"owners_count":20857052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-06T17:03:25.967Z","updated_at":"2025-04-03T03:43:56.665Z","avatar_url":"https://github.com/bbengfort.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Ansible\n=======\n**A Twisted-Django Data Ingestion and Visualization Application**\n\n[![Ansible][ansible.png]][ansible.png]\n\nTaking a queue from Allen, who likes to record all data, I've decided to try to come up with a simple Twisted/Django app to learn Twisted in particular. The idea is along the lines of Nathan Yau's [Flowing Data](http://your.flowingdata.com/home/) - where he uses Twitter feeds to rapidly collect data that he visualizes in real time. The twitter feeds are simple action/value predicate pairs, for example:\n\n    weigh 160\n    drank 2 water\n    goodnight 11:00 PM\n\nThese simple statements are then recorded into action logs and values with various data types. For example, Categorical, Event, Counter, and Measurement data types.\n\nAs Twitter is a text feed, it seems perfectly reasonable to be able to program something like this using a chat-like client rather than going through Twitter. In particular, since I want to learn Twisted for other projects, it seems like a Twisted ingestion server for these action predicates would be very cool and useful! They do allow complete flexibility in what you create (like a chat room) but the Twisted server could then give back useful responses to the various sensors that might be streaming data to the server.\n\nThe Django App will be used to visualize this data in real time. I imagine that we could use this app to do things like put together a mapping from Foursquare etc. (Using If This Then That or similar), we could probably explore all kinds of cool and useful things with this tool!\n\n## Running the Demo ##\n\nCurrently, there is a simple demo to show how everything works. To install/run this demo follow the following steps.\n\n1. Download/clone the repository:\n\n        $ git clone https://github.com/bbengfort/ansible.git\n        $ cd ansible\n\n2. Create a virtual environment and install dependencies:\n\n        $ virtualenv venv\n        $ source venv/bin/activate\n        $ pip install -r requirements.txt\n        \n3. Set the following environment variable (sorry). You can also add export statements to the end of the bin/activate script to do this automatically if you have to do this often. \n\n        $ export DJANGO_SETTINGS_MODULE=philote.settings.development\n\n4. Sync the database and run the server. (You can add a super user if you'd like, that's fine!) If you get an error about the database path, make sure there is a directory called `fixtures` in the root of the repository. \n\n        $ python philote/manage.py syncdb\n        $ python philote/manage.py runserver\n\n5. You should be able to open a browser and navigate to http://127.0.0.1/ and see the Django app. Don't click on the link quite yet.\n\n6. Next, you need to run the ansible server- the twisted server that accepts streaming data from various ingestion sources. To do this run the following commands in a different terminal window:\n\n        $ source venv/bin/activate\n        $ bin/mazer listen\n        \n    This will start the server in the browser, you shouldn't be seeing much happen though at this point. \n    \n7. In the browser, go ahead and click on the `Simple Counter` link to see the detail page of the counter. You probably won't be seeing too much, but as you follow the next steps, keep an eye on this page. \n\n8. In yet another terminal window, do the following:\n\n        $ source venv/bin/activate\n        $ bin/mazer generate\n\n    You should now be seeing data flowing across the screen in the browser, the chart updating for every 10 time points. All your terminals should be filling up with data now! Repeat step 8 as many times as you would like to add data sources and streams. \n    \n9. To quit the demo- in each of the terminal windows type `CTRL+C` and close the browser window. \n\n### So what did I just see? ###\n\nThis demo might have been interesting, sure - but what you just saw was the connection of a custom twisted TCP protocol to a Django app. In particular, the Twisted server was listening for statements in the form of action predicates - it then rebroadcasted incoming statements to any clients that asked for them. \n\nThe generate clients were examples of data streams. They created random, associated data and sent the data to the ingestor as action predicate statements. The ansible server listened for the predicates and stored the last ten statements in memory. \n\nThe Django is another type of client. Rather than send data (which is possible, but you'll note that the post command isn't there yet) it ingested the data each second and displayed it on the screen in real time using Ajax long polling. The browser itself didn't connect with the Twisted server, but rather the Django backend did in much the same way it might connect to a database server. \n\nWHEW! \n\nThat may not seem like a lot, but it demonstrated a lot of moving pieces. The questions now are whether or not Twisted is something we want to use to connect to Django or to put together scientific backends for modeling. \n\n\u003c!-- References --\u003e\n[ansible.png]: http://www.endersansible.com/wp-content/uploads/2012/05/Darians_Battleschool.jpg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbengfort%2Fansible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbengfort%2Fansible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbengfort%2Fansible/lists"}