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.
make cluster
-
skaffold
Run by using skaffold. The default port is 8080.
skaffold dev
-
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/
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.
To create a new item in the inventory, you can use the directory /inventory
of the app with the method of POST
.
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.
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.
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.
To list all the items in the inventory, you can use the directory /inventory
of the app with the method of GET
.
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.