Deploy the Base Application

Set Up and Configure

10 minutes

Work in the 1-base-app folder for this chapter. These steps create the Python environment, configure secrets, start the database, and load the sample data the agent needs.

Exercise Set up the base application
1

Log into your lab instance

Connect to your workshop EC2 instance (your instructor will provide the connection details). The healthcare assistant is pre-loaded under ~/workshop/healthcare-assistant/, and your OPENAI_API_KEY is already configured in the environment.
2

Create a Kubernetes Secret

Run the following command to create a Kubernetes secret, which the application will use to connect to OpenAI models:

bash
kubectl create secret generic openai-api \
  --from-literal=openai-api-key="$OPENAI_API_KEY" \
  --from-literal=openai-api-endpoint="$OPENAI_BASE_URL"
3

Create a Kubernetes Config Map

Run the following command to create a Kubernetes config map, which the store additional configuration parameters used by the application:

bash
cd ~/workshop/healthcare-assistant/1-base-app
kubectl apply -f healthcare-assistant-config.yaml
4

Start the PostgreSQL Database

The healthcare assistant stores the medicine FAQ embeddings and patient records in PostgreSQL with the pgvector extension. Start PostgreSQL in Kubernetes using the following command:

bash
cd ~/workshop/healthcare-assistant/1-base-app
kubectl apply -f postgres.yaml

Ensure that PostgreSQL is running:

bash
kubectl get pods -l app=postgres
5

Load vector data and relational tables

Embed the medicine FAQ into pgvector and load the patient registry into PostgreSQL. The helper script does both:

bash
cd ~/workshop/healthcare-assistant/1-base-app
kubectl apply -f setup-job.yaml 

This runs python helpers/setup_vectordb.py local, which creates the healthcare_local_index pgvector collection from docs/qa.csv and the healthcare_patient table from docs/relational_patient.csv.

Monitor the job with the following command (it may take 30-60 seconds for the job to start):

bash
kubectl logs -f job/vectordb-setup