Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to put SQLite database file in Azure App Service?

Tags:

Q1: Where do you think is the right place to put a SQLite database file (database.sqlite) in Azure Web App file system? For example:

  1. D:\home\data\database.sqlite
  2. D:\home\site\database.sqlite
  3. D:\home\site\wwwroot\database.sqlite
  4. other?

Q2: What else should be taken into consideration in order to make sure that the database file won't be accessible to public users as well as not being accidentally overwritten during deployments or when the app is scaled up/down? (The Web App is configured for deployments from a Local Git Repository)

Q3: Where to learn more about the file system used in Azure App Service, the official source URL? E.g. how it's shared between multiple VMs within a single Web App, how does it work when the App is scaled up/down, what's the difference between D:\home (persistent) vs D:\local (non-persistent)...

Note that SQLite does not work in Azure Blob Storage, so that one is not an option. Please, don't suggest alternative storage solutions, this question is specifically about SQLite.

References

  • Appropriate Uses For SQLite
like image 788
Grief Coder Avatar asked May 19 '16 08:05

Grief Coder


1 Answers

In a Web App, your app is deployed to d:\home\site\wwwroot. This is the area where you may write files. As an example, the ghost deployment writes its SQLite database to d:\home\site\wwwroot\content\data\ghost.db. (easy to see this, if you open up the kudu console via yourapp.scm.azurewebsites.net):

kudu sqlite example

This file area is shared amongst your web app instances. Similar to an SMB file share, but specific to web apps (and different than Azure's File Service).

The content under wwwroot is durable, unless you delete your app service. Scaling up/down impacts the amount of space available. (I have no idea what happens if you scale down and the smaller size has less disk space than what you're consuming already).

like image 123
David Makogon Avatar answered Sep 23 '22 19:09

David Makogon