Skip to content

This repository contains the inventory service for NYU DevOps Fall 2023-001

License

Notifications You must be signed in to change notification settings

CSCI-GA-2820-FA23-001/inventory

Repository files navigation

NYU DevOps Project: Inventory

License Python codecov Build Status Build Status

Overview

This is a repository is the project of the Inventory Squad for the NYU masters class CSCI-GA.2820-001 DevOps and Agile Methodologies. This project is a Flask app contains one inventory of all of the products that an e-commerce web site sells. And keep track of the detailed information of the inventory items (id, name, quantity, condition etc.) with the SQLAlchemy database model. Also, the app implements the management features like Add, Get, Delete, Update and List for items in the inventory database by using the RESTful API.

Start cluster

make cluster

Ways to launch the application

  1. skaffold

    Run by using skaffold. The default port is 8080.

    skaffold dev
  2. k3d

    Run by using k3d cluster. The default port is 8080.

    Note: using this launch method should modify this config in the deployment.yaml

    - name: inventory
            # shuold use this instead of image:inventory
            image: cluster-registry:32000/inventory:1.0
            # image: inventory
            imagePullPolicy: IfNotPresent

    Related commands:

    docker build -t inventory:1.0 .
    docker tag inventory:1.0 cluster-registry:32000/inventory:1.0
    docker push cluster-registry:32000/inventory:1.0
    kubectl apply -f k8s/

Run flask

The Flask app now runs on the local machine. To start the app, type the following command in the shell:

make run

After the shell showing the message indicate the app is running successfully, you can access the homepage of the app and use RESTful API to interact with the app.

To access the home page of the app, you can go to http://localhost:8000/. This page will provide you some information about the app.

RESTful API usage

Create

To create a new item in the inventory, you can use the directory /inventory of the app with the method of POST.

Get

To get an item with specified id, you can use the directory /inventory/<iid> of the app with the method of GET, where <iid> is the id of the item.

Update

To update an item, you can use the directory /inventory/<iid> of the app with the method of PUT, where <iid> is the id of the item to be updated.

Delete

To delete an item, you can use the directory /inventory/<iid> of the app with the method of DELETE, where <iid> is the id of the item to be delete.

List

To list all the items in the inventory, you can use the directory /inventory of the app with the method of GET.

Test

The development of the project follows TDD practices. The tests are in the directory ./tests. Now, the test coverage is 96%. To run the tests, type the following command in the shell:

make test

And you will see the results of the tests.

About

This repository contains the inventory service for NYU DevOps Fall 2023-001

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published