Git Product home page Git Product logo

flask-request's Introduction

flask-request

Flask API to show the number of requests and API health status.

Overview

This is a Flask application that serves as a Request Counter API. It includes a simple web page displaying information about the application, including the request count and health status.

Features

  • Show the request count.
  • Visualize the health status of the API.

Dependencies

  • git
  • Container Engine (Docker, ContainerD, Podman etc)
  • docker-compose (optional)

Getting Started

  1. Clone the repository:
git clone https://github.com/alexolinux/flask-requester.git
  1. Go to the project folder:
cd flask-request
  1. Build the Docker Image:
docker build -t alexmbarbosa/flask-request:10.0 .

List my docker images:

docker image ls
REPOSITORY                       TAG            IMAGE ID       CREATED        SIZE
alexmbarbosa/flask-request       10.0           6a96582e9ffa   1 hours ago    91.8MB
  • In this case, I am using the same docker tag/name that I have pushed to my docker hub repository already with this flask-request image. Feel free to use any name for your tag/image.

Use cases (scenarios)

How about simulating a few load tests?

It is possible to use a useful Python tool called Locust. For this, let's use our flask-request and the official locust docker image (Access Locust on Docker for more details).

  1. Spin Up flask-request container:
docker run --rm --name flask-request -p 5000:5000 alexmbarbosa/flask-request:10.0

docker run flask-request

Open your flask-request page accessing http://localhost:5000 (or you local IP address (containers are binding to 0.0.0.0:PORT))

flask-request

  1. Now, Spin Up locust container:
docker run --rm --name locust -p 8089:8089 -v $(pwd):/locust locustio/locust -f /locust/locustfile.py --host http://localhost:5000

docker run locust

Open your locust page accessing http://localhost:8089 (or you local IP address (containers are binding to 0.0.0.0:PORT))

locust

Locust Docs: https://docs.locust.io/en/stable/quickstart.html

Extra-Option

Additionally, I am providing a docker-compose.yml simplifying the deployment of docker containers.

Just run:

docker-compose up

docker-compose

Now, you can make your custom workload tests.

Have fun!


References

Author

https://www.linkedin.com/in/mendesalex/

flask-request's People

Contributors

alexolinux avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.