Skip to content

Commit

Permalink
fix files that fail to load in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyhanson committed Aug 6, 2021
1 parent ebbf662 commit eb1db63
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 62 deletions.
3 changes: 0 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# change this variable to import projects from a different location
PROJECT_DIRECTORY=./inst/extdata/projects

# change this variable to save application logs to a different location
LOG_DIRECTORY=./logs

# change this variable to specify a different application mode
# available options are: "project", "beginner", "advanced"
R_CONFIG_ACTIVE=project
Expand Down
18 changes: 16 additions & 2 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,22 @@ app_ui <- function(request) {
# app content
shiny::fillPage(

## manually insert shinyBS JS code
htmltools::tags$script(src = "www/shinyBS-copy.js"),
## suppress dependencies that fail to import correctly
htmltools::suppressDependencies("shinyBS"),
htmltools::suppressDependencies("bootstrap-select"),

## manually insert code dependencies so they import correctly
htmltools::tags$head(
### shinyBS just doesn't work inside Docker containers
htmltools::tags$script(src = "www/shinyBS-copy.js"),
### shinyWidgets has invalid SourceMap configuration
htmltools::tags$script(src = "www/bootstrap-select-copy.min.js"),
htmltools::tags$link(
rel = "stylesheet",
type = "text/css",
href = "www/bootstrap-select-copy.min.css"
)
),

## start up screen
shinybusy::busy_start_up(
Expand Down
38 changes: 26 additions & 12 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,30 @@ The _Where to Work_ application is a decision support tool to help prioritize co

## Usage

The application is [available online](https://ncc.carleton.ca//wheretowork). **Please note that you must use [Google Chrome](https://www.google.com/chrome/) for it to work.**.
The application is [available online](TODO). **Please note that you must use [Google Chrome](https://www.google.com/chrome/) for it to work.**.

## Installation

The application is available as an online service provided by the [Nature Conservancy of Canada](https://natureconservancy.ca/en/). As such, you don't need to install it on your computer to use: just go to [this link and it's ready to go](https://natureconservancy.ca/en/). If you need to run the application on your own computer, then you can run it using [Docker](https://www.docker.com/) or the [R statistical computing environment](https://www.r-project.org/).
The application is available as an online service provided by the [Nature Conservancy of Canada](https://natureconservancy.ca/en/). If you need to run the application on your own computer, then you can run it using the [R statistical computing environment](https://www.r-project.org/), [Docker](https://www.docker.com/), or [Docker Compose](https://docs.docker.com/compose/).

### Using R

To use this method, you will need to install the [R statistical computing environment](https://www.r-project.org/). After completing the installation, you can install the application using the following R code:

```{r, eval = FALSE}
if (!require(remotes)) install.packages("remotes")
remotes::install_github("NCC-CNC/wheretowork")
```

You can then use the following R code to start the application and open it in your web browser:

```{r, eval = FALSE}
wheretowork::run_app()
```

### Using Docker

To run the application using this method, you will need to install the [Docker Engine](https://www.docker.com/) software ([see here for instructions](https://docs.docker.com/get-docker/)). After completing this step, you can install the application from the [DockerHub repository](https://hub.docker.com/repository/docker/naturecons/wheretowork). Specifically, please use the following system command:
To use this method, you will need to install [Docker Engine](https://www.docker.com/) ([see here for instructions](https://docs.docker.com/get-docker/)). After completing this step, you can install the application from the [DockerHub repository](https://hub.docker.com/repository/docker/naturecons/wheretowork). Specifically, please use the following system command:

```{bash, eval = FALSE}
docker run -dp 3838:3838 --name wheretowork -it naturecons/wheretowork:latest
Expand All @@ -45,24 +60,23 @@ You can then view the application by opening the following link in [Google Chrom
docker rm -f wheretowork
```

### Using R
### Using Docker Compose

To run the application using this method, you will need to install the [R statistical computing environment](https://www.r-project.org/). After completing the installation, you can install the application using the following R code:
To use this method, you will need to install [Docker Engine](https://www.docker.com/) ([see here for instructions](https://docs.docker.com/get-docker/)) and Docker Compose ([see here for instructions](https://docs.docker.com/compose/install/)). After installing both programs, you can install the application by [cloning this repository](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository-from-github/cloning-a-repository) and then using the following system command:

```{r, eval = FALSE}
if (!require(remotes)) install.packages("remotes")
remotes::install_github("NCC-CNC/wheretowork")
```{bash, eval = FALSE}
docker-compose up --build
```

You can then use the following R code to start the application and open it in your web browser:
You can then view the application by opening the following link in [Google Chrome](https://www.google.com/chrome/): http://localhost:3838. After you have finished using the application, you can terminate it using the following system command. **Note that if you don't terminate the application once you are finished using it, then it will continue running in the background.**

```{r, eval = FALSE}
wheretowork::run_app()
```{bash, eval = FALSE}
docker-compose down
```

## Contributing

The application is a [Shiny web application](https://mastering-shiny.org/) developed using the [R statistical computing environment](https://www.r-project.org/). Specifically, it uses the [`golem` framework](https://thinkr-open.github.io/golem/). This means that the application is effectively an [R package](https://r-pkgs.org/) that contains code for defining and launching the application (see [here](https://engineering-shiny.org/) for more details). The R code files (located in the `./R` directory) are organized the following system of naming conventions:
The application is a [Shiny web application](https://mastering-shiny.org/) developed using the [R statistical computing environment](https://www.r-project.org/). Specifically, it uses the [`golem` framework](https://thinkr-open.github.io/golem/). This means that the application is effectively an [R package](https://r-pkgs.org/) that contains code for defining and launching the application ([see here for more details](https://engineering-shiny.org/)). The R code files (located in the `./R` directory) are organized using the following naming conventions:

* `app_*`: Defines the web application:
* `app_config.R`: Imports configuration settings.
Expand Down
80 changes: 52 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,42 @@ Canada](https://natureconservancy.ca/en/).

## Usage

The application is [available
online](https://ncc.carleton.ca//wheretowork). **Please note that you
must use [Google Chrome](https://www.google.com/chrome/) for it to
work.**.
The application is [available online](TODO). **Please note that you must
use [Google Chrome](https://www.google.com/chrome/) for it to work.**.

## Installation

The application is available as an online service provided by the
[Nature Conservancy of Canada](https://natureconservancy.ca/en/). As
such, you don’t need to install it on your computer to use: just go to
[this link and it’s ready to go](https://natureconservancy.ca/en/). If
you need to run the application on your own computer, then you can run
it using [Docker](https://www.docker.com/) or the [R statistical
computing environment](https://www.r-project.org/).
[Nature Conservancy of Canada](https://natureconservancy.ca/en/). If you
need to run the application on your own computer, then you can run it
using the [R statistical computing
environment](https://www.r-project.org/),
[Docker](https://www.docker.com/), or [Docker
Compose](https://docs.docker.com/compose/).

### Using R

To use this method, you will need to install the [R statistical
computing environment](https://www.r-project.org/). After completing the
installation, you can install the application using the following R
code:

``` r
if (!require(remotes)) install.packages("remotes")
remotes::install_github("NCC-CNC/wheretowork")
```

You can then use the following R code to start the application and open
it in your web browser:

``` r
wheretowork::run_app()
```

### Using Docker

To run the application using this method, you will need to install the
[Docker Engine](https://www.docker.com/) software ([see here for
To use this method, you will need to install [Docker
Engine](https://www.docker.com/) ([see here for
instructions](https://docs.docker.com/get-docker/)). After completing
this step, you can install the application from the [DockerHub
repository](https://hub.docker.com/repository/docker/naturecons/wheretowork).
Expand All @@ -52,23 +69,30 @@ it will continue running in the background.**
docker rm -f wheretowork
```

### Using R
### Using Docker Compose

To run the application using this method, you will need to install the
[R statistical computing environment](https://www.r-project.org/). After
completing the installation, you can install the application using the
following R code:
To use this method, you will need to install [Docker
Engine](https://www.docker.com/) ([see here for
instructions](https://docs.docker.com/get-docker/)) and Docker Compose
([see here for instructions](https://docs.docker.com/compose/install/)).
After installing both programs, you can install the application by
[cloning this
repository](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository-from-github/cloning-a-repository)
and then using the following system command:

``` r
if (!require(remotes)) install.packages("remotes")
remotes::install_github("NCC-CNC/wheretowork")
``` bash
docker-compose up --build
```

You can then use the following R code to start the application and open
it in your web browser:
You can then view the application by opening the following link in
[Google Chrome](https://www.google.com/chrome/):
<http://localhost:3838>. After you have finished using the application,
you can terminate it using the following system command. **Note that if
you don’t terminate the application once you are finished using it, then
it will continue running in the background.**

``` r
wheretowork::run_app()
``` bash
docker-compose down
```

## Contributing
Expand All @@ -79,10 +103,10 @@ statistical computing environment](https://www.r-project.org/).
Specifically, it uses the [`golem`
framework](https://thinkr-open.github.io/golem/). This means that the
application is effectively an [R package](https://r-pkgs.org/) that
contains code for defining and launching the application (see
[here](https://engineering-shiny.org/) for more details). The R code
files (located in the `./R` directory) are organized the following
system of naming conventions:
contains code for defining and launching the application ([see here for
more details](https://engineering-shiny.org/)). The R code files
(located in the `./R` directory) are organized using the following
naming conventions:

- `app_*`: Defines the web application:
- `app_config.R`: Imports configuration settings.
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ services:
# environmental variables defined in ./.env
- FORCE_DEFAULT_PROJECTS
- PROJECT_DIRECTORY
- LOG_DIRECTORY
- R_CONFIG_ACTIVE
volumes:
- "${PROJECT_DIRECTORY}:/projects"
- "${LOG_DIRECTORY}:/var/log/shiny-server/"
Loading

0 comments on commit eb1db63

Please sign in to comment.