Uploaded image for project: 'Red Hat Developer Hub Bugs'
  1. Red Hat Developer Hub Bugs
  2. RHDHBUGS-2625

Add section how to disable SonataFlow references for Orchestrator plugins managed by Operator when it is used an external database

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      Description of problem:

      As part of the resolution of the issue RHDHBUGS-2623 was detected a gap in the current documentation to manage external databases for the SonataFlowPlatform. The default configuration requires the usage of specific patterns to connect to the database, which are related with the default values used by the Operator to deploy the database. When you are using an external database with Red Hat Developer Hub, those resources might be not available and there are other resources to identify the database used. Here is the gap.

      Adding a section in the documentation could help others to follow the right steps to deploy and integrate Red Hat Developer Hub and the Orchestrator using an external database not managed by the Operator.

      Basically the steps to deploy this configuration is:

      1. Having an external database to use with Red Hat Developer Hub. It must be a service available to connect to it.
      2. Having a secret with the credentials to access to database: `POSTGRES_HOST`, `POSTGRES_PORT`, `POSTGRES_USER`, `POSTGRES_PASSWORD`
      3. Deploy the SonataFlowPlatform CR using the resources for the external database. 
      apiVersion: batch/v1
      kind: Job
      metadata:
        name: create-sonataflow-database-developer-hub
      spec:
        ttlSecondsAfterFinished: 30
        activeDeadlineSeconds: 120
        template:
          spec:
            containers:
              - name: psql
                image: quay.io/fedora/postgresql-15:latest
                resources:
                  limits:
                    cpu: "100m"
                    memory: "128Mi"
                  requests:
                    cpu: "100m"
                    memory: "64Mi"
                securityContext:
                  readOnlyRootFilesystem: true
                  allowPrivilegeEscalation: false
                  runAsNonRoot: true
                  capabilities:
                    drop:
                      - ALL
                envFrom:
                  - secretRef:
                      name: <SECRET-NAME-WITH-DB-CREDENTIALS>
                command: [ "sh", "-c" ]
                args:
                  - |
                    set -e
                    DB_EXISTS=$(PGPASSWORD=${POSTGRES_PASSWORD} psql -h ${POSTGRES_HOST} -p ${POSTGRES_PORT} -U ${POSTGRES_USER} -tAc "SELECT 1 FROM pg_database WHERE datname='backstage_plugin_orchestrator'" postgres)
                    if [ -z "$DB_EXISTS" ]; then
                      PGPASSWORD=${POSTGRES_PASSWORD} psql -h ${POSTGRES_HOST} -p ${POSTGRES_PORT} -U ${POSTGRES_USER} -c "CREATE DATABASE backstage_plugin_orchestrator;" postgres
                    fi
            restartPolicy: Never
      ---
      apiVersion: sonataflow.org/v1alpha08
      kind: SonataFlowPlatform
      metadata:
        name: sonataflow-platform
      spec:
        monitoring:
          enabled: true
        services:
          dataIndex:
            enabled: true
            persistence:
              postgresql:
                secretRef:
                  name: <SECRET-NAME-WITH-DB-CREDENTIALS>
                  userKey: POSTGRES_USER
                  passwordKey: POSTGRES_PASSWORD
                serviceRef:
                  name: <SERVICE-NAME-TO-DB>
                  namespace: <RHDH-NAMESPACE>
                  databaseName: backstage_plugin_orchestrator
          jobService:
            enabled: true
            persistence:
              postgresql:
                secretRef:
                  name: <SECRET-NAME-WITH-DB-CREDENTIALS>
                  userKey: POSTGRES_USER
                  passwordKey: POSTGRES_PASSWORD
                serviceRef:
                  name: <SERVICE-NAME-TO-DB>
                  namespace: <RHDH-NAMESPACE>
                  databaseName: backstage_plugin_orchestrator
      1. Declare the Orchestrator Plugins in the dynamic-plugins config to remove the dependency with the `sonataflow` object and declare the service name of the SonataFlowPlatform services created in the previous step:
            # Orchestrator
            - package: "@redhat/backstage-plugin-orchestrator@1.8.2"
              disabled: false
            - package: "@redhat/backstage-plugin-orchestrator-backend-dynamic@1.8.2"
              disabled: false
              pluginConfig:
                orchestrator:
                  dataIndexService:
                    url: http://<SERVICE-NAME-SONATAFLOW-PLATFORM-DATA-INDEX>
              dependencies: [{}]
            - package: "@redhat/backstage-plugin-scaffolder-backend-module-orchestrator-dynamic@1.8.2"
              disabled: false
              pluginConfig:
                orchestrator:
                  dataIndexService:
                    url: http://<SERVICE-NAME-SONATAFLOW-PLATFORM-DATA-INDEX>
              dependencies: [{}]
            - package: "@redhat/backstage-plugin-orchestrator-form-widgets@1.8.2"
              disabled: false
      1.   Update your Red Hat Developer Hub instance to use the new dynamic plugins configuration and inject the database credentials secrets.

      This documentation could be added as extension of one of the following current documentation resources:

      Prerequisites (if any, like setup, operators/versions):

      Steps to Reproduce

       Just follow the introduction of this issue.

      Actual results:

      Expected results:

      Reproducibility (Always/Intermittent/Only Once):

      Build Details:

      Additional info (Such as Logs, Screenshots, etc):

              rhn-support-jmagak Judith Amondi Magak
              rmarting@redhat.com Roman Martin Gil
              RHDH Documentation
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: