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

RStudio default folder #1

Open
revodavid opened this issue Jul 5, 2022 · 6 comments
Open

RStudio default folder #1

revodavid opened this issue Jul 5, 2022 · 6 comments

Comments

@revodavid
Copy link
Owner

Configure RStudio to open in /workspaces/devcontainer-rstudio

@cboettig
Copy link

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

A few related issues to default folder:

  • Ideally, I think it would open to that folder as an active "RStudio Project". This will allow RStudio's git pane to reflect the current repo as well, and overall better match the look & feel of how VSCode opens a project in codespaces. (It's harder than normal for a user to do new project since RStudio defaults to ~/ and a user needs to know to go looking in / for the workspaces dir....)
  • There's some issues with this. Switching to /workspaces/devcontainer-rstudio (e.g. even in terminal), we find git is unhappy:
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
Copy link
Owner Author

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
Copy link

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
Copy link
Owner Author

Should be resolved by #6

@eeholmes
Copy link

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

  • Created a project (.Rproj file) at devcontainers-rstudio
  • Use tools > version control to specify that I wanted to use vc. Not sure I needed to do this.
  • At this point I could commit and pull but could not push because I got authentication error
  • Went back to VSCode and did a push from there
  • Went back to RStudio Server and now I could push.

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
Copy link
Contributor

eitsupi commented Aug 29, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants