domino logo
Tech Ecosystem
Get started with Python
Step 0: Orient yourself to DominoStep 1: Create a projectStep 2: Configure your projectStep 3: Start a workspaceStep 4: Get your files and dataStep 5: Develop your modelStep 6: Clean up WorkspacesStep 7: Deploy your model
Get started with R
Step 0: Orient yourself to Domino (R Tutorial)Step 1: Create a projectStep 2: Configure your projectStep 3: Start a workspaceStep 4: Get your files and dataStep 5: Develop your modelStep 6: Clean up WorkspacesStep 7: Deploy your model
Domino Reference
Projects
Projects Overview
Revert Projects and Files
Revert a ProjectRevert a File
Projects PortfolioProject Goals in Domino 4+Upload Files to Domino using your BrowserFork and Merge ProjectsSearchSharing and CollaborationCommentsDomino Service FilesystemCompare File RevisionsArchive a Project
Advanced Project Settings
Project DependenciesProject TagsRename a ProjectSet up your Project to Ignore FilesUpload files larger than 550MBExporting Files as a Python or R PackageTransfer Project Ownership
Domino Runs
JobsDiagnostic Statistics with dominostats.jsonNotificationsResultsRun Comparison
Advanced Options for Domino Runs
Run StatesDomino Environment VariablesEnvironment Variables for Secure Credential StorageUse Apache Airflow with Domino
Scheduled Jobs
Domino Workspaces
WorkspacesUse Visual Studio Code in Domino WorkspacesPersist RStudio PreferencesAccess Multiple Hosted Applications in one Workspace SessionUse Domino Workspaces in Safari
Spark on Domino
On-Demand Spark
On-Demand Spark OverviewValidated Spark VersionConfigure PrerequisitesWork with your ClusterManage DependenciesWork with Data
External Hadoop and Spark
Hadoop and Spark OverviewConnect to a Cloudera CDH5 cluster from DominoConnect to a Hortonworks cluster from DominoConnect to a MapR cluster from DominoConnect to an Amazon EMR cluster from DominoRun Local Spark on a Domino ExecutorUse PySpark in Jupyter WorkspacesKerberos Authentication
Customize the Domino Software Environment
Environment ManagementDomino Standard EnvironmentsInstall Packages and DependenciesAdd Workspace IDEs
Advanced Options for Domino Software Environment
Install Custom Packages in Domino with Git IntegrationAdd Custom DNS Servers to Your Domino EnvironmentConfigure a Compute Environment to User Private Cran/Conda/PyPi MirrorsScala notebooksUse TensorBoard in Jupyter WorkspacesUse MATLAB as a WorkspaceCreate a SAS Data Science Workspace Environment
Publish your Work
Publish a Model API
Model Publishing OverviewModel Invocation SettingsModel Access and CollaborationModel Deployment ConfigurationPromote Projects to ProductionExport Model Image
Publish a Web Application
Cross-Origin Security in Domino web appsApp Publishing OverviewGet Started with DashGet Started with ShinyGet Started with Flask
Advanced Web Application Settings in Domino
App Scaling and PerformanceHost HTML Pages from DominoHow to Get the Domino Username of an App Viewer
Launchers
Launchers OverviewAdvanced Launcher Editor
Assets Portfolio Overview
Connect to your Data
Domino Datasets
Datasets OverviewDatasets Best PracticesAbout domino.yamlDatasets Advanced Mode TutorialDatasets Scratch SpacesConvert Legacy Data Sets to Domino Datasets
Data Sources OverviewConnect to Data Sources
Git and Domino
Git Repositories in DominoWork From a Commit ID in Git
Work with Data Best Practices
Work with Big Data in DominoWork with Lots of FilesMove Data Over a Network
Advanced User Configuration Settings
User API KeysOrganizations Overview
Use the Domino Command Line Interface (CLI)
Install the Domino Command Line (CLI)Domino CLI ReferenceDownload Files with the CLIForce-Restore a Local ProjectMove a Project Between Domino DeploymentsUse the Domino CLI Behind a Proxy
Browser Support
Get Help with Domino
Additional ResourcesGet Domino VersionContact Domino Technical SupportSupport Bundles
domino logo
About Domino
Domino Data LabKnowledge BaseData Science BlogTraining
User Guide
>
Domino Reference
>
Publish your Work
>
Publish a Web Application
>
Get Started with Shiny

Get Started with Shiny

This topic will show you how to publish an R App with Shiny in Domino,

In this tutorial you will:

  • Create a project and set it up for App publishing

  • Publish a simple two file Shiny App to the Domino Launchpad

  • Observe how other users in Domino can use the App

You’ll be working with the Telephones by region example from the Shiny gallery. In this example, the application serves an interactive bar chart of consumer telephones by region from 1951 to 1961.

It will take approximately 10 minutes to get this example running in Domino.

Set up project

The first step is creating a project with the settings and content you need to publish your App.

  1. From the Lab, click Projects.

  2. Click New Project.

  3. Give your project an informative name, choose the Private visibility setting, then click Create Project.

  4. Click Settings in the project sidebar, then set the Compute environment to Domino Analytics Distribution Py3.6 R3.4. Read Domino standard environments, to learn more about the contents of this base image.

    screen shot 2018 08 29 at 7.32.03 PM

  5. Click Files in the project sidebar, then click Add File.

  6. Name the file server.R in the title field above the editor. It’s important that the file be named exactly this, as launching a two file Shiny application requires a directory to contain files named server.R and ui.R.

  7. In the body of the file, paste the following example Shiny server code.

    # Rely on the 'WorldPhones' dataset in the datasets
    # package (which generally comes preloaded).
    library(datasets)
    
    # Define a server for the Shiny app
    function(input, output) {
    
     # Fill in the spot we created for a plot
     output$phonePlot <- renderPlot({
    
     # Render a barplot
     barplot(WorldPhones[,input$region]*1000,
     main=input$region,
     ylab="Number of Telephones",
     xlab="Year")
     })
    }
  8. Click Save when finished.

  9. Click Add File again, and name the new file ui.R.

  10. Paste in the following content, then click Save when finished.

    # Rely on the 'WorldPhones' dataset in the datasets
    # package (which generally comes preloaded).
    library(datasets)
    
    # Use a fluid Bootstrap layout
    fluidPage(
    
      # Give the page a title
      titlePanel("Telephones by region"),
    
      # Generate a row with a sidebar
      sidebarLayout(
    
        # Define the sidebar with one input
        sidebarPanel(
          selectInput("region", "Region:",
                      choices=colnames(WorldPhones)),
          hr(),
          helpText("Data from AT&T (1961) The World's Telephones.")
        ),
    
        # Create a spot for the barplot
        mainPanel(
          plotOutput("phonePlot")
        )
    
      )
    )
  11. The last thing to do before publishing your App is to create an app.sh file. This is a Bash script that Domino runs after initializing the host that will serve your App. It should contain all commands required to launch your App. In this example, the only command you need is:

    R -e 'shiny::runApp("./", port=8888, host="0.0.0.0")'

    Make note of two important parameters in this command. Apps in Domino must run with a host of 0.0.0.0 on port 8888. This is where Domino will direct users to your application. Create the app.sh file the same way you did for server.R and ui.R, then save it.

Publish an app

  1. Click Publish from the project sidebar.

  2. Give your App an informative title and description, and set Permissions to Anyone can access. This will allow anyone with a network connection to your Domino deployment to access the App if they have the URL.

    screen shot 2018 08 30 at 8.55.16 AM

  3. Click Publish.

  4. After the App status says Running, click View App to load your App. You should see the interactive bar chart with a Domino toolbar above it showing the project it’s published from, plus buttons to email the App owner and open the description panel.

    screen shot 2018 08 29 at 6.16.32 PM

Share and consume

Now that your App is published, if you set the permissions to Anyone can access, you can now easily share it with colleagues who have access to your instance of Domino. You can try this out yourself by opening a private or incognito browser, or logging out of Domino, and navigating to the App URL.

Domino Data LabKnowledge BaseData Science BlogTraining
Copyright © 2022 Domino Data Lab. All rights reserved.