🚀
Hephaestus - In Greek mythology, Hephaestus was either the son of Zeus and Hera or he was Hera's parthenogenous child. ... As a smithing god, Hephaestus made all the weapons of the gods in Olympus. He served as the blacksmith of the gods, and was worshipped in the manufacturing and industrial centres of Greece, particularly Athens.
🚀
Get Started -
An Restful Api project developed with Flask.
-
I used Prometheus and Grafana for monitoring and containerization with Docker.
Monitoring
-
Using Prometheus Flask exporter This library provides HTTP request metrics to export into Prometheus. It can also track method invocations using convenient functions.
-
Grafana is a multi-platform open source analytics and interactive visualization web application. It provides charts, graphs, and alerts for the web when connected to supported data sources.
containerization
-
Docker hosts and containers monitoring with Prometheus, Grafana, Flask, MySQL.
-
To run the project you need docker-compose and run this command:
docker-compose up -d
- To stop:
docker-compose down
🚀
Requirements -
To start using Hephaestus try first to understand how Grafana & Prometheus work by reading some official docs here :
Installation
- Get started by cloning the repository :
git clone https://github.com/yezz123/Hephaestus
-
Create & activate a python3 virtual environment (optional, but very recommended).
-
Install requirements:
pip install -r requirements.txt
- Then in your app/init.py change the MYSQL connection :
or you can use wait for mysql to launch and connect to your mysql Provider.
db = SQLAlchemy()
SQLALCHEMY_DATABASE_URI = "mysql+pymysql://username:password@db/Database_db"
SQLALCHEMY_ECHO = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
Notes : You can Change the SQLALCHEMY Database
to SQLite for example :
SQLALCHEMY_DATABASE_URI = "sqlite:////tmp/test.db"
Curl
- Curl is used in command lines or scripts to transfer data.
- curl -i -X GET "http://localhost:5000/"
- curl -i -X GET "http://localhost:5000/power/10/10"
- curl -i -X GET "http://localhost:5000/factorial/10"
- curl -i -X GET "http://localhost:5000/fibonacci/10"
- curl -i -X GET "http://localhost:5000/get_requests"
Routes
-
"/" : show information's about what routes are available.
-
"/fibonacci/" : the n-th fibonacci number.
-
"/power//" : show power of first number to second number
-
"/factorial/" : show the factorial of a number
-
"/get_requests" : show all requests saved in DB
-
"/metric" : show metrics
Ports
-
On port
9090
is a instance ofPrometheus
that collect metrics from the Flask app. -
On port
3000
is an instance ofGrafana
that displays the data collected by Prometheus (user: admin, pass: admin). -
To see the Grafana dashboard:
⭐
Contributing -
Contributions are welcome
❤️ -
Please share any features, and add unit tests!
-
Use the pull request and issue systems to contribute.