fraktall
fraktall•3mo ago

hey! I just deployed the self-hosted

hey! I just deployed the self-hosted version of Convex.dev on my Hetzner server and want to use Supabase as the database. I spun up a fresh project in Supabase, but when I set the DATABASE_URL env var to the Supabase connection string with postgresql://.../postgres (so the DB name is set to postgres), Convex complains I shouldn't include the DB name. According to the docs here, Convex expects a database called convex_self_hosted and won't work otherwise. Problem is, I don't think Supabase lets you leave out the DB name or rename it. When I try using the connection string without the DB name, I get Error occurred while creating a new object: error connecting to server: Network is unreachable (os error 101) in the backend container logs. Any idea how to address this? Support thread link
4 Replies
nipunn
nipunn•3mo ago
Hi @fraktall ! It doesn't need to be named convex_self_hosted - the guide you're linked to was referencing the "connecting to postgres on neon" documentation here - which explicitly tells you to create a database with that name https://github.com/get-convex/convex-backend/tree/main/self-hosted#connecting-to-postgres-on-neon The name is arbitrary - it's just that most of the guides are designed around that name. If you get things working with a convex+supabase stack, let us know! We'd even be excited to have a community maintained guide around the setup if you want to send a PR.
GitHub
convex-backend/self-hosted at main · get-convex/convex-backend
The open-source reactive database for app developers - get-convex/convex-backend
nipunn
nipunn•3mo ago
we have existing guides on running against postgres on neon, postgres locally on the same container, mysql on the same container, mysql on planetscale, and sqlite - all available here https://github.com/get-convex/convex-backend/tree/main/self-hosted#running-the-database-on-postgres-or-mysql So you can modify those instructions to see if you can get supabase setup working
fraktall
fraktallOP•2mo ago
Hi @Nipunn , thanks for getting back to me! 🙏 I set the DATABASE_CONNECTION variable with the full Supabase Postgres URL but it didn’t work. Seems like the Convex deployment script or template isn’t picking up DATABASE_CONNECTION. Is there a list of supported env variables somewhere? Just for context: I'm deploying it using Coolify (they already have Convex template, it works perfectly fine if I were to use the default sqlite db option) ping @nipunn, please respond, still blocked by this 🙏
nipunn
nipunn•2mo ago
You can check the source for all of this stuff (it's all open source) to debug. See if you can narrow down where it's not working. I'm not super intimately familiar with how Supabase works, but my understanding is that you should be able to follow the same instructions as any other postgres setup (eg neon instructions) and swap out the URL. You may have to dig a bit to figure it out. Let us know if you get something working. Convex + Supabase would be sick

Did you find this page helpful?