[go: nahoru, domu]

Skip to content

0pens0/spring-metal

 
 

Repository files navigation

Demo of Tanzu platform and SpringAI

Spring Boot AI LLM PostgreSQL Tanzu

This repository contains artifacts necessary to build and run generative AI applications using Spring Boot and Tanzu Platform. The instructions below cover setup for both Cloud Foundry (cf) and Kubernetes (k8s) environments.

Architecture

Alt text

Prerequisites

  • Ensure you have the latest version of the Tanzu CLI installed.
  • Access to a Route53 domain and necessary AWS permissions.
  • Configured egress settings (closed by default) to connect to external services.

Preperations

  • Create a .tanzu/config and .tanzu/services folders

  • Copy runtime-configs/tpk8s/tanzu-changeme/spring-metal.yml to .tanzu/config and update the CHANGE_ME tokens

  • Copy runtime-configs/tpk8s/tanzu-changeme/httproute.yml to .tanzu/config and update the CHANGE_ME tokens (app name must match info in spring-metal.yml)

  • Copy runtime-configs/tpk8s/tanzu-changeme/genai-external-service.yml to .tanzu/services and update the CHANGE_ME tokens (all keys must be in 64 bit format)

  • Copy runtime-configs/tpk8s/tanzu-changeme/genai-service-binding.yml to .tanzu/services and update the CHANGE_ME tokens (app name must match info in spring-metal.yml)

  • Copy runtime-configs/tpk8s/tanzu-changeme/postgres-external-service.yml to .tanzu/services and update the CHANGE_ME tokens (all keys must be in 64 bit format)

  • Copy runtime-configs/tpk8s/tanzu-changeme/postgres-service-binding.yml to .tanzu/services and update the CHANGE_ME tokens (app name must match info in spring-metal.yml)

Installation

Cloud Foundry Runtime

Set up your target environment and create necessary back-end services for the ai demo:

cf target -o ai-apps -s ai-spring-metal
cf create-service private-ai-service shared-ai-plan ai-service
cf create-service-key ai-service ai-key
cf service-key ai-service ai-key
cf create-service postgres on-demand-postgres-db pgvector
cf create-service-key pgvector pg-key
cf service-key pgvector pg-key
cf push

Notes:

  • if your Cloud Foundry Runtime srrvices are hosted on a private network, you will need to create or update your postgres service with the TCP Router and Service instance gateway. Documentation
  • The contents of your Kubernetes service secret can be viewed through the service key.

Kubernetes Runtime

Set up your Kubernetes environment ensuring all prerequisites are met:

Set context:

tanzu login
tanzu context use <my-context>
tanzu project use <my-project>
tanzu space use <my-space>

Build

Follow these commands to build your application:

tanzu build config --containerapp-registry [YOUR CONTAINER REGISTRY] 
tanzu build -o build-output

Deploy

Follow these commands to deploy your application from the build-output folder:

tanzu deploy --from-build build-output

Bind

Create and bind the pre-provisioned services :

Create secrets to external Postgres (with pgvector) and GenAI control apis running on TPCF and bind them as pre-provisioned services

tanzu context use <my-context>
kubectl apply -f .tanzu/services

Troubleshooting

Issue: Problem with external service binding.

  • Solution: Ensure that all credentials and connection details in .tanzu/config/services are correct and updated.

Issue: Application deployment fails.

  • Solution: Check the build output for errors and verify the Tanzu configuration settings.

Browse your application through the app ingress link provided in the Space UI after deployment.

Contributing

Contributions to this project are welcome. Please ensure to follow the existing coding style and add unit tests for any new or changed functionality.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 56.6%
  • HTML 23.1%
  • JavaScript 12.9%
  • CSS 5.1%
  • Shell 1.6%
  • Smalltalk 0.7%