2

I have developed a solution and decided to use shinyproxy.

I have the following problem:

A user needs to capture data on the solution, which must be stored and updated on the database for all users accessing the solution, I used SQLite and with R for this.

Now when I log in and capture data, it saves, but when i log in with a different user I dont get to find the captured data.

The problem is that saving data doesnt seem to be saving on the docker image, why is this and how can I go about remedying it?

For problem testing purposes:

Solution link: https://xxasdfqexx.com

Data Capturer user:

username: xxxxx

password: Fxxxx

Admin user:

username: inxxx

password: prupxxxxx

Testing:

Inside the solution, if you go to the data management tab, data entry and then right click on an table and insert a new row, click save changes, it must safe new changes to the docker image but its only temporarily doing so, the other user cant see the changes made.

nybre
  • 77
  • 8

1 Answers1

6

This is expected behavior. The SQLite DB is stored within the running container, not the image. It is therefore lost when the container is shut down. And shinyproxy starts a new container for every user. The general solution with docker is to use an external volume that is mounted into the running container and use that file/directory to store persistent data. Together with shinyproxy, you have to use docker-volumes, c.f. https://www.shinyproxy.io/configuration/#apps.

Putting this together you can use in the shinyproxy config something like:

apps:
  - name: ...
    docker-cmd: ...
    docker-image: ...
    docker-volumes: /some/local/path/:/mnt/persistent

And in the shiny app something like:

dbConnect(RSQLite::SQLite(), "/mnt/persistent/my-db.sqlite")
Ralf Stubner
  • 26,263
  • 3
  • 40
  • 75
  • I have attempted to do the above but I got very lost as no changes are not made still. Do you have a tutorial perhaps you can direct me to?, I am fairly new to Docker and shinyproxy – nybre Jul 16 '18 at 13:55
  • @nybre See the updated answer for a more explicit solution. I don't know of any how-to for shinyproxy. The "external volume" link already explains how volumes are used to persist data. There might be other how-tos, but I am not aware of them. – Ralf Stubner Jul 16 '18 at 14:21
  • This actually worked, thanks, what I was missing was the r shiny code, directory were misaligned – nybre Jul 16 '18 at 18:56