Exposes a REST API for CRUD operations on inventory items and supports persistence. Designed for containerized deployment and easy local development.
- CRUD operations for inventory items
- Simple JSON REST API
- Validation and error responses
- Configurable data store (e.g., PostgreSQL)
- K8s Friendly
- Git
- K8s (optional for containerized runs)
- A database such as PostgreSQL if not using in-memory store
- Clone the repo:
git clone <repo-url> inventoryservice cd inventoryservice
- Configure environment variables (see Configuration to update the Postgres DB).
check under deploy folder: postgres-db.yaml sudo iptables -I INPUT -p tcp -s 0.0.0.0/0 --dport 30001 -j ACCEPT oc port-forward postgres-558cf69f8b-n4g7g -n assignment 30001:5432 --address <<10.187.168.189>> - Run the service (example for a generic runtime):
# example: go run main.go # or create image using docker build. Refer Quick Start
Build and run with Docker: Refer Docker File
docker build -t inventoryservice .
kubectl create -f postgres-db.yaml
sudo iptables -I INPUT -p tcp -s 0.0.0.0/0 --dport 30001 -j ACCEPT
oc port-forward postgres-558cf69f8b-n4g7g -n assignment 30001:5432 --address <<10.187.168.189>>Common environment variables:
- Fill the details in the dbConfig.yaml file
- Base URL: http://localhost:8080
- Refer the Postman Collection under postman folder.