postgresql extention support on fly.io using wasp deploy cli

Hey! has anyone had any luck using pgvector or installing any additional extentions on a fly.io database? what would be ideal is if i can use the wasp cli to specify a custom docker image with pgvector installed during wasp deploy. or does anyone have a better workaround?
3 Replies
kapa.ai
kapa.ai3d ago
Hi @Kofi_anan. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Currently, Wasp supports PostgreSQL extensions through the app.db.prisma.dbExtensions field in your main.wasp file. This feature allows you to specify extensions like pgvector that you want to use with your PostgreSQL database. Here's how you can configure PostgreSQL extensions in your Wasp app:
app MyApp {
// ...
db: {
system: PostgreSQL,
prisma: {
clientPreviewFeatures: ["postgresqlExtensions"],
dbExtensions: [
{ name: "vector", schema: "extensions" }
]
}
}
}
app MyApp {
// ...
db: {
system: PostgreSQL,
prisma: {
clientPreviewFeatures: ["postgresqlExtensions"],
dbExtensions: [
{ name: "vector", schema: "extensions" }
]
}
}
}
For pgvector specifically, you need to: 1. Enable the postgresqlExtensions preview feature 2. Add the vector extension to your dbExtensions list Wasp's documentation on Prisma Configuration provides more details on how to set up these extensions. However, there's currently an open issue (#1222) about allowing users to add PostgreSQL extensions like pgvector, which suggests that there might be some limitations with the current implementation, especially when deploying with the Wasp CLI to Fly.io. When deploying to Fly.io using the Wasp CLI, the command wasp deploy fly launch sets up your app, database, and client, but there's no explicit documentation about how to customize the PostgreSQL database to include extensions like pgvector during this deployment process. If you're encountering issues with pgvector on Fly.io, you might need to: 1. Deploy your app using the Wasp CLI 2. Then manually connect to your Fly.io PostgreSQL instance and install the extension 3. Or consider using a dedicated vector database service like Pinecone as suggested in one of the GitHub issues This is an active area of development for Wasp, as evidenced by several open GitHub issues discussing pgvector integration (#1215, #1222, #1397). I hope this helps! If you find a working solution, it would be valuable to share it with the Wasp community as this seems to be a common need. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Kofi_anan, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
miho
miho3d ago
I've had great success with using PgVector on Railway with https://client-production-0be2.up.railway.app/ With Fly it tends to be more complicated... you'd need to set up the database manually and make sure to point your server app to it with the DATABASE_URL env var. It looks like you need to create your own Docker image for the database: https://andrefbrito.medium.com/how-to-add-pgvector-support-on-fly-io-postgres-35b2ca039ab8
Medium
How to add pgvector support on Fly.io Postgres
pgvector is an open-source extension for PostgreSQL adding support for vector similarity search. Unfortunately fly.io does not support…
Kofi_anan
Kofi_ananOP3d ago
thanks for that. yeah im starting to think i should move over to railway for modernity reasons

Did you find this page helpful?