Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Docker #29

Closed
3 of 4 tasks
ruaridhw opened this issue Oct 20, 2017 · 9 comments
Closed
3 of 4 tasks

Support for Docker #29

ruaridhw opened this issue Oct 20, 2017 · 9 comments
Assignees

Comments

@ruaridhw
Copy link
Collaborator

ruaridhw commented Oct 20, 2017

Build a Docker image that can be used to run the package on macOS, Linux and Windows in a self-contained environment.

Relates to #24 #16 #13

  • Build Docker image that inherits from rocker/r-ver + devtools + rClr
  • Write setup script docker.sh for easy installation and use of images
  • Add RStudio build instructions to docker.sh
  • Retune docker.sh using compose to avoid manually starting multiple containers
@ruaridhw
Copy link
Collaborator Author

The documentation for Linux and Windows also needs a refresh as there are several known issues with rClr on Mono and newer versions of .NET for Windows.

See rdotnet/rClr#27 and rdotnet/rClr#31 for rClr build errors on Linux and macOS

@agstudy
Copy link
Owner

agstudy commented Oct 20, 2017

Excellent idea! I will try to help on this.

ruaridhw pushed a commit that referenced this issue Oct 20, 2017
Add simplified, full installation instructions including caveats for each OS and required workarounds.

General updates to wording
ruaridhw pushed a commit that referenced this issue Oct 20, 2017
Include Dockerfile, usage instructions and updated README (#13, #16, #24, and #29)
@agstudy
Copy link
Owner

agstudy commented Oct 21, 2017

Excellent. That was very fast. Excellent.

@ruaridhw
Copy link
Collaborator Author

ruaridhw commented Oct 22, 2017

@agstudy would you like to test the docker help script so that it's easy enough to follow along?

Also, if you prefer using RStudio Server for easier interactivity over command line R, you can download these two files over the top of the current Dockerfile and then in docker.sh run:

docker build -t rsqlserver-rstudio . instead of docker pull ruaridhw/rsqlserver:latest

and replace rsqlserver-rstudio everywhere there is ruaridhw/rsqlserver

The RStudio server will then run as a service in the background and can be accessed at http://localhost:8787

Probably best to test both cases.

@agstudy
Copy link
Owner

agstudy commented Oct 22, 2017

I have tested the docker.sh.

I think it works , but I am not sure becuase I don't know how to test it now.
PS: I have added me as a docker user: sudo usermod -aG docker $USER

@ruaridhw
Copy link
Collaborator Author

ruaridhw commented Oct 22, 2017

Sorry, I just mean trial the script so it's easy to understand and works as expected. You can run both images together or independently:

  1. Independently: Trial both images separately by:

    • Running the R session interactively (as per the last section in docker.sh) and issue any test R commands you like
    • The SQL Server image can be connected at host = localhost from any desktop client (eg. SSMS, Visual Studio, Navicat ...)
  2. Together: Run the R session interactively and library(rsqlserver) in your session. Then you can connect to the DB image with con <- dbConnect('SqlServer', host = 'mydb', dbname = 'rsqlserverdb', user = 'SA', password = 'P@ssw0rd1') as per the second last part.

@agstudy
Copy link
Owner

agstudy commented Oct 22, 2017

I tested the 2 last statements:

docker run --name testrsqlserver --link=mssqldb --rm ruaridhw/rsqlserver Rscript \
   -e "library(rsqlserver)" \
   -e "con <- dbConnect('SqlServer', host = 'mydb', dbname = 'rsqlserverdb', user = 'SA', password = 'P@ssw0rd1')" \
   -e "dbReadTable(con, 'Inventory')"

Works fine and give the expecte dresult :


  id   name quantity
1  1 banana      150
2  2 orange      154

Then I tested the intercative R session and it works fine also:

docker rm rsqlserver122
docker run --name rsqlserver122 --link=mssqldb -i ruaridhw/rsqlserver


Excellent job!

@agstudy
Copy link
Owner

agstudy commented Oct 22, 2017

Now, How I can call the rsqlserver from Rstudio session?

@ruaridhw
Copy link
Collaborator Author

ruaridhw commented Oct 22, 2017

Do you mean your local RStudio installation? It's exactly as on the R image except for host:

con <- dbConnect('SqlServer', host = 'localhost', dbname = 'rsqlserverdb', user = 'SA', password = 'P@ssw0rd1')

Since I'm on a Mac, I can't run rsqlserver on my local RStudio so I have to run RStudio Server on a Docker image. That's what I was referring to here

@ruaridhw ruaridhw mentioned this issue Nov 7, 2017
4 tasks
@ruaridhw ruaridhw reopened this Nov 16, 2017
ruaridhw pushed a commit to ruaridhw/rsqlserver that referenced this issue Nov 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants