SQLite Database Data Loss - Containers Restarting Daily?
vikrant-devcyb
FREEOP

4 months ago

Dear Railway Support Team,

I am experiencing a critical issue with my deployed Laravel application and need clarification about Railway's container lifecycle management.

Issue Description:

  • My application uses SQLite database to store Shopify authentication tokens

  • Every day, the stored authentication tokens are automatically cleared/lost

  • I have not implemented any code that deletes or clears this data

  • The SQLite database file and table structure remain intact, but the data disappears

Application Details:

  • Technology: Laravel + SQLite

  • Database file location: /app/database/database.sqlite

  • Data being lost: Shopify access tokens stored in 'shops' table

  • Pattern: Data loss occurs daily at approximately the same time

Questions:

  1. Do Railway containers automatically restart daily for maintenance?

  2. Is the container filesystem ephemeral, causing file data to be lost on restart?

  3. What is Railway's policy on container lifecycle and data persistence?

  4. Do I need to configure persistent volumes to maintain SQLite data between restarts?

What I've Verified:

  • Database table structure remains intact after data loss

  • No application code is deleting the data

  • Shopify tokens do not expire (custom app tokens are permanent)

  • Issue occurs consistently every ~24 hours

Request for Clarification: I need to understand if Railway containers are designed to restart periodically, which would explain the data loss pattern. If this is the case, I need guidance on implementing persistent storage for my SQLite database.

Could you please confirm:

  • Railway's container restart schedule/policy

  • Best practices for SQLite persistence on Railway

  • Whether persistent volumes are required for file-based databases

This is affecting a production Shopify application, so your prompt response would be greatly appreciated.

Project Details:

  • Project Name: Unsubscribe-and-prefrence

Thank you for your assistance.
Vikrant Kumar

Solved

2 Replies

Railway
BOT

4 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


christian
EMPLOYEE

4 months ago

Hi Vikrant,

Railway may redeploy services to rebalance workloads across Railway's infrastructure, and you will experience this from time to time on the Free plan.

To persist data, you should store your data in a Volume. See the Docs on Volumes.

Here's a SQLite template with a database underpinned by a Volume.

Regards,

Christian


Status changed to Awaiting User Response Railway 4 months ago


Railway
BOT

3 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 3 months ago


Loading...