To deploy this project on OpenShift, follow these steps:
-
Log in to your OpenShift cluster:
oc login --token=YOUR_TOKEN --server=YOUR_SERVER
-
Create a new project (optional):
oc new-project <project-name> oc project <project-name>
-
Build the application:
$ oc new-build --strategy docker --binary --name=watsonx-texttosql-app $ oc start-build watsonx-texttosql-app --from-dir=. --follow --wait
-
Deploy the application:
$ oc new-app watsonx-texttosql-app --name=watsonx-texttosql-app
-
Expose a Secure URL for this FastAPI app:
$ oc create route edge --service=watsonx-texttosql-app
A quick sanity check with the url created from the route:
<url>/docs
will take you to the swagger ui. -
Update
openshift-setup/secrets.yaml
with the required values -
Create the secret in the project namespace
oc apply -f openshift-setup/secrets.yaml
-
Update
openshift-setup/snippet_deployment.yaml
with the secret name -
Open the watsonx-texttosql-app deployment in IBM Cloud OpenShift console and scale the Pod to 0.
-
Select the YAML tab and search for the
spec: containers section
spec: containers: - resources: {} terminationMessagePath: /dev/termination-log name: watsonx-texttosql-app
or
spec: containers: - name: watsonx-texttosql-app
Below the name, paste the content from the
openshift-setup/snippet_deployment.yaml
and save it.Example:
name: watsonx-texttosql-app env: - name: RAG_APP_API_KEY valueFrom: secretKeyRef: name: rag key: RAG_APP_API_KEY - name: IBM_CLOUD_API_KEY valueFrom: secretKeyRef: name: rag key: IBM_CLOUD_API_KEY ...
-
Scale the pod to back to 1.