Share via

database issue

satish muthum 0 Reputation points
2025-05-15T21:44:56.4266667+00:00

I have my project set up on GitHub, which includes the frontend and backend code, along with the GitHub Actions workflow for deploying to Azure Container Apps. I'm using GitHub Actions to build and deploy, and it's working correctly.

I've successfully deployed both the frontend and backend as separate Azure Container Apps. The frontend is running fine, and the website is accessible. However, the backend uses SQLite as its database, and it's not responding properly in Azure. I can open the site, but I’m unable to log in or register a new user.

How can I resolve this issue with the SQLite database on Azure?

Azure Container Apps
Azure Container Apps

An Azure service that provides a general-purpose, serverless container platform.


2 answers

Sort by: Most helpful
  1. Ranashekar Guda 2,905 Reputation points Moderator
    2025-05-16T20:55:19.1733333+00:00

    Hello @satish muthum,

    In addition to @Bruce (SqlWork.com),and best practices consideration:

    The issue with using SQLite on Azure likely stems from its limitations in cloud environments, as it's better suited for local development. To improve performance and scalability, it's recommended to migrate to Azure Database for PostgreSQL, a fully managed and secure service.

    Start by exporting your SQLite data, create a PostgreSQL instance in Azure, and import the data using tools like pg_dump and pg_restore. Then, update your backend's connection settings and test the application before redeploying. This migration will ensure better reliability for your app.
    Hope this helps. Do let us know if you any further queries.

    0 comments No comments

  2. Bruce (SqlWork.com) 83,821 Reputation points
    2025-05-15T22:56:33.6266667+00:00

    SQLIte does not make sense for an Azure container app, unless it's just a read cache. to write to SQLite and have it persist, you need to use a mounted storage volume because container storage is ephemeral and lost when the container shuts down or is restarted.

    https://learn.microsoft.com/en-us/azure/container-apps/storage-mounts?tabs=smb&pivots=azure-cli

    Container Apps are also replicated for load balancing. while you can have the storage replicated, then each instance will have its own copy of the database file.

    using a mounted volume will persist the database between instances and allow instances to use the database file. But SQLite does not support two concurrent instances accessing the same file unless the database is read only.

    while you probably should pick a different database, you could start by using a container instance instead of container app, and only configure one instance. You should still use a mounted storage volume to host the database file, to not lose data.

    https://learn.microsoft.com/en-us/azure/container-instances/

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.