Skip to content

A workshop combining DevSpaces, Quarkus, Backstage, OpenShift, Trusted Application Pipeline, and OpenShift.ai

License

Notifications You must be signed in to change notification settings

ribardo0/quarkus-openshift-workshop

 
 

Repository files navigation

quarkus-openshift-workshop

A workshop combining DevSpaces, Quarkus, Backstage, OpenShift, Trusted Application Pipeline, and OpenShift.ai

Running the application in dev mode (locally)

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).

Deployment on OpenShift

  1. In a terminal, run the following commands:
kubectl apply -f kubernetes/frontend-route.yaml -f kubernetes/hero-database.yaml -f kubernetes/villain-database.yaml
  1. 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
  1. 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
  1. 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'`"

About

A workshop combining DevSpaces, Quarkus, Backstage, OpenShift, Trusted Application Pipeline, and OpenShift.ai

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 76.5%
  • JavaScript 20.6%
  • CSS 1.9%
  • HTML 1.0%