An interactive data visualization built using RStudio's Shiny open source R package.
It is used in the Environmental Reporting BC indicator: Land Designations That Contribute to Conservation.
This is built to be deployed in a Docker image to be run in Openshift, and based on the template here.
You will need to Install Docker. Instructions for installing docker on your local OS are provided here.
Note that this repository is set up with a webhook that will trigger a build on OpenShift when code is pushed to the deploy branch, so only merge into that branch when you are ready to start a new build and update the dev site. See the Openshift Instructions here.
The app is running on OpenShift, and embedded in the indicator website.
The Shiny app and all related resources are in the app
folder. If you have R
installed on your machine, you can open an R session in this directory, and
type shiny::runApp("app")
to start the app.
The data is generated by R scripts in a different repository and copied into the app/data
directory in this repository.
All necessary R packages must be listed in packages.txt
so they can be
installed on the Docker image. It's not necessary to list 'shiny' or 'rmarkdown' packages
here as they are installed automatically.
The R package ggiraph requires the xml2 package, which depends on libxml2-dev
being installed on the system. This is listed in system-libraries.txt
.
To build the Docker image and run the app, in your terminal (on Windows use the Docker Quickstart Terminal) type:
./dev.sh
This command will build a local Dockerfile and run it for you. All of your code will be added to the container and run. Especially important is that new directories
will appear in the root of your project under the _mount
directory:
- _mount/bookmarks : This is where shiny will write its bookmarks
- _mount/logs : Pretty much what you might expect
- _mount/output : In your program, if you write to '/srv/shiny-server-output' it will show up here
- _mount/tmp : The /tmp directory if you need to debug the temporary files created by shiny
Note: If you are on Windows and using Docker with VirtualBox, it unfortunately won't be able to mount the logs and bookmarks folders locally, but it will build and lanch the app.
To report bugs/issues/feature requests, please file an issue.
If you would like to contribute, please see our CONTRIBUTING guidelines.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Copyright 2016 Province of British Columbia
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This repository is maintained by Environmental Reporting BC. Click here for a complete list of our repositories on GitHub.