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.
-
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 inspring-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 inspring-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 inspring-metal.yml
)
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 config --containerapp-registry [YOUR CONTAINER REGISTRY]
tanzu build -o build-output
Follow these commands to deploy your application from the build-output folder:
tanzu deploy --from-build build-output
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
- Solution: Ensure that all credentials and connection details in
.tanzu/config/services
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.