Question

Deploying app wipes out sqlite DB, where can i put the DB so it persists?

Perhaps add a block storage unit or a droplet?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
April 23, 2024

Hi there,

When deploying applications on DigitalOcean’s App Platform, it’s important to keep in mind that the platform uses ephemeral storage. This means that any data stored directly on the app’s filesystem will be lost whenever the application is redeployed, restarted, or scaled. This includes databases like SQLite that reside directly on the filesystem:

https://docs.digitalocean.com/products/app-platform/how-to/store-data/

Here are the alternatives you could consider to ensure your database persists across deployments:

  • Instead of using SQLite, which stores data directly on the local filesystem, consider using DigitalOcean’s Managed Databases. Managed Databases are persistent and are designed to handle automatic backups, failovers, and scaling without downtime:

https://docs.digitalocean.com/products/app-platform/how-to/manage-databases/

  • If you prefer to continue using SQLite or require more control over your database server, consider deploying your application on a DigitalOcean Droplet instead of the App Platform. Droplets provide persistent storage, and you can also attach additional Block Storage volumes if needed. Block Storage volumes are useful for database storage because they can be resized and managed independently of the Droplet itself. However, remember that managing your own Droplet and database comes with additional overhead, as you’ll need to handle backups, security, and updates yourself.

  • Although not typically used for database storage, DigitalOcean’s Spaces can be an alternative for storing files and other data that your application needs to persist. This wouldn’t be suitable for SQLite databases but can be useful for storing backups, logs, and other static files:

https://www.digitalocean.com/products/spaces

For your situation, where data persistence and stability are important, and you’re currently using SQLite, transitioning to a Managed Database service is likely the best solution.

Hope that this helps!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel