Creating a service instance for OpenPages with the cpd-cli service-instance create command

After you install OpenPages, you must create at least one OpenPages service instance. Each service instance must be in a different Red Hat® OpenShift® Container Platform project. You can create a service instance in the operands project or in a project that is tethered to the operands project. If you are a Cloud Pak for Data user, you can use the cpd-cli service-instance create command to script the process of creating service instances.

Who needs to complete this task?
To create a service instance by using the cpd-cli, you must have the Create service instances (can_provision) permission in Cloud Pak for Data.
When do you need to complete this task?
Complete this task only if you want to create a service instance from the cpd-cli by using the cpd-cli service-instance create command.
Alternative methods for creating a service instance

Information you need to complete this task

Review the following information before you create a service instance for OpenPages:

Version requirements

All of the components that are associated with an instance of Cloud Pak for Data must be installed or created at the same release. For example, if OpenPages is installed at Version 5.0.3, you must create the service instance at Version 5.0.3.

Important: OpenPages uses a different version number from Cloud Pak for Data. This topic includes a table that shows the OpenPages version for each refresh of Cloud Pak for Data. Use this table to find the correct version based on the version of Cloud Pak for Data that is installed.
Environment variables

The commands in this task use environment variables so that you can run the commands exactly as written.

  • If you don't have the script that defines the environment variables, see Setting up installation environment variables.
  • To use the environment variables from the script, you must source the environment variables before you run the commands in this task. For example, run:
    source ./cpd_vars.sh

Before you begin

This task assumes that the following prerequisites are met:

Prerequisite Where to find more information
OpenPages is installed. If this task is not complete, see Installing OpenPages.
The cpd-cli command-line interface is installed on the workstation from which you will create the service instance. If this task is not complete, see Setting up a client workstation.
You created a Cloud Pak for Data user profile on the workstation from which you will create the service instance.

The profile must be associated with a user who has the Create service instances (can_provision) permission in Cloud Pak for Data.

If this task is not complete, see Creating a profile to use the cpd-cli management commands.
If you're using an internal database and you want to run Db2 with limited privileges, configure Db2. See Specifying the privileges that Db2U runs with.
If your deployment is using an external database, ensure that the database is ready.

You need a separate database for each OpenPages instance. The databases can be on the same database server.

Ensure that you have the information that you need from your cluster administrator. See Preparing to provision an OpenPages instance.
If you want to integrate OpenPages with Cognos Analytics, ensure that the Cognos Analytics instance is provisioned and running.
Note: During the provisioning process for OpenPages, Cognos Analytics will be restarted.
Creating a service instance for Cognos Analytics

Procedure

Complete the following tasks to create a service instance:

  1. Creating a service instance
  2. Validating that the service instance was created
  3. What to do next

Creating a service instance

To create a service instance:

  1. Change to the directory on your workstation where you want to create the JSON file that defines the service instance payload.
  2. Set the environment variables that are used to populate the JSON payload for the service instance:
    1. Set the INSTANCE_NAME environment variable to the unique name that you want to use as the display name for the service instance:
      export INSTANCE_NAME="<display-name>"

      This name is displayed on the Instances page of the Cloud Pak for Data web client.

      The display name is a string and can contain alphanumeric characters (a-z, A-Z, 0-9), spaces ( ), dashes (-), underscores (_), and periods (.). Make sure that you surround the display name with quotation marks, as shown in the preceding export command.

    2. Set the INSTANCE_VERSION environment variable to the version that corresponds to the version of Cloud Pak for Data on your cluster:
      export INSTANCE_VERSION=<version>

      Use the following table to determine the appropriate value:

      Cloud Pak for Data version Service instance version
      5.0.3 9.003.2
      5.0.2 9.002.2
      5.0.1 9.002.2
      5.0.0 9.002.1
    3. Set the INSTANCE_SIZE environment variable. The size determines the resources that are allocated to the service instance.
      export INSTANCE_SIZE=<size>
      Valid values are:
      • small_mincpureq
      • xsmall
      • small
      • medium
      • large

      For more information about the resources associated with each size, see the component scaling guidance PDF, which you can download from the IBM Entitled Registry.

    4. Set the COGNOS_INTEGRATION environment variable based on whether you want to integrate the service instance with the Cognos Analytics service:
      export COGNOS_INTEGRATION=<boolean>
      • Specify true to integrate the service instance with Cognos Analytics.
      • Specify false if you don't want to integrate the service instance with Cognos Analytics.
    5. Specify the appropriate environment variables based on whether you will use an external database or an automatically provisioned database:
      Use an external database
      1. Set the DATABASE_PROVIDER environment variable to the appropriate value based on the type of database you are connecting to:
        Db2
        export DATABASE_PROVIDER=Db2
        Oracle
        export DATABASE_PROVIDER=Oracle
      2. Set the DATABASE_SECRET_NAME environment variable to the name of the secret that contains the database credentials:
        export DATABASE_SECRET_NAME=<secret_name>
      3. Set the INSTANCE_PROJECT environment variable to the project where you want to create the service instance.
        Create the service instance in the operands project
        export INSTANCE_PROJECT=${PROJECT_CPD_INST_OPERANDS}

        Create the service instance in a tethered project
        Important: If multiple tethered projects are associated with this instance of Cloud Pak for Data, make sure that the ${PROJECT_CPD_INSTANCE_TETHERED} environment variable is set to the correct project name before you run the export command:
        echo $PROJECT_CPD_INSTANCE_TETHERED
        export INSTANCE_PROJECT=${PROJECT_CPD_INSTANCE_TETHERED}

        Remember: You can create only one service instance in each project.
      Use an automatically provisioned database
      1. Set the DEDICATED_NODE environment variable based on whether you want to run the database on a dedicated node.
        export DEDICATED_NODE=<boolean>
        • Specify true to run the database on a dedicated node.
        • Specify false to run the database on a node where other pods are running.
      2. Set the NODE_LABEL environment variable with the appropriate value for your environment:
        • If you set the NODE_LABEL environment variable to false, set:
          export NODE_LABEL=""
        • If you set the NODE_LABEL environment variable to true but you don't use node labels, set:
          export NODE_LABEL=""

          The database will run on any available node.

        • If you set the NODE_LABEL environment variable to true and you want to run the database on a specific node, set:
          export NODE_LABEL=<node-label>

          If there are multiple nodes with the same label, the database will run on one of the nodes with the specified label.

  3. Create the openpages-instance.json payload file.

    The command that you run depends on whether you want to use an external database or an internal database.


    Use an external database
    cat << EOF > ./openpages-instance.json
    {
        "display_name": "${INSTANCE_NAME}",
        "namespace": "${INSTANCE_PROJECT}",
        "addon_version": "${INSTANCE_VERSION}",
        "addon_type": "openpages",
        "create_arguments": {
            "metadata": {
                "databaseType": "external",
                "database": "${DATABASE_PROVIDER}",
                "dbSecretName": "${DATABASE_SECRET_NAME}",
                "blockStorageClass": "",
                "fileStorageClass": "${STG_CLASS_FILE}",
                "enableIntegrationWithCognos": ${COGNOS_INTEGRATION}, 
                "scaleConfig": "${INSTANCE_SIZE}"
            }
        },
    }
    EOF
    The following environment variables use the values that are already defined in your installation environment variables script:
    • ${STG_CLASS_FILE}

    Use an automatically provisioned, integrated database

    Run the appropriate command based on the type of storage on your cluster.

    All storage except Portworx
    cat << EOF > ./openpages-instance.json
    {
        "display_name": "${INSTANCE_NAME}",
        "namespace": "${PROJECT_CPD_INST_OPERANDS}",
        "addon_version": "${INSTANCE_VERSION}",
        "addon_type": "openpages",
        "create_arguments": {
            "metadata": {
                "databaseType": "internal",
                "database": "Db2",
                "dedicatedDbNodes": ${DEDICATED_NODE},
                "dbNodeLabelValue": "${NODE_LABEL}",
                "dbDataStorageClass": "${STG_CLASS_BLOCK}",
                "dbMetaStorageClass": "${STG_CLASS_FILE}",
                "dbBackupStorageClass": "${STG_CLASS_FILE}",
                "appStorageClass": "${STG_CLASS_FILE}",
                "enableIntegrationWithCognos": ${COGNOS_INTEGRATION},
                "scaleConfig": "${INSTANCE_SIZE}"
            }
        }
    }
    EOF
    The following environment variables use the values that are already defined in your installation environment variables script:
    • ${PROJECT_CPD_INST_OPERANDS}
    • ${STG_CLASS_BLOCK}
    • ${STG_CLASS_FILE}
    Portworx storage
    cat << EOF > ./openpages-instance.json
    {
        "display_name": "${INSTANCE_NAME}",
        "namespace": "${PROJECT_CPD_INST_OPERANDS}",
        "addon_version": "${INSTANCE_VERSION}",
        "addon_type": "openpages",
        "create_arguments": {
            "metadata": {
                "databaseType": "internal",
                "database": "Db2",
                "dedicatedDbNodes": ${DEDICATED_NODE},
                "dbNodeLabelValue": "${NODE_LABEL}",
                "dbDataStorageClass": "portworx-db2-rwo-sc",
                "dbMetaStorageClass": "portworx-db2-rwx-sc",
                "dbBackupStorageClass": "portworx-db2-rwx-sc",
                "appStorageClass": "portworx-shared-gp3",
                "enableIntegrationWithCognos": ${COGNOS_INTEGRATION},
                "scaleConfig": "${INSTANCE_SIZE}"
            }
        }
    }
    EOF
    The following environment variables use the values that are already defined in your installation environment variables script:
    • ${PROJECT_CPD_INST_OPERANDS}

    The following environment variables use the values that are already defined in your installation environment variables script:
    • ${PROJECT_CPD_INST_OPERANDS}
    • ${STG_CLASS_FILE}
  4. Set the PAYLOAD_FILE environment variable to the fully qualified name of the JSON payload file on your workstation:
    export PAYLOAD_FILE=<fully-qualified-JSON-file-name>
  5. Create the service instance from the payload file:
    cpd-cli service-instance create \
    --profile=${CPD_PROFILE_NAME} \
    --from-source=${PAYLOAD_FILE}

Validating that the service instance was created

To validate that the service instance was created, run the following command:

cpd-cli service-instance status ${INSTANCE_NAME} \
--profile=${CPD_PROFILE_NAME} \
--output=json
  • If the command returns PROVISIONED, the service instance was successfully created.
  • If the command returns PROVISION_IN_PROGRESS, wait a few minutes and run the command again.
  • If the command returns FAILED, review the pod logs for the zen-core-api and zen-watcher pods for possible causes.

What to do next

After you provision the instance, you need to do some post-installation tasks before users use OpenPages.