Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/paulescu/taxi-data-api-python
Build and deploy a REST API for taxi trip data π
https://github.com/paulescu/taxi-data-api-python
docker fastapi kubernetes python
Last synced: 3 days ago
JSON representation
Build and deploy a REST API for taxi trip data π
- Host: GitHub
- URL: https://github.com/paulescu/taxi-data-api-python
- Owner: Paulescu
- Created: 2024-09-27T08:40:55.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-11-01T12:13:42.000Z (3 months ago)
- Last Synced: 2025-01-23T07:08:42.065Z (13 days ago)
- Topics: docker, fastapi, kubernetes, python
- Language: Python
- Homepage: https://www.realworldml.net/courses
- Size: 2.49 MB
- Stars: 66
- Watchers: 1
- Forks: 16
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#### Table of contents
* [Our goal π―](#our-goal)
* [How to run the API locally? π](#how-to-run-the-api-locally)
* [How to deploy the API to Kubernetes with Gimlet? π](#how-to-deploy-the-api-to-kubernetes-with-gimlet)
* [How to monitor our API with Elasticsearch and Kibana? π](#how-to-monitor-our-api-with-elasticsearch-and-kibana)
* [See it in action π¬](#see-it-in-action)
* [Wanna learn more real-world ML? π§ ](#wanna-learn-more-real-world-ml)## Our goal
Letβs **build** and **deploy** a production-ready REST API that can serve data on historical taxi rides in NYC.
The original data is stored in one-month parquet files [on this website](https://www.nyc.gov/site/tlc/about/tlc-trip-record-data.page), and our goal is to make it easily accessible to the WORLD through a REST API.
## How to run the API locally?
Git clone this repository, cd into the root directory of the project and then run the following commands using make.
1. Install [Python Poetry](https://python-poetry.org/docs/#installation) (if necessary)
and create an isolated virtual environmnet for development purposes.
```
$ make install
```2. Test, build and run the dockerized REST API with
```
$ make all
```3. Check the API is up and running locally, and that you can connect to it
```
$ make health-check-local
```4. Send a sample request to the local API
```
$ make sample-request-local
```Good job. The API is up and running locally. However, until you donβt deploy it to a production environment, and make it accessible to
* your clients ππ»ββοΈ
* your colleagues π¨π»βπΌ
* or the whole world πyour real-world impact is **ZERO**.
Let me show you how to deploy this API to a production Kubernetes cluster.
> **What is Kubernetes? βΈπ¦**
>
> Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of your Dockerized apps
>
> It is currently the most widely used container orchestration platform in the world, and it has become the de facto standard due to its robust features, large community support, and backing from major tech companies.## How to deploy the API to Kubernetes with Gimlet?
[Gimlet](https://gimlet.io/) is a tool that helps you quickly deploy your apps to ANY Kubernetes cluster.
- You can do it entirely from the Gimlet UI, as explained in this article.
or
- You can adjust the [gimlet manifest in this repository](https://github.com/Paulescu/taxi-data-api-python/blob/main/.gimlet/electric-paper-taxi-data-api-python.yaml), to automatically deploy your code changes to the main branch.
## How to monitor our API with Elasticsearch and Kibana?
These are the steps:
1. Spin up Elasticsearch and Kibana with the docker compose
2. Add middleware to FastAPI app
3. Build a dashboard with Kibana## See it in action
[ππ½ Click here to try the API](https://paulescu-taxi-data-api-python-ayolbhnl.gimlet.app/trips?from_ms=1674561817000&n_results=100)
## Wanna learn more real-world ML?
Join more than 19k builders to the [**Real-World ML Newsletter**](https://www.realworldml.net/subscribe). Every Saturday morning.
### [ππ½ Click here to subscribe for FREE](https://www.realworldml.net/subscribe)
### [**ππ½ My live courses on Real World ML**](https://www.realworldml.net/courses)