1.4. 为 Red Hat Developer Hub 安装和配置 Red Hat Developer Lightspeed


您必须为 RHDH 和 RCS sidecar 容器安装和配置 Developer Lightspeed。

先决条件

流程

  1. 创建 RCS ConfigMap。

    1. 在 OpenShift Container Platform Web 控制台中,进入您的 RHDH 实例并选择 ConfigMaps 选项卡。
    2. Create ConfigMaps
    3. Create ConfigMap 页面中,在 Configure via 中选择 YAML view 选项,并编辑该文件,如下例所示:

      kind: ConfigMap
      apiVersion: v1
      metadata:
       name: rcsconfig
       namespace: _<namespace>_ # Enter your namespace (For example, `rhdh`)
      data:
       rcsconfig.yaml: |
        llm_providers:
          - name: dummy
            type: openai
            url: 'https://dummy.com'
            models:
              - name: dummymodel
        ols_config:
          reference_content:
            product_docs_index_path: "./vector_db/rhdh_product_docs/1.7"
            product_docs_index_id: rhdh-product-docs-1_7
            embeddings_model_path: "./embeddings_model"
          conversation_cache:
            type: memory
            memory:
              max_entries: 1000
            authentication_config:
              module: noop
            default_provider: dummy
            default_model: dummymodel
            query_validation_method: llm
          user_data_collection:
            feedback_disabled: false
            feedback_storage: /app-root/tmp/data/feedback
        dev_config:
          enable_dev_ui: false
          disable_auth: false
          disable_tls: true
          enable_system_prompt_override: true
        user_data_collector_config:
          ingress_url: 'https://example.ingress.com/upload'
          user_agent: example-agent
      Copy to Clipboard Toggle word wrap
    4. 可选:通过在 RCS ConfigMap 中指定以下示例来配置 扩展 REST API 的 worker 数量。

      ols_config:
          max_workers: _<number_of_workers>_
      Copy to Clipboard Toggle word wrap
    5. Create
  2. 为 RHDH ConfigMap 创建 Developer Lightspeed。

    注意

    为 RHDH ConfigMap 创建专用的 Developer Lightspeed,而不是向现有的 RHDH 自定义应用程序配置文件添加额外的部分(例如 lightspeed-app-config.yaml)。创建两个文件可防止整个 RHDH ConfigMap 加载到 RCS 中。

    1. 在 OpenShift Container Platform Web 控制台中,进入您的 RHDH 实例并选择 ConfigMaps 选项卡。
    2. Create ConfigMap
    3. Create ConfigMap 页面中,选择 Configure via 中的 YAML view 选项,并添加以下示例:

      kind: ConfigMap
      apiVersion: v1
      metadata:
        name: lightspeed-app-config
        namespace: <__namespace__> # Enter your RHDH instance namespace
      data:
        app-config.yaml: |-
          backend:
            csp:
               upgrade-insecure-requests: false
             img-src:
                - "'self'"
                - "data:"
                - https://img.freepik.com
                - https://cdn.dribbble.com
                - https://avatars.githubusercontent.com # This is to load GitHub avatars in the UI
             script-src:
                 - "'self'"
                 - https://cdn.jsdelivr.net
      
          lightspeed:
            # REQUIRED: Configure LLM servers with OpenAI API compatibility
            servers:
              - id: ${LIGHTSPEED_SERVER_ID}
                url: ${LIGHTSPEED_SERVER_URL}
                token: ${LIGHTSPEED_SERVER_TOKEN}
      
            # OPTIONAL: Enable/disable question validation (default: true)
            # When enabled, restricts questions to RHDH-related topics for better security
            questionValidation: true
      
            # OPTIONAL: Custom users prompts displayed to users
            # If not provided, the plugin uses built-in default prompts
            prompts:
              - title: 'Getting Started with Red Hat Developer Hub'
                message: Can you guide me through the first steps to start using Developer Hub as a developer, like exploring the Software Catalog and adding my service?
      
            # OPTIONAL: Port for lightspeed service (default: 8080)
            # servicePort: ${LIGHTSPEED_SERVICE_PORT}
      
            # OPTIONAL: Override default RHDH system prompt
            # systemPrompt: "You are a helpful assistant focused on Red Hat Developer Hub development."
      Copy to Clipboard Toggle word wrap
  3. 为 RHDH secret 文件创建 Developer Lightspeed。

    1. 在 OpenShift Container Platform Web 控制台中进入 Secrets
    2. Create > Key/value secret
    3. Create key/value secret 页面中,选择 Configure via 中的 YAML view 选项,并添加以下示例:

      kind: Secret
      apiVersion: v1
      metadata:
        name: lightspeed-secrets
        namespace: _<namespace>_ # Enter your rhdh instance namespace
      stringData:
        LLM_SERVER_ID: _<server_id>_ # Enter your server ID (for example, `ollama` or `granite`)
        LLM_SERVER_TOKEN: _<token>_ # Enter your server token value
        LLM_SERVER_URL: _<server_url>_ # Enter your server URL
      type: Opaque
      Copy to Clipboard Toggle word wrap
    4. Create
  4. 在现有的动态插件 ConfigMap (如 dynamic-plugins-rhdh.yaml)中,为 RHDH 插件镜像添加 Developer Lightspeed,如下例所示:

    includes:
      - dynamic-plugins.default.yaml
     plugins:
      - package: oci://ghcr.io/redhat-developer/rhdh-plugin-export-overlays/red-hat-developer-hub-backstage-plugin-lightspeed:bs_1.39.1__0.5.7!red-hat-developer-hub-backstage-plugin-lightspeed
        disabled: false
        pluginConfig:
          lightspeed:
            # OPTIONAL: Custom users prompts displayed to users
            # If not provided, the plugin uses built-in default prompts
            prompts:
              - title: 'Getting Started with Red Hat Developer Hub'
                message: Can you guide me through the first steps to start using Developer Hub
                  as a developer, like exploring the Software Catalog and adding my
                  service?
          dynamicPlugins:
            frontend:
              red-hat-developer-hub.backstage-plugin-lightspeed:
                appIcons:
                  - name: LightspeedIcon
                    module: LightspeedPlugin
                    importName: LightspeedIcon
                dynamicRoutes:
                  - path: /lightspeed
                    importName: LightspeedPage
                    module: LightspeedPlugin
                    menuItem:
                      icon: LightspeedIcon
                      text: Lightspeed
      - package: oci://ghcr.io/redhat-developer/rhdh-plugin-export-overlays/red-hat-developer-hub-backstage-plugin-lightspeed-backend:bs_1.39.1__0.5.7!red-hat-developer-hub-backstage-plugin-lightspeed-backend
        disabled: false
        pluginConfig:
          lightspeed:
            # REQUIRED: Configure LLM servers with OpenAI API compatibility
            servers:
              - id: ${LLM_SERVER_ID}
                url: ${LLM_SERVER_URL}
                token: ${LLM_SERVER_TOKEN}
    
            # OPTIONAL: Port for lightspeed service (default: 8080)
            # servicePort: ${LIGHTSPEED_SERVICE_PORT}
    Copy to Clipboard Toggle word wrap
  5. 根据您的安装方法更新部署配置:

    1. 对于 Operator 安装的 RHDH 实例,请更新 Backstage 自定义资源(CR)。

      1. spec.application.appConfig.configMaps 部分中,为 RHDH 自定义应用程序配置添加 Developer Lightspeed,如下例所示:

              appConfig:
                configMaps:
                  - name: lightspeed-app-config
                mountPath: /opt/app-root/src
        Copy to Clipboard Toggle word wrap
      2. 更新 extraVolumes 规格,使其包含 RCS ConfigMap,如下例所示:

                    volumes:
                      - configMap:
                          name: rcsconfig
                        name: rcsconfig
        Copy to Clipboard Toggle word wrap
      3. 更新 volumeMounts 规格以挂载 RCS ConfigMap,如下例所示:

                volumeMounts:
                  - mountPath: /app-root/config/rcsconfig.yaml
                    name: rcsconfig
                    subPath: rcsconfig.yaml
                  - mountPath: /app-root/config/app-config-rhdh.yaml
                    name: lightspeed-app-config
                    subPath: app-config.yaml
        Copy to Clipboard Toggle word wrap
      4. 为 RHDH Secret 文件添加 Developer Lightspeed,如下例所示:

                envFrom:
                  - secretRef:
                      name: lightspeed-secrets
        Copy to Clipboard Toggle word wrap
      5. deployment.patch.spec.template.spec.containers.env 部分中,设置 RCS 环境变量,如下例所示:

            - name: PROJECT
              value: rhdh
            - name: RCS_CONFIG_FILE
              value: /app-root/config/rcsconfig.yaml
            - name: RHDH_CONFIG_FILE
              value: /app-root/config/app-config-rhdh.yaml
        Copy to Clipboard Toggle word wrap
        注意

        您的 RHDH 容器通常已存在于您的 CR 中。您要添加第二个容器定义 road-core-sidecar 作为 RCS sidecar。

      6. 点击 Save。Pod 会自动重启。

        带有 RCS 容器的 Backstage CR 示例

        apiVersion: rhdh.redhat.com/v1alpha3
        kind: Backstage
        metadata:
          name: backstage
          namespace: _<namespace>_ # your RHDH instance namespace
        spec:
          application:
            appConfig:
             configMaps:
        # Adding the Developer Lightspeed custom app config file
               - name: lightspeed-app-config
             mountPath: /opt/app-root/src
            dynamicPluginsConfigMapName: dynamic-plugins-rhdh
            extraEnvs:
        # Adding the Developer Lightspeed secrets file
              secrets:
                - name: lightspeed-secrets
            replicas: 1
            extraFiles:
              mounthPath: /opt/app-root/src
            replicas: 1
            route:
              enabled: true
          database:
            enableLocalDb: true
          deployment:
            patch:
              spec:
                template:
                  spec:
                    containers:
                      - env:
                          - name: PROJECT
                            value: rhdh
        # Mounting the RCS sidecar to your RHDH instance
                          - name: RCS_CONFIG_FILE
                            value: /app-root/config/rcsconfig.yaml
        # Your existing RHDH ConfigMap
                          - name: RHDH_CONFIG_FILE
                            value: /app-root/config/app-config-rhdh.yaml
                        envFrom:
                          - secretRef:
                              name: lightspeed-secrets
                        image: 'quay.io/redhat-ai-dev/road-core-service:rcs-06302025-rhdh-1.7'
                        name: road-core-sidecar
                        ports:
                          - containerPort: 8080
                            name: rcs-backend
                            protocol: TCP
                        volumeMounts:
        # Mounting the RCS sidecar to your RHDH instance
                          - mountPath: /app-root/config/rcsconfig.yaml
                            name: rcsconfig
                            subPath: rcsconfig.yaml
        # Mounting the Lightspeed app config file to your RCS container
                          - mountPath: /app-root/config/app-config-rhdh.yaml
                            name: lightspeed-app-config
                            subPath: app-config.yaml
                    volumes:
                      - configMap:
                          name: rcsconfig
                        name: rcsconfig
        Copy to Clipboard Toggle word wrap

    2. 对于 Helm 安装的 RHDH 实例,请更新您的 Helm Chart。

      1. 在'global.dynamic' 属性中添加动态插件配置,如下例所示:

        global:
        dynamic:
          includes:
          - dynamic-plugins.default.yaml
          plugins:
          - package: oci://ghcr.io/redhat-developer/rhdh-plugin-export-overlays/red-hat-developer-hub-backstage-plugin-lightspeed:bs_1.39.1__0.5.7!red-hat-developer-hub-backstage-plugin-lightspeed
            disabled: false
            pluginConfig:
              lightspeed:
                # OPTIONAL: Custom users prompts displayed to users
                # If not provided, the plugin uses built-in default prompts
                prompts:
                  - title: 'Getting Started with Red Hat Developer Hub'
                    message: Can you guide me through the first steps to start using Developer Hub
                      as a developer, like exploring the Software Catalog and adding my
                      service?
              dynamicPlugins:
                frontend:
                  red-hat-developer-hub.backstage-plugin-lightspeed:
                    appIcons:
                      - name: LightspeedIcon
                        module: LightspeedPlugin
                        importName: LightspeedIcon
                    dynamicRoutes:
                      - path: /lightspeed
                        importName: LightspeedPage
                        module: LightspeedPlugin
                        menuItem:
                          icon: LightspeedIcon
                          text: Lightspeed
          - package: oci://ghcr.io/redhat-developer/rhdh-plugin-export-overlays/red-hat-developer-hub-backstage-plugin-lightspeed-backend:bs_1.39.1__0.5.7!red-hat-developer-hub-backstage-plugin-lightspeed-backend
            disabled: false
            pluginConfig:
              lightspeed:
                # REQUIRED: Configure LLM servers with OpenAI API compatibility
                servers:
                  - id: ${LLM_SERVER_ID}
                    url: ${LLM_SERVER_URL}
                    token: ${LLM_SERVER_TOKEN}
                # OPTIONAL: Port for lightspeed service (default: 8080)
                # servicePort: ${LIGHTSPEED_SERVICE_PORT}
        Copy to Clipboard Toggle word wrap
      2. 为 RHDH 自定义应用程序配置文件添加 Developer Lightspeed,如下例所示:

         extraAppConfig:
              - configMapRef: lightspeed-app-config
                filename: app-config.yaml
        Copy to Clipboard Toggle word wrap
      3. 更新 extraVolumes 部分,使其包含 RCS ConfigMap,如下例所示:

        extraVolumes:
              - configMap:
                  name: rcsconfig
                name: rcsconfig
        Copy to Clipboard Toggle word wrap
      4. 更新 extraVolumeMounts 部分以挂载 RCS ConfigMap,如下例所示:

         extraVolumeMounts:
              - mountPath: /app-root/config/rcsconfig.yaml
                name: rcsconfig
        Copy to Clipboard Toggle word wrap
      5. 为 RHDH Secret 文件添加 Developer Lightspeed,如下例所示:

         extraEnvVarsSecrets:
              - lightspeed-secrets
        Copy to Clipboard Toggle word wrap
      6. 添加 RCS 镜像,如下例所示:

           extraContainers:
              - env:
                  - name: PROJECT
                    value: rhdh
                  - name: RCS_CONFIG_FILE
                    value: /app-root/config/rcsconfig.yaml
                  - name: RHDH_CONFIG_FILE
                    value: /app-root/config/lightspeed-app-config.yaml
                envFrom:
                  - secretRef:
                      name: lightspeed-secrets
                image: 'quay.io/redhat-ai-dev/road-core-service:rcs-06302025-rhdh-1.7'
                name: road-core-sidecar
                ports:
                  - containerPort: 8080
                    name: rcs-backend
                    protocol: TCP
                volumeMounts:
                  - mountPath: /app-root/config/rcsconfig.yaml
                    name: rcsconfig
                    subPath: rcsconfig.yaml
                  - mountPath: /app-root/config/lightspeed-app-config.yaml
                    name: lightspeed-app-config
                    subPath: app-config.yaml
        Copy to Clipboard Toggle word wrap
        注意

        您的 RHDH 容器通常已存在于 Helm Chart 中。您要添加第二个容器定义 road-core-sidecar 作为 RCS sidecar。

      7. 点击 Save
      8. Helm upgrade

        带有 RCS 容器的 Helm chart 示例

        global:
         ...
        upstream:
         backstage:
           appConfig:
             ...
           args:
             ...
           extraAppConfig:
             - configMapRef: lightspeed-app-config
               filename: app-config.yaml
           extraContainers:
             - env:
                 - name: PROJECT
                   value: rhdh
                 - name: RCS_CONFIG_FILE
                   value: /app-root/config/rcsconfig.yaml
                 - name: RHDH_CONFIG_FILE
                   value: /app-root/config/lightspeed-app-config.yaml
               envFrom:
                 - secretRef:
                     name: lightspeed-secrets
               image: 'quay.io/redhat-ai-dev/road-core-service:rcs-06302025-rhdh-1.7'
               name: road-core-sidecar
               ports:
                 - containerPort: 8080
                   name: rcs-backend
                   protocol: TCP
               volumeMounts:
                 - mountPath: /app-root/config/rcsconfig.yaml
                   name: rcsconfig
                   subPath: rcsconfig.yaml
                 - mountPath: /app-root/config/lightspeed-app-config.yaml
                   name: lightspeed-app-config
                   subPath: lightspeed-app-config.yaml
           extraEnvVars:
             ...
           extraEnvVarsSecrets:
             - lightspeed-secrets
           extraVolumeMounts:
             - mountPath: /app-root/config/rcsconfig.yaml
               name: rcsconfig
           extraVolumes:
             - configMap:
                 name: rcsconfig
               name: rcsconfig
             ...
           image:
             ...
           initContainers:
             ...
        Copy to Clipboard Toggle word wrap

  6. 通过完成以下步骤,为您的不是管理员的用户定义权限和角色:

    1. 通过定义 rbac-policies.csv 文件来配置所需的 RBAC 权限,如下例所示:

      p, role:default/_<your_team>_, lightspeed.chat.read, read, allow
      p, role:default/_<your_team>_, lightspeed.chat.create, create, allow
      p, role:default/_<your_team>_, lightspeed.chat.delete, delete, allow
      
      g, user:default/_<your_user>_, role:default/_<your_team>_
      Copy to Clipboard Toggle word wrap
    2. rbac-policies.csvrbac-conditional-policies.yaml 文件上传到包含 RHDH 的 OpenShift Container Platform 项目中的 rbac-policies 配置映射。
    3. 更新 Backstage 自定义资源,以便从 rbac-policies ConfigMap 中挂载您的文件:

      apiVersion: rhdh.redhat.com/v1alpha3
      kind: Backstage
      spec:
        application:
          extraFiles:
            mountPath: /opt/app-root/src
            configMaps:
              - name: rbac-policies
      Copy to Clipboard Toggle word wrap

      如需更多信息,请参阅使用 外部文件管理授权

验证

  1. 登录到您的 RHDH 实例。
  2. 在 Red Hat Developer Hub 导航菜单中,您可以看到并访问 Lightspeed 菜单项。单击此菜单可进入 RHDH 屏幕的 Developer Lightspeed。
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat