download license.db
bekind24
HOBBYOP

3 months ago

Dear community, I am having a license.db file which is run from my github repo. Licenses get added to tthe database running in railway container server, so whenever i rebuild server, all newly created licenses are gone. and need to start all over. Is there any way to download the latest licenses.db file that is running from railway? so i can add it in my repo to replace old version?

1 Replies

3 months ago

Hey
In general, you shouldn't be putting database files into GitHub repos; sensitive production information should almost never be in source control.

I think the solution here would actually be to use a Database Service in Railway like PostgreSQL to store your data if you want to stick to a relational database (like SQLite which it sounds like you're using). If you wanted a quick fix for persisting the database file in Railway you could use a volume (you still wouldn't be able to push new changes from GitHub though; you can't "merge" those two databases).

Quick Fix: persistent volume

Mount a volume to your license.db location so data survives rebuilds:

  1. Go to your service in Railway

  2. Add a Volume and mount it to where your license.db lives (e.g., /app/data)

  3. Redeploy

Option 2: PostgreSQL (Recommended)

Migrate to PostgreSQL for a production-grade solution. Railway provisions it for you and can handle backups on the pro plan.

  1. Add PostgreSQL to your project via the + New button

  2. Use the generated DATABASE_URL environment variable in your app

  3. Migrate your license data using your application's ORM or SQL tools

If you need to extract your current data before migrating, you'd need to query your running container directly or add a backup endpoint to your app somehow. downloading files from the ephemeral filesystem in your railway service isn't supported through the Railway dashboard at all.


Loading...