Mellow Skunk is a django-rest application for mellow collectors such as mellow-heeler and 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 by using django-prometheus.
There is only one skunk instance per host and it exposes statistics for all collection operations on the host.
Mellow collector hosts are all based on Raspberry Pi.
The 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.
The django-rest application executes from gunicorn invoked by systemd(1), and should always be available.
nginx(8) acts as a reverse proxy to gunicorn and is also started by systemd(1), and should always be available.
Once 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.
- Clone mellow skunk repo within
/home/gsc/Documents/github- Scripts are expecting application at
/home/gsc/Documents/github/mellow-skunk
- Scripts are expecting application at
- Establish python environment
cd mellow-skunk/src/django-rest- Invoke virtualenv, i.e.
virtualenv -p /usr/local/opt/[email protected]/bin/python3.9 venv source venv/bin/activatepip install -r requirements.txt
- Verify you can start django
cd mellowpython manage.py migratepython manage.py runserver
- Verify you can run mellow skunk with gunicorn
gunicorn --bind 0.0.0.0:8000 mellow.wsgi
- Configure systemd(1) to invoke gunicorn
cd ..;ls(you should see two gunicorn.* files)sudo cp gunicorn.* /etc/systemd/systemsudo systemctl start gunicorn.socketsudo systemctl enable gunicorn.socketsudo systemctl status gunicorn.socketcurl -v --unix-socket /run/gunicorn.sock localhost- should see a JSON payload from skunk
sudo systemctl status gunicorn
- Configure nginx(8) reverse proxy
- Install nginx(8) if not already present
sudo apt-get install nginx
cp reverse-proxy.conf /etc/nginx/sites-availableln /etc/nginx/sites-available/reverse-proxy.conf /etc/nginx/sites-enabledrm /etc/nginx/sites-enabled/defaultsudo systemctl restart nginx
- Install nginx(8) if not already present
- mellow-skunk should now be responding at
http://localhost
- Define the host.
- Example curl-host-rpi3d-post.sh
- Define a task.
- Example curl-task-heeler-post.sh
| URL | Verb | Payload |
|---|---|---|
| /heeler/ | get, post | JSON Example |
| /host | get, post | JSON |
| /hyena/ | get, post | JSON Example |
| /groups | get | JSON |
| /metrics | get | Prometheus Text Example |
| /poodle/ | get, post | JSON |
| /task/ | get, post | JSON |
| /users | get, post | JSON |