IBM Cloud Pak® for Data Version 4.6 will reach end of support (EOS) on 31 July, 2025. For more information, see the Discontinuance of service announcement for IBM Cloud Pak for Data Version 4.X.
Upgrade to IBM Software Hub Version 5.1 before IBM Cloud Pak for Data Version 4.6 reaches end of support. For more information, see Upgrading IBM Software Hub in the IBM Software Hub Version 5.1 documentation.
Deploying Shiny apps in Watson Machine Learning
Save a Shiny app to a deployment space, then deploy it as an app and make the URL available to users.
For example, if you create an interactive map infographic, you can deploy the app to a server and socialize the link. Users with the link can click to interact with the infographic.
For details on creating Shiny apps, refer to Analyzing data with RStudio.
Tip:
The initial load of a Shiny application might result in an empty page if the app is retrieving many dependent libraries from an external network. If this happens, try refreshing the app after a while. This issue can be corrected by sourcing the dependent libraries locally by bundling them into the Shiny app. For details, refer to Creating R scripts and Shiny apps.
You can deploy Shiny apps from two different asset types:
For details on creating a code package, refer to Code packages.
Deploying a Shiny app
- Locate the package in the Assets list.
- Click the Deploy icon.
- Choose App as the deployment type.
- Provide a name for the deployment.
- In the Serving name field, provide the name to be used as the alternative for the deployment ID.
- The name is validated to be unique within the namespace.
- The name must contain only these characters: [a-z,0-9,_] and must be maximum 36 characters long.
- Adjust any optional settings for the deployment and then click Create.
When the deployment is complete, click the deployment name to view the details and to get the URL for sharing the app deployment.
Deploying a code package that contains a Shiny app
Important: In this version of Cloud Pak for Data, Shiny Apps deployed from code package assets are limited to a deprecated R3.6 software specification, which might cause the deployment to fail.
- Import a code package that contains your Shiny app files into your deployment space. For details, refer to Code packages.
- Locate the package in the Assets list.
- From the asset action menu, click Deploy.
- From the folder list, select the parent folder of your Shiny app and press the Create deployment button.
- Provide a name for the deployment.
- In the Serving name field, provide the name to be used as the alternative for the deployment ID.
- The name is validated to be unique within the namespace.
- The name must contain only these characters: [a-z,0-9,_] and must be maximum 36 characters long.
- Adjust any optional settings for the deployment and then click Create.
Optional settings for deployment
| Setting | Description |
|---|---|
| Hardware specification | Choose a hardware configuration to match your app |
| Copies | The number of copies to create if you want to increase the availability of the app. The maximum number of copies is 10. |
| Share with | Choose whether to share with: - Anyone who has the URL - Authenticated users (logged in to Cloud Pak for Data) - Collaborators in the deployment space |
Connecting your Shiny application to a persistent storage volume
You can use deployed Shiny applications to read and write files to persistent storage volumes. To connect your Shiny application to a storage volume, follow these steps:
Note: You can also do these steps in your Cloud Pak for Data project. However, connections are unable to be promoted as they contain user credentials so connections need to be re-created in a space.
-
Create a new storage volume connection.
- In your Cloud Pak for Data deployment space, click Add to space and then choose
Connection. - Search for storage volume and select Storage volume. Give your storage volume connection a name.
- In your Cloud Pak for Data deployment space, click Add to space and then choose
-
If you don't have an available storage volume, click New volume.
-
Give your new storage volume a name.
- If you have an existing persistent volume claim (PVC) or external connection that you would like to connect, select that. Otherwise, select New PVC. Complete the fields as required.
- If you do not have a storage space that is associated with your project, ask your Cloud Pak for Data admin to create one.
-
Check Cloud Pak for Data authentication.
-
Click Create.
-
If your Shiny app was already running when you were creating the volume connection, deploy your Shiny app again.
-
If your Shiny app was not running when you were creating the volume connection, save your Shiny app to the same deployment space (see previous instructions). Click Deploy.
-
Optional: By default, auto-mounting is enabled. A few settings are available for tuning with API only. See the following API POST to: Disable auto-mount:
{ "r_shiny": { "authentication": "anyone_with_url", "parameters": { "auto_mount": false } } }Set individual mounts for more security in access. Only volumes that match mount paths will be mounted:
{ "r_shiny": { "authentication": "anyone_with_url", "parameters": { "mounts": [ "/mnts/same_dir" ] } } }Provide the parameter
serving name:{ "r_shiny": { "authentication": "anyone_with_url", "parameters": { "serving_name": "myapp" } } }
For more information, refer to the Watson Machine Learning API documentation.
Accessing data with Shiny application deployment dashboard
You can use Shiny application dashbaords for a shared data connection with other users. Any data connection with personal credentials that is shared within the deployment space can be accessed by users that have access to the Shiny application.
You can use access modes in Shiny applications to modify user access to your data.
Parent topic: Deploying assets