I am developing a Shopify app using the Remix template and Prisma with an SQLite database. Currently, I am working on hosting the app on Fly.io and want to set up a PostgreSQL database instead of SQLite.
I successfully deployed my app on Fly.io, but I am facing issues during the database setup. When I run the command:
npx prisma migrate dev
I get the following error:
Datasource “db”: PostgreSQL database “…”, schema “public” at “…:5432”
Error: P1001: Can’t reach database server at …:5432
I need a step-by-step guide to host the app with a properly configured PostgreSQL database on Fly.io. Any help would be greatly appreciated. Thank you in advance!
First of all, I recommend using Supabase as it simplifies hosting and comes with some free storage. It could save you from dealing with many hosting-related issues.
However, if you prefer using Fly.io, I believe the issue lies with private IPv6 addresses. You’ll need to create private IPv6 addresses for both PostgreSQL and your application. Here’s how you can do it:
Allocate private IPv6 addresses:
fly ips allocate-v6 --private
Use the Flycast proxy during deployment:
fly deploy --flycast
Make sure to use IPv6 for accessing PostgreSQL from your application.
Hi Rohan, I’m also facing the kinda same issue, my app is using SQLite to store data, I also have launched the app successfully on Fly.io, but the flyio URL was never lived and I see it in the Fly.io platform that the app is “suspended”. Now I’m about to try to set the data from SQLite to Postgres but don’t have to do that.
Can you share your solution?
Can you please share the approach you’ve applied so far? Also, do you specifically need to save your data in PostgreSQL, or are you open to other solutions? Reply through inbox, and I’d be happy to help!