Deploying new applications

Deploy new applications so that other users can use the application. This procedure explains how to deploy applications from your local workstation.

To deploy customizations to an existing application, see Deploying customizations for existing applications.

Note: This topic is applicable to the SaaS version of Order Hub only.

Procedure

  1. Retrieve the Customization folder, Customization client ID, Customization auth key for each of the tenants where you want to deploy the customizations.

    You might need to contact an administrator to get the Customization auth key if the tenants are already configured for customization. For more information, see Enabling the customization menu for a tenant.

  2. Retrieve the Feature JSON value from Order Hub.
    1. Log in to Order Hub.
    2. Switch to the customization tenant where you tested your customizations.
    3. Go to Settings > Customization.
    4. Select the custom menu item that launches the custom application.
    5. If you want to deploy customizations to the customization tenant where you tested your customizations, ensure that you select Hosted by IBM and you clear Local development environment. Otherwise, the tenant will continue to connect to your local server.
    6. In the Relative URL field, add the relative path to your application /<module-name>/<route-name> that you defined in your app-config.json file. Start with a forward slash (/). You do not need to include a trailing slash.

      For example, /custom-app/custom-page1.

    7. Save all changes.
    8. Copy the JSON from the Feature json field in the UI.
      The JSON from the UI resembles the following sample.
      {
          "featureId": "custom-[Id]", // must be unique
          "state": "ACTIVE",
          "sequence": 0,
          "title": "[Title to display for the custom application]",
          "iconName": "website-20",
          "link": "/[module-name]/[path to new route]",
          "path": "/[path to new route]",
          "hidden": true,
          "allowedRoles": [   //the roles that can access this customization
            "Fulfillment Manager",
            "Tenant Administrator"
          ],
          "description": [
            {
              "locale": "en_US",
              "language": "en",
              "title": "Title to display for the custom feature"
            }
          ],
          "type": "IFRAME"
        }
  3. Open the features.json in the module's root directory.
    For example, devtoolkit_docker/orderhub-code/custom-app/features.json. If the file does not exist, then create the file.
  4. Paste the JSON that you copied from step 2.h as an array element in the features.json file.
    Depending on the contents in the features.json, you might need to surround the code with square brackets [] to add as an array element.
  5. In each route, for each environment where you want to deploy customizations, add a build target to build your customizations.
    1. Open each route's package.json file.
      For example, devtoolkit_docker/orderhub-code/custom-app/packages/custom-page1/package.json and devtoolkit_docker/orderhub-code/custom-app/packages/custom-page2/package.json.
    2. Add the following build target command for the environments where you want to deploy the customizations.
      "build-<env>": "yarn build --deploy-url=<customization folder>/<module-name>/<route-name>/",
      The value for <customization folder> is the value that you retrieved from step 1. Each target environment has a different customization folder value.
      For example, if you want to deploy to four environments; dev1, qa3, preprod, and prod, then add the following code.
      "build-dev1": "yarn build --deploy-url=/buc-app-customization/T3R4fagafd45aadfaffasf/custom-app/custom-page1/",
      "build-qa3": "yarn build --deploy-url=/buc-app-customization/dbU2K1u4seqrRKwBZTyMp1lUJwqQkJ5A/custom-app/custom-page1/",
      "build-preprod": "yarn build --deploy-url=/buc-app-customization/zdD4uxaf8GRTbzMSg8zU2K/custom-app/custom-page1/",
      "build-prod": "yarn build --deploy-url=/buc-app-customization/balohTK3ang5GmXsRwOSeSidbQOKEw6N/custom-app/custom-page1/",
  6. Add a build targets to the root-config package.json file.
    1. Open the devtoolkit_docker/orderhub-code/<custom-module-name>/<custom-short-name>-root-config/package.json root config folder.
    2. For each environment where you want to deploy customizations, add build targets similar to the following code.
      "build-<env>": "yarn build --env baseHref=<customization folder>/<module-name>/ --env deploy-url=<customization folder>/<module-name>/<route-name>/",
      Where <route-name> is the default route.
      For example, if you want to deploy to four environments; dev1, qa3, preprod, and prod, then add code similar to the following sample:
      "build-dev1": "yarn build --env baseHref=/buc-app-customization/T3R4fagafd45aadfaffasf/custom-app --env deploy-url=/buc-app-customization/T3R4fagafd45aadfaffasf/custom-app/custom-page1/",
      "build-qa3": "yarn build --env baseHref=/buc-app-customization/dbU2K1u4seqrRKwBZTyMp1lUJwqQkJ5A/custom-app --env deploy-url=/buc-app-customization/dbU2K1u4seqrRKwBZTyMp1lUJwqQkJ5A/custom-app/custom-page1/",
      "build-preprod": "yarn build --env baseHref=/buc-app-customization/zdD4uxaf8GRTbzMSg8zU2K/custom-app --env deploy-url=/buc-app-customization/zdD4uxaf8GRTbzMSg8zU2K/custom-app/custom-page1/",
      "build-prod": "yarn build --env baseHref=/buc-app-customization/balohTK3ang5GmXsRwOSeSidbQOKEw6N/custom-app --env deploy-url=/buc-app-customization/balohTK3ang5GmXsRwOSeSidbQOKEw6N/custom-app/custom-page1/",
  7. Run the following command to build the customization package for each target environment.
    yarn build-<env>
    For example,
    • To build for the dev1 environment:
      yarn build-dev1
    • To build for the qa3 environment:
      yarn build-qa3
  8. Run the following command to publish the customizations to your target environment.
    The target environment is determined by the client-id and client-secret. Each environment has a unique client id-secret pair.
    yarn orderhub-cli publish-customization --client-id=<clientId> --client-secret=<clientSecret> --package-name=<module-name>

    Required Parameters:

    • --client-id - The customization client ID. For more information about how to get the ID and secret, see Enabling the customization menu for a tenant.
    • --client-secret - The customization client secret.
    • --package-name - The module folder under the build directory that contains the files to upload. This value corresponds to the module name, such as custom-app.

    Optional Parameters:

    • --orderhub-hostname - The hostname for the Order Hub API server. Defaults to app.omsbusinessusercontrols.ibm.com.
    • --proxy-host - The proxy hostname and port in case the build machine does not have access to orderhub-hostname directly.
    • --package-only - Indicates whether to build the customization asset zip only. Defaults to false
    • --publish-only - Indicates whether to upload a prebuilt customization package. Defaults to false. If set to true, you must also specify the package to publish by using the --package-name parameter. For the --package-name, specify the path to <build-dir>/<package-name>.zip. For example,
      --publish-only=true --package-name=./dist/custom-app.zip
    • --build-dir - The directory that contains the compiled customization asset. Defaults to dist
    Note: Configurations from the custom menu will take precedence over deployment. If you made changes to the custom menu screen for a deployed feature, delete the menu item to revert back to what has been published.

What to do next

Building customizations. For more information, see Building the customizations.