API to calculate the fast delivery path.
This a async RESTful API with endpoints, that's receive a coordinate of pickup point and a list of dropoff coordinates from a user, and integrate call to backend service to build a cost matrix, and pass to optimization library for finally improve the route and return a list of coordinates ordered by reduce path.
This a mixed overengenieering side project with trade-offs to practice my
skills mainly in technologies used in this repository (and help-me found a job).
Instead a create many small repos for each idea, I resolved focus in one big
project, and increase the size them bit by bit (quality is better than quantity).
The insight of API is from my undergraduate thesis about metaheuristics.
They are the main jobs running in Docker containers orchestrated by Compose at the moment.
-
Download repository in your machine.
git clone git@github.com:sandrosmarzaro/fastpath.git
-
Create & configure environment variables in .devcontainer based .env.example in root directory.
cp .env .devcontainer/.env
-
Download Open Street Map of location that do want to use. In this case, I using Brazil, and put in osrm_data folder.
-
Following OSRM documentation, extract the map using his container.
docker run -t -v "${PWD}/osrm_data:/data" osrm/osrm-backend:v5.25.0 osrm-extract -p /opt/car.lua /data/brazil-251129.osm.pbf docker run -t -v "${PWD}/osrm_data:/data" osrm/osrm-backend:v5.25.0 osrm-partition /data/brazil-251129.osrm; docker run -t -v "${PWD}/osrm_data:/data" osrm/osrm-backend:v5.25.0 osrm-customize /data/brazil-251129.osrm;
-
Now, we able to build and compile the API and all services using Docker too.
docker compose build && docker compose up
When API is running there are some links to access your resources.
| Resource | Link |
|---|---|
| API | https://localhost:8000 |
| Grafana | https://localhost:3000 |
| Docs | https://localhost:8000/api/v1/docs/ |
| Coverage | https://app.codecov.io/github/sandrosmarzaro/fastpath |