Flask RESTful API that can be integrated into your deployment pipeline to track deployment times.
To run locally on your computer, ensure the following requirements are installed:
- Python version 3.6+
- Packages listed in
requirements_local.txt
with the commandpip install -r requirements_local.txt
- Git (to clone the repository). Alternatively, download the .zip from the repository and extract it.
Execute the following steps:
git clone https://github.com/akelopes/deployWatcher.git
cd deployWatcher
flask run
git clone https://github.com/akelopes/deployWatcher.git
cd deployWatcher
flask run
For deployment in development mode:
- Ensure Python 3.6+, Docker, and Git are installed.
- Run:
git clone https://github.com/akelopes/deployWatcher.git
cd deployWatcher
docker build . -t deploywatcher
docker run -d -p 5000:5000 deploywatcher
A demo environment for production with the app, http host (nginx + uwsgi), and MySQL database via Docker.
Prerequisites:
- Docker (Linux host preferred)
- Docker-compose or Docker-Stack
- Git (or download the .zip from the repository).
Run:
git clone https://github.com/akelopes/deployWatcher.git
cd deployWatcher/prod_simulation
docker-compose build
docker-compose up
To verify successful execution, open https://127.0.0.1:5000/transitions
. You should see "API: OK".
-
GET:
/transitions
: Returns a message{"API": "OK"}
./transitions/<id>
: Retrieves details of a specific transition by its ID. If it doesn't exist, you'll get a404 Not Found
status with{"message": "Transition not found"}
.
-
POST (
/transitions
): Inserts a new deployment status into the database and returns the ID of the record. Accepts a JSON body with:component
: String (Max 140 characters)version
: String (e.g., "1.0")author
: Stringstatus
: Stringsent_timestamp
: Optional. Format: "yyyy-mm-dd hh:mm:ss.fff". Defaults to the current time if omitted.
Use curl for an example POST request:
curl --header "Content-Type: application/json" \
--request POST \
--data '{"component": "testApp", "version": "1.0", "author": "akelopes", "status": "started", "sent_timestamp": "2020-01-01 10:10:50.555"}' \
http://127.0.0.1:5000/transitions
Errors, such as "Invalid date format" or "Component too big", return with appropriate messages.
- The system is designed to be agnostic to cloud providers and databases.
- Adherence to the RESTful standard.
- Input handling is performed by the original system for flexible data translation.
- Local and Dev environments are for development, not persistent data.