Skip to content

Latest commit

 

History

History
 
 

README.md

Backend Service

Overview

The Backend Service provides the following APIs:

  • Customer API: Retrieve customer data.
  • Product API: Retrieve product details.
  • Product Vector API: Retrieve a list of similar products using vector-based search.

The backend connects to Azure Blob Storage and Azure Cosmos MongoDB using Key Vault references with Managed Identity.

Prerequisites

  • Java 17
  • Maven
  • Azure Key Vault with necessary secrets
  • Managed Identity configured in Azure

Local Setup Instructions

  1. Clone the repository:

    git clone https://github.com/Azure-Samples/Java-AI-Based-Content-Generator
    cd Java-AI-Based-Content-Generator/backend
  2. Key Vault Setup: Before adding or accessing secrets in Key Vault, follow the setup instructions in the Azure Key Vault Setup Guide, which include:

    • Assigning the necessary Key Vault Administrator and Key Vault Reader roles.
    • Adding the required secrets for the backend service.
  3. Environment Variables for Local Development: Set the required Azure environment variables to access secrets from Key Vault:

    export AZURE_KEYVAULT_URL=<your_keyvault_url>
  4. Run the Application:

    • Install dependencies:
      ./mvnw clean install
    • Run the application:
      ./mvnw spring-boot:run

    The service will now be running at http://localhost:8080.

Key Vault Secrets

The middleware service requires the following secrets in Azure Key Vault:

  • MiddlewareServiceBaseUrl: http://localhost:8081 (for local), or middleware APIM URL (for deployment)
  • MiddlewareServiceProductEmbeddingEndpoint: /api/v1/generate/embedding (for local), or the middleware APIM endpoint
  • MiddlewareServiceAccessKey: The middleware APIM access key. For local development, this value does not need to be set.
  • AzureCosmosConnectionString
  • MongoDBDatabaseName
  • StorageAccountName
  • StorageContainerName

Deployment