ToolWatch checks the health status of various Wikimedia tools and displays them in a user-friendly UI. More at: https://phabricator.wikimedia.org/T341379
To update the tool, the following commands need to be run
cd ToolWatch && git pull && ./scripts/toolforge-update.sh
- Clone the repository:
git clone https://github.com/gopavasanth/ToolWatch
- Navigate to the project directory:
cd ToolWatch
- Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
- For Windows:
venv\Scripts\activate
- For Unix/Linux:
source venv/bin/activate
- For Windows:
- Install the dependencies:
pip install -r requirements.txt
-
Before starting the app, you need to start the MariaDB instance on your local device.
-
You can install the MariaDB from here, or other sources.
-
After installing the MariaDB, you need to create a database with the following credentials:
- database name:
toolwatch
- username:
root
- password:
toolwatch
- database name:
-
These credentials are defined in
config.py
file.
For production, we use Wikimedia Cloud database, and for production purposes we may need to create a .env file, with variables defined.
To connect to the DB instance, use the following command:
ssh -L:3307:tools.db.svc.wikimedia.cloud:3306 [email protected]
To backup the database, run:
mariadb-dump --defaults-file=$(pwd)/replica.my.cnf --skip-ssl -h 0.0.0.0 -P 3307 s55491__toolwatch > backup.sql
- View job logs:
toolforge jobs logs -f special-restart-crawl
- List of jobs:
toolforge jobs list
toolforge webservices restart
To debug the production container in local, run:
docker run -ti -u 0 --entrypoint bash tools-harbor.wmcloud.org/tool-tool-watch/tool-tool-watch:latest
Access the Grafana dashboard https://grafana.wmcloud.org/d/TJuKfnt4z/kubernetes-namespace?orgId=1&var-cluster=prometheus-tools&var-namespace=tool-tool-watch
- Run the database service (MariaDB instance, if running locally).
- Run the Flask app:
python app.py
- Open your web browser and visit
http://localhost:5000
to view the tool health status.
The directory structure of the project is as follows:
- The
database
directory contains the SQLite database file.- The
templates
directory contains HTML templates. - The
model.py
file defines the Tool model and sets up the database.
- The
- The
app.py
file is the main entry point of the Flask application.
- To add or modify tools, you can edit the
tools/models.py
file and add or update the Tool model attributes. - For more advanced health checks, you can modify the
tools/views.py
file and implement the logic in thecheck_tool_health()
function.
Contributions are welcome! If you find any issues or have suggestions for improvement, please open an issue or submit a pull request.
This project is licensed under the MIT License.