Giter Club home page Giter Club logo

sfdr's Introduction

SnappFood Delay Report Service

A web base service that handle delay report request at SnappFood company!

Integrated Tools

  • Python +v3.11
  • Postgresql +v14
  • Redis +v7
  • Celery
  • ELK v8.8.1
  • RabbitMQ v3.12
  • UWSGI
  • Nginx
  • Docker & Docker Compose
  • Poetry (dependency management)
  • Pre commit
  • gitlab CICD
  • Swagger

Run via docker

Versions:

docker --version
# Docker version 20.10.21, build baeda1f
docker-compose --version
# Docker Compose version v2.13.0

Docker network

First create a global network for docker project

docker network create sfdr_global || true

SFDR Web App

To run service itself, execute the following command at teh root of the project (be sure u have installed both docker and docker compose):

docker compose up

Open http://localhost/admin/ to access the admin panel with username=admin and password=admin.
To access the custom API documentation browse address.
To access the swagger browse http://localhost/swagger/
To access the landing page browse http://localhost/

ELK

This is an unnecessary tools to monitor log and ... . After running SFDR service you can run RLK by running following command:

cd ELK  # enter ELK directory!
docker compose up setup  # Just once to setup pre-hooks, for the next time you can ignore this part.
docker compose up

After that you can access the kibana panel at http://localhost:5601/app/management then you need loging using username=elastic and password=changeme credential. To add the log data view (be sure you have at least one log, for example force app to raise 404 error by browse random api path): kibana_add_snappfood_data_view

Run in development

First clone project and install dependencies:

git clone <repo_path> <project_root>
cd <project_root>
virtualenv -p python3.11  venv
source venv/bin/activate
pip install poetry
poetry install

Then run db in your local machine. Recommend using existence docker from project root dir:

cd <project_root>
docker compose up db

Then set the URI of db at the development environment variable at environments/development.env file. Then you can run app:

cd <project_root>
python manage.py migrate
python manage.py test
python manage.py init_user  # will create superuser username=admin  password=admin if not any user exists.
python manage.py runserver

Open http://localhost:8000/admin/ at your browser and use following credential to enter admin panel:

username=admin
password=admin

Have fun!

ERD

SFDR_DB_DIAGRAM

Swagger

If there is any instance of running project, you can access to online realtime swagger tool from /swagger/ url path. Also, you can access the offline swagger file from ./assets/swagger.yaml path from root of project.

Test

To run tests execute following command at the root of the project:

docker compose up db

TL;DR

here is three endpoints that SnappFood interview order to implement :) just add base url to the following urls path!

Client report delay => /api/v1/orders/<order_id>/report-delay/
Vendor assign a delay to himself => /api/v1/orders/delay-assign/<vendor_id>
Vendor delays in current week => /api/v1/orders/vendor-delay/

sfdr's People

Watchers

Parsezan 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.