generated from posit-conf-2023/workshop-template
-
Notifications
You must be signed in to change notification settings - Fork 12
/
setup.qmd
92 lines (58 loc) · 7.76 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
---
title: "Setup"
format:
html:
link-external-newwindow: true
---
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](https://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](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.
* Posit Cloud account: Visit [posit.cloud](https://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](https://github.com/posit-conf-2023/shiny-r-prod/archive/refs/heads/main.zip).
## 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.
:::{.callout-tip collapse="true"}
## Posit Connect
[View screenshots in full screen](materials/setup-resources/index.html#/rcreate-posit-connect-account)
```{=html}
<iframe class="slide-deck" src="materials/setup-resources/#/create-posit-connect-account" height="420" width="747" style="border: 1px solid #2e3846;"></iframe>
```
1. Create an account on the workshop Posit 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 Posit Connect to your GitHub account.
1. 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](https://docs.posit.co/connect/user/api-keys/). Save it to a secure place as you will need it for account integration.
:::
:::{.callout-tip collapse="true"}
## Posit Cloud
[View screenshots in full screen](materials/setup-resources/index.html#/posit-cloud-setup)
```{=html}
<iframe class="slide-deck" src="materials/setup-resources/#/posit-cloud-setup" height="420" width="747" style="border: 1px solid #2e3846;"></iframe>
```
1. Join the Posit Cloud Workspace dedicated to this workshop by visiting this [customized invitation URL]({{< var posit_cloud_workspace_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.
1. 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.
1. 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.
:::
:::{.callout-tip collapse="true"}
## Local R & RStudio IDE
If you prefer to use a local installation of R and RStudio, ensure you setup meets the following requirements:
* [R](https://www.r-project.org/) version 4.3 or later.
* Latest release of RStudio IDE, [`2023.06.1-524` or later](https://posit.co/download/rstudio-desktop/)
* The [`{renv}`](https://rstudio.github.io/renv/articles/renv.html) R package.
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](https://github.com/posit-conf-2023/shiny-r-prod/archive/refs/heads/main.zip).
1. Launch RStudio and open the project file `shiny-r-prod.Rproj` to initialize the workshop project.
1. The `{renv}` package will begin bootstrapping the package library. When prompted, run `renv::restore()` to complete the package installation process.
:::
:::{.callout-tip collapse="true"}
## Docker Container with Visual Studio Code & RStudio
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](https://github.com/posit-conf-2023/shiny-r-prod/archive/refs/heads/main.zip).
1. 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.
1. Launch Visual Studio Code and open the folder of your local copy of the workshop repository.
1. 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.
1. 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 .
:::