---
title: "Using Rstudio and Shiny"
output:
  BiocStyle::html_document:
    toc: true
    toc_depth: 4
    number_sections: false
    highlight: haddock
    css: style.css
---

<!--
%\VignetteIndexEntry{Using Rstudio and Shiny}
%\VignettePackage{sevenbridges}
%\VignetteEngine{knitr::rmarkdown}
-->



## Introduction

The goal of this `tengfei/sevenbridges` docker image is to provide

- SDK environment that includes
    - Command line uploader
    - Seven Bridgs Command line tools
    - sevenbridges R package
- Rstudio: you can launch the server
- Shiny: you can launch shiny server 

For professional version of Rstudio server and Shiny server please contact Rstudio. 

## Docker container

### Dockerfile

The Dockerfile is included with the package in `inst/docker` folder. 

Here is the current content of Dockerfile
```{r comment=''}
fl <- system.file("docker/sevenbridges/", "Dockerfile", package = "sevenbridges")
cat(readLines(fl), sep = '\n')
```

### Docker hub autobuild

A hook is added to build the docker image automatically from my [github](https://github.com/tengfei/sevenbridges), it's under `inst/docker`, it's automatically build on my dockerhub [page](https://hub.docker.com/r/tengfei/sevenbridges/). you can directly use this `tengfei/sevenbridges`

### Launch Rstudio server from docker

For example, you can ssh into your AWS instance, here I suppose you already have docker installed,  and pull the image 

```
docker pull tengfei/sevenbridges
```

To launch sevenbridges Rstudio server image, I recommend you read this [tutorial](https://github.com/rocker-org/rocker/wiki/Using-the-RStudio-image)

Or following the quick instruction here

```
docker run -d -p 8787:8787 tengfei/sevenbridges
docker run -d -p 8787:8787 -e USER=<username> -e PASSWORD=<password> rocker/rstudio
```

You will be able to access the Rstudio in the browser by something like

`http://<your ip address>:8787`

Sometimes you want to add more users, to add users

```
## Enter the container
docker exec -it <container-id> bash
## Interactively input password and everything else
adduser <username>
```

### Launch Shiny server from docker

### Launch both Rstudio and Shiny server from same docker container







