Remix + Prisma: DB in the mounted Volume cannot be used by the App

I am currently developing a Remix app which has a Prisma DB with SQLite in the project file. I want to make the DB persistent using a volume and i mounted it in the fly.toml. There is no problem when mounting but somehow the app could not get any entries from the db. I also changed the url in the schema.prisma to the destination of the mounted volume.

The mounts section in fly.toml
Bildschirmfoto 2024-01-30 um 11.32.33

The url in schema.prisma
Bildschirmfoto 2024-01-30 um 11.33.30

I’m assuming that the app can write into the dev.sqlite file because it is not empty anymore and has some data saved in there. Granted i only opened the file using fly ssh console and used cat to read the file contents. I also changed the permission for the dev.sqlite and it now looks like this but I dont think this does anything.

Any help would be appreciated :slight_smile:

I have a similar issue. I followed the suggestions and created 2 VM for my app, each VM with a volume so I can persist the Prisma db, everything looks good and I see that the data is stored in the dev.sqlite file as I see the size increase when doing a list -l.
But after some time the VM goes to sleep and when I refresh the shopify page, it starts back but with the original dev.sqlite, no data stored in it.

this is my fly.toml:

processes= [“app”]

and my schema.prisma:

datasource db {
provider = “sqlite”
url = “file:data/dev.sqlite”

I also moved the dev.sqlite file to a data folder from the root.

and these are the volumes:

What am I missing? Do I have to do anything else on to store the db in the persistent volume?


I don’t see anything wrong, but perhaps a working demo would help? In an empty directory run:

npx --yes @flydotio/node-demo@latest --sqlite3 --prisma
fly launch
fly deploy

Once you get this working, you can compare it side by side with your app to see what is different.

See Vanilla with Candy Sprinkles · The Fly Blog for more details.

I have it working. I don’t know if this is the cleanest way but works for now.

I want to have the app on and also be able to run it on the test store, so I created a variable in the .env file at the root of the project (local).


and in the fly.toml file I set the same variable but with the absolute path that will have in the server after deploying the app.


and in schema.prisma I set the url to

datasource db {
provider = “sqlite”
url = env(“DATABASE_URL”)

So when I run npm run dev -- --reset it takes the value from .env and places the database file under the folder /prisma

and when I run npm run deploy -- --reset and flyctl deploy --remote-only it takes the value from fly.toml and places the database file under /data folder.

You can check this by doing fly ssh console and ls -l of those folders.

Now I have to figure out how to replicate the db on both volumes so it doesn’t matter which VM is running I see the same data… If I understood well from the docs this can be achieved with LiteFS


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.