App to count pings(POST) on a defined url, identified by an uuid, and export the count and days of those pings as a csv file. I created to use it as a counter of continuous deploys per day.
docker-compose up
Access the root url http://localhost:5000
python3 -m venv path/to/your/env
source path/to/your/env/bin/activate
pip install -r requirements.txt
When you run with venv you have to initate a instance of MongoDB, which is needed for the app usage, by yourself. I recommend running the docker image of mongo.
After that run the server with:
./run.sh
docker-compose up -d
docker-compose exec web pytest tests
After the set up steps run:
pytest tests
First you have to create a Pingout, which will be the identifier of your pings, each Pingout receives an unique UUID, you can create performing a POST on the url /create-pingout
:
curl -X POST http://localhost:5000/create-pingout
The response of the post request will be your Pingout UUID, SAVE IT.
{
"uuid": "YOURUNIQUEUUID"
}
Once you have a created pingout you can ping on it whenever you want by performing a POST on the url UUID/ping
:
curl -X POST http://localhost:5000/YOURUNIQUEUUID/ping
When you ping, Pingout will save the date of that ping and increment the pings counter.
To export a CSV with your pings amount by date, first you have to query it using the date range you want by the params initial_date
and final_date
on the format YYYY-MM-DD:
-
Access the url:
http://localhost:5000/YOURUNIQUEUUID/filter/?initial_date=2018-01-01&final_date=2018-02-02 -
After that you'll be redirect to a page to download the CSV file with the query result.
- Create your Pingout as showed above
- Add to your
.travis.yml
on the stageafter_deploy
:
curl -X POST http://localhost:5000/YOURUNIQUEUUID/ping
Obs.: You may set your Pingout UUID as a environment variable on travis.