Skip to content

Onyxmoon/hsfl-master-ai-cloud-engineering

 
 

Repository files navigation

Price Whisper

Coverage GitHub release (by tag) Run tests (lib folder) Run tests (http proxy service) Run tests (product-service) Run tests (shoppinglist-service) Run tests (user-service) Run tests (web service)

Hero Image

PriceWhisper is your go-to destination for effortless savings on every shopping trip. Compare prices across supermarkets, find the best deals, and save money without the noise. Unlock the power of smart shopping with PriceWhisper.

PriceWhisper is an web application designed to streamline shopping experiences. Users can input their shopping list containing various products, and PriceWhisper meticulously scans multiple retailers, extracting pricing data given merchants.

The web app then analyze this data to provide you with a comprehensive cost breakdown of your shopping list, instantly identifying the most economical merchant for your trip.

Key features:

  • Price Comparison: PriceWhisper allows users to compare prices across multiple merchants.
  • Identifying Economical Merchants: PriceWhisper instantly identifies and highlights the most economical merchant for each item on the user's shopping list and the complete shopping
  • Efficiency: The platform streamlines the shopping experience, improving efficiency and reducing the effort required to find savings.
  • Data Aggregation: The database aggregate pricing data from various merchants for one product.

Current architecture

Architecture

Technologies

The following technologies and tools must be installed for native development

  • Go 1.21
  • protobuf
  • protoc-gen-go
  • protoc-gen-go-grpc

Setup project in Kubernetes

The complete application can be deployed within a kubernetes cluster.

  1. Manifest files for deployment (including monitoring) are located at kubernetes/manifests

  2. It is optional but highly recommended to set your own username and password for the database access in manifest files (replace db-username and db-pw-changeMe! in each service manifest).

    Some special characters are not possible because RQLite uses basic auth. Please use url-safe characters like Alphanumeric [0-9a-zA-Z], special characters $-_.+!*'(),.

  3. The user service (price-whisper/user.yaml) uses JWT tokens for authentication while logged-in. A custom ECDSA private key can be specified as path or inline in environment variable JWT_PRIVATE_KEY.

    Generate a key with the following command:

    ssh-keygen -t ecdsa -f ./src/user-service/privateKey.pem -m pem

    When step is missing, container will use a random but secure generated key on each start, but users will be logged-out at restarts.

  4. Apply the manifests in kubernetes/manifests to your kubernetes control plane.

    kubectl apply -R -f ./kubernetes/manifests
  5. The main page can be accessed via the public port of the HTTP Proxy Service container. Monitoring can be accessed via the Grafana public port. There is an example dashboard configuration file at kubernetes/grafana.

You can use the following commands to find the current ports for each service:

kubectl get services -n price-whisper
kubectl get services -n monitoring

Setup project in Docker

Requirements

  • Docker Compose version v2.23.3
  • a compatible container daemon

The Compose version is required because a relative new feature for inline configs is used.

Development setup via docker-compose

The development setup exposes all ports to the host machine, so you can access each service individually. Docker will build locally and the database is not persistent in this setup.

  1. Clone repository from Github git clone https://github.com/Onyxmoon/hsfl-master-ai-cloud-engineering.git

  2. Set your own username and password for the database access in compose file (replace db-username and db-pw-changeMe!).

    Some special characters are not possible because RQLite uses basic auth. Please use url-safe characters like Alphanumeric [0-9a-zA-Z], special characters $-_.+!*'(),.

  3. Setup .env files for the following services or add the corresponding environment variables via compose file

  4. Generate a secret private key for JWT token generation for the user service.

    Specify the path to an ecdsa private key or provide the content of one directly in environment variable JWT_PRIVATE_KEY at user service.

    You can generate a key with the following command:

    ssh-keygen -t ecdsa -f ./src/user-service/privateKey.pem -m pem

    When step is missing, container will use a random but secure generated key on each start.

  5. Run docker compose -f docker-compose.dev.yml up -d to start the containers defined in the Compose file

  6. Run docker compopse down to stop container, networks, volumes, and images created by up.

The main application entrypoint is now available at http://localhost:8080

Normal setup via docker-compose

The normal setup isolates the internal communication between services and only the proxy is reachable from the host machine. Prebuild images from Docker Hub will be used and database is persistent in this setup.

  1. Use the docker-compose.yml from the root of this repository.

  2. It is recommended to set your own username and password for the database access in compose file (replace db-username and db-pw-changeMe!).

    Some special characters are not possible because RQLite uses basic auth. Please use url-safe characters like Alphanumeric [0-9a-zA-Z], special characters $-_.+!*'(),.

  3. Generate a secret private key for JWT token generation for the user service.

    Specify the path to an ecdsa private key or provide the content of one directly in environment variable JWT_PRIVATE_KEY at user service.

    You can generate a key with the following command:

    ssh-keygen -t ecdsa -f privateKey.pem -m pem

    When step is missing, container will use a random but secure generated key on each start.

  4. Run docker compose -f docker-compose.yml up -d to start the containers defined in the Compose file

  5. Run docker compose down to stop container, networks, volumes, and images created by up.

The main application entrypoint is now available at http://localhost:80

Test dataset

The test data set comprises a variety of sample products with pricing information. It also includes lists and profiles of users designed for testing purposes. Access data for a typical test user is outlined as follows:

Email Password
test@example.com test

Testing

To run all tests, you can use the following command in the root directory:

go test -v hsfl.de/group6/hsfl-master-ai-cloud-engineering/...

Integration tests

If you want to include integrations tests in your test flow use the following command:

go test -v hsfl.de/group6/hsfl-master-ai-cloud-engineering/... --tags=integration

Please note, that a with Testcontainers compatible container daemon is needed.

  • Docker Desktop
  • Docker Engine on Linux
  • Testcontainers Cloud

Authors

Dorien Grönwald
dorien.groenwald@stud.hs-flensburg.de
Hochschule Flensburg

Philipp Borucki
philipp.borucki@stud.hs-flensburg.de
Hochschule Flensburg

Jannick Lindner
jannick.lindner@stud.hs-flensburg.de
Hochschule Flensburg

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 80.5%
  • Svelte 14.0%
  • TypeScript 2.5%
  • Jinja 1.2%
  • Shell 0.6%
  • Dockerfile 0.5%
  • Other 0.7%