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.
- 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.
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.
Set up your Kubernetes environment ensuring all prerequisites are met:
tanzu login
tanzu context use <my-context>
tanzu project use <my-project>
tanzu space use <my-space>
Follow these commands to build your application:
tanzu build -o build-output
Follow these commands to deploy your application from the build-output folder:
tanzu deploy --from-build build-output
Place your configuration files in the conf/.secret
directory. Adjust the YAML files to match the connection details provided by the external service.
Create and bind pre-provisioned services:
tanzu context use <my-context>
kubectl create -f conf/.secret
tanzu service bind PreProvisionedService/<genaiservicename> ContainerApp/<appname> --as genai
tanzu services bind PostgreSQLInstance/<postgresname> ContainerApp/<appname> --as db
- Solution: Ensure that all credentials and connection details in
conf/.secret
are correct and updated.
- 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.
Contributions to this project are welcome. Please ensure to follow the existing coding style and add unit tests for any new or changed functionality.