inventory-go

MIT License

Stars
4

Inventory

An inventory service for managing farming vehicles, equipment, and resources.

What is this?

  • A REST API for managing farm inventory via HTTP requests
  • A gRPC Service for managing farm inventory via RPC requests
  • A CLI for managing farm inventory

The inventory service enables users to keep track of farm inventory across multiple IoT devices, servers, applications, or databases. This service provides a foundational interface for inventory management and interaction.

Structure

/cmd/inventory # http api server
/cmd/inventoryctl # cli tool for service administration
/config # default application configurations
/ent # database models, migrations, and drivers
/ent/schemas # editable database models
/internal/settings # settings package to read in application configs

Quickstart

You can either install inventory directly with go, build the project from source, or download a binary from the latest release

Docker Compose

# Start the database and API via docker-compose
docker-compose up

# List the vehicles
http :8000/v1/vehicles

Install with go install

# Install the server
go install github.com/open-farms/inventory/cmd/inventory@latest

# Install the admin cli
go install github.com/open-farms/inventory/cmd/inventoryctl@latest

Start the service

Start the service directly with the binary or run it containerized with Docker.

# Run the inventory service
inventory
# Build the docker image
docker build -t <your-docker-image-name> .

# Run the docker image, exposing the service
docker run --rm -v ./config:/data/config -p 8000:8000 <your-docker-image-name>

Manage the inventory database with the inventoryctl CLI

# Start the postgres database
docker-compose up

# Run the inventoryctl cli to perform database migrations
inventoryctl --help
inventoryctl migrate

Generate code and build from source

Generate the service code, openapi spec, and build from source

make init
make generate
make test
make build

Services

View the openapi specification

View the protobuf schemas and services

Badges
Extracted from project README
Deploy on Railway