File tree Expand file tree Collapse file tree 3 files changed +27
-56
lines changed
Expand file tree Collapse file tree 3 files changed +27
-56
lines changed Original file line number Diff line number Diff line change 33{
44 "name" : " RStudio with Quarto" ,
55 "image" : " ghcr.io/rocker-org/devcontainer/tidyverse:4.4" ,
6+ "runArgs" : [ " --security-opt" , " seccomp=unconfined" ],
67 "waitFor" : " onCreateCommand" ,
78
89 "features" : {
2526 "extensions" : [
2627 " REditorSupport.r" ,
2728 " rdebugger.r-debugger" ,
28- " quarto.quarto" ,
29- " ms-toolsai.jupyter" ,
30- " ms-python.python"
29+ " quarto.quarto"
3130 ]
3231 }
3332 },
3736 "8787" : {
3837 "label" : " RStudio" ,
3938 "requireLocalPort" : true ,
40- "onAutoForward" : " openBrowser "
39+ "onAutoForward" : " ignore "
4140 }
4241 },
4342
44- "onCreateCommand" : " bash .devcontainer/setup.sh " ,
45- "postAttachCommand " : " bash .devcontainer/welcome .sh" ,
46-
43+ // Use 'postCreateCommand' to run commands after the container is created.
44+ "postCreateCommand " : " bash .devcontainer/setup .sh" ,
45+ "postAttachCommand" : " sudo rstudio-server start &> /dev/null && bash .devcontainer/welcome.sh " ,
4746 "remoteUser" : " rstudio"
4847}
Original file line number Diff line number Diff line change 1- # Source: Adapted from https://github.com/boettiger-lab/nasa-topst-env-justice (MIT)
1+ # Source: https://github.com/boettiger-lab/nasa-topst-env-justice (MIT)
2+ # Comments from https://github.com/AnushaPB/codespacer
23
3- #! /usr/bin/env bash
4- set -euo pipefail
4+ # Copies a configuration file to disable authentication on RStudio Server,
5+ # making it accessible without needing to log in.
6+ sudo cp /etc/rstudio/disable_auth_rserver.conf /etc/rstudio/rserver.conf
57
6- # Ensure RStudio runs without password inside Codespace
7- if [ -f /etc/rstudio/disable_auth_rserver.conf ]; then
8- sudo cp /etc/rstudio/disable_auth_rserver.conf /etc/rstudio/rserver.conf
9- fi
8+ # Adds "USER=rstudio" to the end of the /etc/environment file,
9+ # setting a system-wide environment variable to specify the default user for RStudio.
10+ sudo sudo bash -c ' echo "USER=rstudio" >>/etc/environment'
1011
11- # Make sure USER is rstudio so RStudio knows who to log in
12- sudo bash -c ' echo "USER=rstudio" >> /etc/environment'
13-
14- # Start RStudio Server in the background if not running
15- if ! pgrep -x " rserver" > /dev/null 2>&1 ; then
16- sudo rstudio-server start
17- fi
18-
19- # Minimal R packages you might want – optional
20- Rscript -e ' install.packages(c("quarto"), repos = "https://cloud.r-project.org")' || true
12+ # Start the RStudio Server in the background
13+ sudo /init & > /dev/null &
Original file line number Diff line number Diff line change 11# Source: Adapted from https://github.com/boettiger-lab/nasa-topst-env-justice (MIT)
22
3- #! /usr/bin/env bash
4- set -euo pipefail
5-
6- # Ensure RStudio is running (idempotent)
7- if ! pgrep -x " rserver" > /dev/null 2>&1 ; then
8- sudo rstudio-server start
9- fi
10-
11- cat << 'EOF '
12- ========================================
13- Welcome to this R + Quarto Codespace
14- ========================================
15-
16- RStudio Server is available at:
17-
18- http://127.0.0.1:8787
19-
20- In GitHub Codespaces:
21-
22- - Open the "Ports" panel.
23- - Find the "RStudio (8787)" port.
24- - If it is not already open, choose "Open in browser".
25-
26- Once RStudio is open, you can:
27- - Open a .qmd file
28- - Use the "Render" button or run:
29-
30- quarto::quarto_preview()
31-
32- to preview your document.
33- ========================================
34- EOF
3+ # Construct the message
4+ message=" ## [Open in RStudio](https://$CODESPACE_NAME -8787.app.github.dev)
5+ "
6+ # Echo the message to the terminal
7+ echo "
8+ 👋 Welcome to Codespaces! You are on our custom image.
9+ - It includes runtimes and tools for R using RStudio
10+
11+ 🌐 Open the RStudio editor here: https://$CODESPACE_NAME -8787.app.github.dev
12+ - (This may take a few seconds to load, retry if necessary)
13+ "
You can’t perform that action at this time.
0 commit comments