{"id":24314637,"url":"https://github.com/guycole/mellow-skunk","last_synced_at":"2025-06-23T00:37:47.437Z","repository":{"id":271477858,"uuid":"913133661","full_name":"guycole/mellow-skunk","owner":"guycole","description":"django-rest application for mellow collectors","archived":false,"fork":false,"pushed_at":"2025-04-19T07:01:32.000Z","size":268,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T14:20:02.889Z","etag":null,"topics":["django-prometheus","django-rest-framework","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guycole.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-07T05:15:45.000Z","updated_at":"2025-02-10T04:34:30.000Z","dependencies_parsed_at":"2025-02-01T07:22:43.812Z","dependency_job_id":"baa9c278-cf91-4871-ac6f-812a53ffaab7","html_url":"https://github.com/guycole/mellow-skunk","commit_stats":null,"previous_names":["guycole/mellow-skunk"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/guycole/mellow-skunk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guycole%2Fmellow-skunk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guycole%2Fmellow-skunk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guycole%2Fmellow-skunk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guycole%2Fmellow-skunk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guycole","download_url":"https://codeload.github.com/guycole/mellow-skunk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guycole%2Fmellow-skunk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261391171,"owners_count":23151662,"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":["django-prometheus","django-rest-framework","python3"],"created_at":"2025-01-17T10:14:42.010Z","updated_at":"2025-06-23T00:37:42.422Z","avatar_url":"https://github.com/guycole.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mellow-skunk\nMellow Skunk is a [django-rest](https://www.django-rest-framework.org/) application for mellow collectors such as [mellow-heeler](https://github.com/guycole/mellow-heeler) and [mellow-hyena](https://github.com/guycole/mellow-hyena).  Mellow Skunk provides a easy mechanism to share the most recent results of a collection cycle.  Mellow Skunk also exposes collection metrics to [prometheus](https://prometheus.io/) by using [django-prometheus](https://github.com/korfuri/django-prometheus).\n\nThere is only one skunk instance per host and it exposes statistics for all collection operations on the host.\n\n## deployment\n![deployment](https://github.com/guycole/mellow-skunk/blob/main/md_uml/deployment.png)\n\nMellow collector hosts are all based on [Raspberry Pi](https://en.wikipedia.org/wiki/Raspberry_Pi).\nThe mellow skunk application is distributed via github and expected to reside at ```/home/gsc/Documents/github/mellow-skunk```, and this path is hard coded in many scripts.\n\nThe django-rest application executes from gunicorn invoked by systemd(1), and should always be available.  \n\nnginx(8) acts as a reverse proxy to gunicorn and is also started by systemd(1), and should always be available.\n\n## operation\nOnce mellow skunk has been installed and configured, the collection applications can post a JSON payload for each collection cycle.  All previous results will be deleted and only the freshest content will be retained.  Also, the prometheus gauge for collection population will be updated.  The uploaded content can be reviewed w/a GET at the URL below.\n\n## installation\n1. Clone mellow skunk repo within ```/home/gsc/Documents/github```\n    + Scripts are expecting application at ```/home/gsc/Documents/github/mellow-skunk```\n1. Establish python environment\n    + ```cd mellow-skunk/src/django-rest```\n    + Invoke virtualenv, i.e. ```virtualenv -p /usr/local/opt/python@3.9/bin/python3.9 venv```\n    + ```source venv/bin/activate```\n    + ```pip install -r requirements.txt```\n1. Verify you can start django\n    + ```cd mellow```\n    + ```python manage.py migrate```\n    + ```python manage.py runserver```\n1. Verify you can run mellow skunk with gunicorn\n    + ```gunicorn --bind 0.0.0.0:8000 mellow.wsgi```\n1. Configure systemd(1) to invoke gunicorn\n    + ```cd ..;ls``` (you should see two gunicorn.* files)\n    + ```sudo cp gunicorn.* /etc/systemd/system```\n    + ```sudo systemctl start gunicorn.socket```\n    + ```sudo systemctl enable gunicorn.socket```\n    + ```sudo systemctl status gunicorn.socket```\n    + ```curl -v --unix-socket /run/gunicorn.sock localhost```\n        + should see a JSON payload from skunk\n    + ```sudo systemctl status gunicorn```\n1. Configure nginx(8) reverse proxy\n    + Install nginx(8) if not already present\n        + ```sudo apt-get install nginx```\n    + ```cp reverse-proxy.conf /etc/nginx/sites-available```\n    + ```ln /etc/nginx/sites-available/reverse-proxy.conf /etc/nginx/sites-enabled```\n    + ```rm /etc/nginx/sites-enabled/default```\n    + ```sudo systemctl restart nginx```\n1. mellow-skunk should now be responding at ```http://localhost```\n\n## configuration\n1. Define the host.\n    + Example [curl-host-rpi3d-post.sh](https://github.com/guycole/mellow-skunk/blob/main/bin/curl-host-rpi3d-post.sh)\n1. Define a task.\n    + Example [curl-task-heeler-post.sh](https://github.com/guycole/mellow-skunk/blob/main/bin/curl-task-heeler-post.sh)\n\n## URL\n| URL       | Verb      | Payload                         |\n| --------- | ----------|-------------------------------- |\n| /heeler/  | get, post | JSON [Example](https://github.com/guycole/mellow-skunk/blob/main/bin/curl-heeler-test-post.sh) |\n| /host     | get, post | JSON                            |\n| /hyena/   | get, post | JSON [Example](https://github.com/guycole/mellow-skunk/blob/main/bin/curl-hyena-test-post.sh)  |\n| /groups   | get       | JSON                            |\n| /metrics  | get       | Prometheus Text [Example](https://github.com/guycole/mellow-skunk/blob/main/scrape.txt)|\n| /poodle/  | get, post | JSON                            |\n| /task/    | get, post | JSON                            |\n| /users    | get, post | JSON                            |\n\n## Relevant Links\n+ [django, nginx, gunicorn](https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu#step-7-creating-systemd-socket-and-service-files-for-gunicorn)\n+ [django prometheus](https://github.com/korfuri/django-prometheus)\n+ [django rest example](https://www.geeksforgeeks.org/how-to-create-a-basic-api-using-django-rest-framework/)\n+ [django rest tutorial](https://www.django-rest-framework.org/tutorial/1-serialization/)\n+ [django rest repository](https://github.com/encode/django-rest-framework)\n+ [monitor django w/prometheus](https://blog.snapdragon.cc/posts/2022-12-monitor-django-with-prometheus/)\n+ [python client_python](https://github.com/prometheus/client_python)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguycole%2Fmellow-skunk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguycole%2Fmellow-skunk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguycole%2Fmellow-skunk/lists"}