I have a fairly complex Shiny application deployed on RSConnect and realized that if two users access the application simultaneously, the underlying data is shared between those two users. Looking into the docs for RSConnect, I see that Shiny applications run as the default user, rstudio-connect, and apparently that happens even if there are multiple users. I could not find, however, how to setup multiple tenancy such that multiple, simultaneous users are given their own instance of application and underlying data. It is currently set to require individual login for users to access the application, but it is still run as the rstudio-connect user, and we have a license for 100 individually named users.
Can someone point me in the right direction to enable independent sessions for simultaneous users?
First, even if multiple users connect to the same process, they will only share the data at the global level. The session specific data will still be different, c.f. Shiny - Scoping rules for Shiny apps.
Second, if you do need separate processes but are ok with those being run by the same service account, you can set Max connections per process to 1, c.f. Content Settings - RStudio Connect: User Guide.
Finally, if you need separate processes run by user specific Linux users, you have to switch to PAM authentication and Current User Execution, c.f. Process Management - RStudio Connect: Admin Guide.
I have a number of reactive values variables that are used to coordinate interactivity between different graphs and between tabs of the application, and had them defined in global.R. Moving those definitions to server.R seems to have shielded them from inter-user global scope.
Regarding your second suggestion, setting Max connections per process to 1, this appears to limit the application on RSConnect to one user at a time - is this the expected behavior?
Setting Max connections per process to 1 should not limit the app in question to a single user at a time. However, you will need separate processes per user. So you should increase Max processes.