-
Notifications
You must be signed in to change notification settings - Fork 23
/
setup.qmd
100 lines (63 loc) · 6.14 KB
/
setup.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
---
title: "Setup"
format:
html:
link-external-newwindow: true
---
We are excited to have you join us for our two-day workshop **Building Production-Quality Shiny Applications**! 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. RStudio has generously provided us access to a dedicated workshop coding environment using [RStudio Cloud](https://rstudio.cloud), which is accessible with a modern web browser such as Google Chrome, Microsoft Edge, Firefox, or others. In addition, RStudio is also providing a dedicated instance of the **RStudio 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](https://happygitwithr.com/github-acct.html#github-acct) chapter of Jenny Bryan's [Happy Git and GitHub for the UseR](https://happygitwithr.com/index.html). 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](https://happygitwithr.com/index.html) online book.
* RStudio Cloud account: Visit [rstudio.cloud](https://rstudio.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 this repository on your local laptop as a backup.
## Environment Configuration
Please view the information in the callouts below for step-by-step instructions on configuring your accounts and environments. While RStudio Cloud is the preferred development environment, you may utilize your local installation of R and RStudio if you prefer.
:::{.callout-tip collapse="true"}
## RStudio Connect
[View screenshots in full screen](materials/setup-resources/index.html#/rcreate-rstudio-connect-account)
```{=html}
<iframe class="slide-deck" src="materials/setup-resources/#/create-rstudio-connect-account" height="420" width="747" style="border: 1px solid #2e3846;"></iframe>
```
1. Create an account on the workshop RStudio Connect server by visiting [{{< var rsconnect_url >}}]({{< var rsconnect_url >}}) and clicking the **login** link in the upper right corner.
1. 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 RStudio Connect to your GitHub account.
1. You should now be logged in to RStudio Connect. Please create an API key for your account by following the RStudio Connect User Guide instructions on [creasting an API key](https://docs.rstudio.com/connect/user/api-keys/). Save it to a secure place as you will need it for account integration.
:::
:::{.callout-tip collapse="true"}
## RStudio Cloud
[View screenshots in full screen](materials/setup-resources/index.html#/rstudio-cloud-setup)
```{=html}
<iframe class="slide-deck" src="materials/setup-resources/#/rstudio-cloud-setup" height="420" width="747" style="border: 1px solid #2e3846;"></iframe>
```
1. Join the RStudio Cloud Workspace dedicated to this workshop by visiting this [customized invitation URL]({{< var rstudio_cloud_workspace_url >}}). If you already have an RStudio Cloud account, you are welcome to use it for the workshop. Otherwise, you can create a new account for free.
1. You will see a project called *shiny-prod-apps*. Open that project and create a saved copy. This process could take a couple of minutes depending on server load.
1. After the project loads, you will see messages in the R console about restoring or repairing the package library. Execute `renv::restore(prompt = FALSE)` to install packages into the project. This process should complete in one or two minutes.
:::
:::{.callout-caution collapse="true"}
## Local R & RStudio
If you prefer to use a local installation of R and RStudio, ensure you setup meets the following requirements:
* R version 4.1 or later
* Latest released version of RStudio, [`v2022.07.0-548` or later](https://www.rstudio.com/products/rstudio/download/#download)
* The [`{renv}`](https://rstudio.github.io/renv/articles/renv.html) package.
:::
:::{.callout-tip collapse="true"}
## Account Integration
[View screenshots in full screen](materials/setup-resources/index.html#/account-integrations)
```{=html}
<iframe class="slide-deck" src="materials/setup-resources/#/account-integrations" height="420" width="747" style="border: 1px solid #2e3846;"></iframe>
```
1. Navigate back to your RStudio Project created earlier. Create a new file called `.Renviron` withing your project directory by running the following in the R Console: `usethis::edit_r_environ(scope = "project"`)
1. Inside the `.Renviron` file, add the RStudio Connect URL and your account API key using the following format (substitute values as appropriate)
```
CONNECT_SERVER={{< var rsconnect_url >}}
CONNECT_API_KEY=abcdefghijklmnopqrstuvwxyz
```
1. Link your RStudio Connect account to RStudio by going to `Tools -> Global Options -> Publishing` and click **Connect** to follow the prompts.
1. Restart your R session by going to `Session -> Restart R` inside RStudio. Verify that your environment variables were successfully registered by printing them into your R console with the following commands:
```r
Sys.getenv("CONNECT_SERVER")
Sys.getenv("CONNECT_API_KEY")
```
:::