Skip to content

REST API for managing animal cards (advertisements) crawled for Kashtanka

Notifications You must be signed in to change notification settings

LostPetInitiative/CardStorageRestAPI

Repository files navigation

REST API service that provides access to the animal card (advertisment) persistant storage / database

Build Status GitHub release (latest SemVer) Docker Image Version (latest semver) Docker Pulls

The REST API for the card (lost/found pet advertisement) storage. In practice it communicates with CassandraDB cluster.

The Web app uses this API to fetch pet card images as well as other card data and similarity feature vectors.

If the CassandraDB is empty, upon first request the service will deploy the needed CassandraDB schema (keyspace & tables)

The repo

The API is ASP.NET CORE web api written in C# and packaged to be used as Docker image.

All pull requests are checked with CI automation.

Built releases are automatically published to Docker Hub and are ready to use.

How to use

The API is intended to be run in Linux container. e.g. with Docker.

You can set the following environmental variables to configer the service:

EnvVar Description Example
CASSANDRA_ADDRS endpoint of cassandra 10.0.4.12:34248
KEYSPACE keyspace to use kashtanka

Remark: If you run the service without specifying the Cassandra endpoint, the memory storage will be used. Might be useful for testing and debuging.

How to build

Prerequisites

You will need to install the following prerequsites to build the repo

  1. .NET 6.0 SDK

Development build & debug

  1. Change dir to the root of the repo
  2. Run dotnet run

Production build

  1. Change dir to the root of the repo
  2. Run dotnet build

Docker

The Dockerfile in the root of the repo defines the Docker image that creates a production build and prepares the web service to be run in production.