revodavid / devcontainers-rstudio

Zero-setup R workshops with GitHub Codespaces
MIT License
123 stars 103 forks source link

RStudio default folder #1

Open revodavid opened 2 years ago

revodavid commented 2 years ago

Configure RStudio to open in /workspaces/devcontainer-rstudio

cboettig commented 2 years ago

Firstly, wow this is amazing. Nice work. (and great to see rocker containers in use!)

A few related issues to default folder:

rstudio@codespaces-1b078e:/workspaces/devcontainers-rstudio$ git status
fatal: detected dubious ownership in repository at '/workspaces/devcontainers-rstudio'
To add an exception for this directory, call:

        git config --global --add safe.directory /workspaces/devcontainers-rstudio

I'm guessing this is because of the user name/id change? (seems a bit weird to me that the instance has a vscode user, UID 1001, and an rstudio user, 1000, accessing the same data. also a bit weird that we have root in vscode but not in rstudio, but maybe that's for the best).

Once we do as git tells us, RStudio git pane is happy to recognize the project, but again this is an extra un-intuitive step that should be automated. With git ownership and default project properly configured, this would be pretty awesome and easily deploy-able in a classroom context (where I just might have to test it anyway!)

revodavid commented 2 years ago

Thanks! There wasn't a good reason for having separate UIDs for the vscode and RStudio parts of the demo, other than the fact that vscode user had some R libraries installed for vscode that didn't make sense for the RStudio user. It would make sense to use the same user for both, and just have a condition in .Rprofile to only load the vscode libraries from the vscode environment.

cboettig commented 2 years ago

Thanks, and sorry I just saw @eitsupi already brought up the user issue in #2. I can confirm that merging #2 will solve the issue with git initialization in RStudio that I mentioned above as well. (Though it remains to configure RStudio to open in the correct default folder, ideally as the 'active project')

revodavid commented 1 year ago

Should be resolved by #6

eeholmes commented 1 year ago

fyi Here is what I had to do to get Git working and the Git tab in RStudio Server

I had both VSCode and RStudio Server open. I didn't have to close RStudio Server, just had to go do a push on VS Code first. Note, I am working on a fork so could push.

eitsupi commented 1 year ago

FYI, this new Feature configures the default folder of RStudio by onCreateCommand https://github.com/rocker-org/devcontainer-features/tree/main/src/rstudio-server https://github.com/rocker-org/devcontainer-features/blob/44dccdf5e04b036794e6d6cbc9cb583f717f792d/src/rstudio-server/devcontainer-feature.json#L28-L30