A workshop combining DevSpaces, Quarkus, Backstage, OpenShift, Trusted Application Pipeline, and OpenShift.ai
Prerequisites:
- Java 21
- Podman or Docker
Open 4 terminals and run the following commands:
- Terminal 1
cd fight-ui
./mvnw quarkus:dev
- Terminal 2 (variant OpenShift AI)
cd fight-service
export LLM_API_ENDPOINT=https://<your-openshift-ai-endpoint>/v1
export LLM_MODEL=granite-7b-instruct
./mvnw quarkus:dev
- Terminal 2 (variant Open AI)
cd fight-service
export OPENAI_API_KEY=your_api_key
./mvnw quarkus:dev
- Terminal 3
cd hero-service
./mvnw quarkus:dev
- Terminal 4
cd villain-service
./mvnw quarkus:dev
Then, open your browser and navigate to http://localhost:8080
to see the application running (fight-UI).
- In a terminal, run the following commands:
kubectl apply -f kubernetes/frontend-route.yaml -f kubernetes/hero-database.yaml -f kubernetes/villain-database.yaml
- You need to choose between OpenAI or OpenShift AI variant:
-
To deploy the OpenAI variant, edit the kubernetes/openai.yaml and add your OpenAI API key.
echo -n $YOUR_KEY | base64
apiVersion: v1 kind: Secret metadata: labels: app: llm name: llm-config data: LLM_ENDPOINT: aHR0cHM6Ly9hcGkub3BlbmFpLmNvbS92MS8= MODEL_NAME: Z3B0LTRvLW1pbmk= OPENAI_API_KEY: Copy output here type: Opaque
Then apply the secret:
kubectl apply -f kubernetes/openai.yaml git update-index --assume-unchanged kubernetes/openai.yaml # to make sure you do not leak the key
-
To deploy the OpenShift AI variant:
kubectl apply -f kubernetes/openshift-ai.yaml
- Deploy the application:
kubectl apply -f fight-ui/kubernetes.yml -f hero-service/kubernetes.yml -f villain-service/kubernetes.yml -f fight-service/kubernetes.yml
- Retrieve the URL of the frontend:
echo "Route: https://`oc get routes -o json --field-selector metadata.name=fight-ui | jq -r '.items[0].spec.host'`"