Skip to content

Commit

Permalink
Merge pull request #128 from USEPA/multiple-shiny-instances
Browse files Browse the repository at this point in the history
Multiple shiny instances
  • Loading branch information
cristinamullin authored Nov 8, 2023
2 parents 5c74196 + b5ce9c8 commit 1ba64b3
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 11 deletions.
51 changes: 51 additions & 0 deletions .devcontainer/Shiny/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "Shiny apps for demos",
"image": "ghcr.io/rocker-org/devcontainer/geospatial:4",
"features": {
"ghcr.io/rocker-org/devcontainer-features/r-packages:1": {
"packages": "github::USEPA/TADA,config,golem,readxl,writexl,leaflet,shiny,shinyWidgets,shinyjs,shinycssloaders,DT,ggplot2,shinybusy,dplyr,plyr,tidyr,scales,forcats,RColorBrewer,lubridate,plotly",
"installSystemRequirements": true
}
},
"forwardPorts": [
37375,
37376,
37377,
37378,
37379
],
"portsAttributes": {
"37375": {
"label": "Shiny app 1",
"requireLocalPort": true,
"onAutoForward": "ignore"
},
"37376": {
"label": "Shiny app 2",
"requireLocalPort": true,
"onAutoForward": "ignore"
},
"37377": {
"label": "Shiny app 3",
"requireLocalPort": true,
"onAutoForward": "ignore"
},
"37378": {
"label": "Shiny app 4",
"requireLocalPort": true,
"onAutoForward": "ignore"
},
"37379": {
"label": "Shiny app 5",
"requireLocalPort": true,
"onAutoForward": "ignore"
}
},
"postAttachCommand": {
"run-shiny-app-1": "R -e 'shiny::runApp(port = 37375)'",
"run-shiny-app-2": "R -e 'shiny::runApp(port = 37376)'",
"run-shiny-app-3": "R -e 'shiny::runApp(port = 37377)'",
"run-shiny-app-4": "R -e 'shiny::runApp(port = 37378)'",
"run-shiny-app-5": "R -e 'shiny::runApp(port = 37379)'"
}
}
20 changes: 9 additions & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"name": "R Studio Server and Shiny app",
"secrets": {
"RSTUDIO_PASSWORD": {
"description": "Password for R Studio Server (username will be rstudio)"
}
},
"name": "R Studio Server",
"image": "ghcr.io/rocker-org/devcontainer/geospatial:4",
"features": {
"ghcr.io/rocker-org/devcontainer-features/r-packages:1": {
Expand All @@ -8,23 +13,16 @@
}
},
"forwardPorts": [
8787,
37376
8787
],
"portsAttributes": {
"8787": {
"label": "R Studio Server",
"requireLocalPort": true,
"onAutoForward": "ignore"
},
"37376": {
"label": "Shiny app",
"requireLocalPort": true,
"onAutoForward": "ignore"
}
},
"postAttachCommand": {
"rstudio-start": "sudo rstudio-server start",
"run-shiny-app": "R -e 'shiny::runApp(port = 37376)'"
"rstudio-start": "if [[ ! -z \"$RSTUDIO_PASSWORD\" ]]; then echo \"rstudio:$RSTUDIO_PASSWORD\" | sudo chpasswd; fi && sudo rstudio-server start"
}
}
}
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ remotes::install_github("USEPA/TADAShiny", ref = "develop", dependencies = TRUE)
TADAShiny::run_app()
```

### Run in GitHub Codespaces
This repository also has devcontainers to allow it to run in GitHub codespaces. To use those:
- Fork the repository to your account
- In the "Code" button on the upper right of your browser, within the Codespaces tab click on the three dots and choose "New with Options", then you will have the choices:
- R Studio Server (the default useful for coding; you should set the RSTUDIO_PASSWORD with this option)
- Shiny apps for demos (useful for training or demoing)
- To stop or delete your codespace when you are done: go to [GitHub Codespaces](https://github.com/codespaces)

## R Shiny Learning Resources

Please visit the North American Lake Management Society (NALMS) Shiny Apps site to access other R Shiny applications that you may find useful (https://nalms.shinyapps.io/NALMS_Shiny_Home/), and for information on how to develop R Shiny Applications (https://nalms.shinyapps.io/Shiny_for_Water_Resources/).
Expand Down

0 comments on commit 1ba64b3

Please sign in to comment.