Storage

Each application deployed to shinyapps.io creates storage in its own private file system when the application starts to run. The application only has access to the data that was uploaded with the application at the time of deployment. This means that any files that you read from disk must be included in the application directory or within a subdirectory, and must be referenced with relative paths rather than absolute paths.

For a csv file in the same directory as the application directory: mydatadirectory

Good:

Bad:

Applications can read and write to the local file system, but the storage should be considered ephemeral (i.e., it is not guaranteed to be available between application restarts, and is never available to other application instances). Redeploying your application will reset the storage for your application to only what is included in the upload bundle.

Important note: If your shiny application collects information that you would like to have persisted, you will need to write the data to a persistent data store (e.g., databases, Dropbox, Google Sheets, S3 etc.). For more information, please read Persistent storage with Shiny.

Understanding the storage lifecycle

When a request for an application is made but there are no Application Instances running, a new Application Instance will be started. That Application Instance will get a full copy of the bundle provided at the time the application was deployed. The storage will be persistent while the application is in the Running state. After the idle timeout is reached, the application will be put into a Sleeping state, and any changes to the file system will be lost. In the future, we expect to add support for persistent storage that can be made available across application restarts. If that is of interest to you or your team, please drop us a line in the shinyapps.io Community.