Setup

We are excited to have you join us for our workshop Shiny in Production: Tools and Techniques! The format of the workshop will be a mix of presentation slides, example Shiny applications, and hands-on exercises. To ensure you are ready for the journey, please review the following instructions.

Pre-Work

This workshop will be a blend of teaching materials, live-coding demonstrations, and hands-on exercises to practice key concepts. Posit has generously provided us access to a dedicated workshop coding environment using Posit Cloud, which is accessible with a modern web browser such as Google Chrome, Microsoft Edge, Firefox, or others. In addition, Posit is also providing a dedicated instance of the Posit Connect platform for hosting Shiny applications that you create and view throughout the workshop.

In the first session of the workshop, we will allocate time for everyone to configure their accounts and development environments. If you would like to complete these steps before the workshop, you can follow the procedures detailed in Environment Configuration below.

Accounts

  • GitHub account: You can create a GitHub account for free using the instructions provided in the Register for GitHub chapter of Jenny Bryan’s Happy Git and GitHub for the UseR. If you already have an account, you are welcome to use it for the workshop. While version control itself is not a major focus of the course, we will discuss how certain elements can play an important role in application development and deployment. A great resource for getting a basic familiarity with Git version control is Jenny Bryan’s Happy Git and GitHub for the useR online book.
  • Posit Cloud account: Visit posit.cloud and click the Sign Up link. Then create a Free account. If you already have an account, you do not need to create a new one.

Local Clone of Repository

If we encounter any technical issues with the cloud-based environments, it is a good idea to have a clone of the workshop repository on your local laptop as a backup. If you already have Git installed, you can clone the repository from https://github.com/posit-conf-2023/shiny-r-prod, or without Git you can download the repository using this link.

Environment Configuration

Please view the information in the callouts below for step-by-step instructions on configuring your accounts and environments. While Posit Cloud is the preferred development environment, you may utilize your local installation of R with your preferred integrated development environment such as RStudio, Visual Studio Code, or even vim/emacs if you prefer.

View screenshots in full screen

  1. Create an account on the workshop Posit Connect server by visiting https://rsc.training.rstudio.com and clicking the login link in the upper right corner.
  2. You will see a window that asks for either an email/password or to use a GitHub account. Please choose the GitHub option and follow the instructions to authorize Posit Connect to your GitHub account.
  3. You should now be logged in to Posit Connect. Please create an API key for your account by following the Posit Connect User Guide instructions on creating an API key. Save it to a secure place as you will need it for account integration.

View screenshots in full screen

  1. Join the Posit Cloud Workspace dedicated to this workshop by visiting this customized invitation URL. If you already have a Posit Cloud account, you are welcome to use it for the workshop. Otherwise, you can create a new account for free.
  2. You will see multiple projects that have been labelled as Assignments to you after joining the Workspace. Open the assignment labelled Workshop Materials. This process could take a couple of minutes depending on server load.
  3. After the project loads, you will possible see messages in the R console about restoring or repairing the package library. To check, run renv::status() and if it says you are missing required packages, execute renv::restore(prompt = FALSE) to install packages into the project. This process should complete in one or two minutes.

If you prefer to use a local installation of R and RStudio, ensure you setup meets the following requirements:

You can workshop materials using the following procedure:

  1. Visit the workshop repository at https://github.com/posit-conf-2023/shiny-r-prod and either clone to your local machine with Git or download a zip archive of the materials. A direct link to the archive is here.
  2. Launch RStudio and open the project file shiny-r-prod.Rproj to initialize the workshop project.
  3. The {renv} package will begin bootstrapping the package library. When prompted, run renv::restore() to complete the package installation process.

The repository for this workshop also gives you the ability to create custom Docker containers to encapsulate a complete R development environment tailored to this workshop. This workshop repository uses a similar container definition as found at https://github.com/rpodcast/r_dev_projects. At a high level, you will need an installation of Visual Studio Code with the Remote Development extension.

  1. Visit the workshop repository at https://github.com/posit-conf-2023/shiny-r-prod and either clone to your local machine with Git or download a zip archive of the materials. A direct link to the archive is here.
  2. Within the .devcontainer subdirectory, create a new file called .env based on the template provided at .env.example. In this file, change the value of the environment variable RENV_PATHS_CACHE_HOST to the deisred directory on your system.
  3. Launch Visual Studio Code and open the folder of your local copy of the workshop repository.
  4. You will be prompted to re-open the folder to begin the container build process. Note that this process can take a few minutes depending on your computer’s hardware specifications and network bandwidth.
  5. Once the development container is built, you are free to continue using Visual Studio Code or use a container version of the RStudio open source server by visiting localhost:4567 in your web browser.
  • If using visual studio code, the user needs to add the renv library path to their r.libPaths setting in the R extension. Details at https://github.com/REditorSupport/vscode-R/wiki/Working-with-renv-enabled-projects .