Connecting Self-Hosted Supabase to Softr

Hi, I set up a self-hosted Supabase DB and trying to connect it as a datasource to Softr. But didnt suceed yet. Who can help?
61 Replies
inder
inder3w ago
What connection string are you using?
Yonatan
YonatanOP3w ago
for host i am using the domain i hosted supabase on. database is postgres, user and password i am using a super admin user that is defined in env file, and works for login. i also tried anon as user and the anon key as password, but it didnt work
inder
inder3w ago
I just watched this softr setting up with supabase video https://www.youtube.com/watch?v=3xckjKoi6pU. And just a quick search tells me that softr is only available on cloud and you can't self host it. So if you want to give access to softr, your self hosted db should be accessible over the internet Refer to these screenshots. This is with n8n but the configuration process for db will be same except the hostname which will be the hostname you're serving your db on. https://discord.com/channels/839993398554656828/1402924041693565018/1402986755111518248
Yonatan
YonatanOP3w ago
Yes, I have Supabase self-hosted.
inder
inder3w ago
self-hosted + accessible over internet?
Yonatan
YonatanOP3w ago
I have supabase also on cloud and its connected to softr, but I struggle to get the self hosted supabase connected to softr
inder
inder3w ago
Is your self-hosted instance accessible over internet?
Yonatan
YonatanOP3w ago
yes, of course. I am logging in via his domain
inder
inder3w ago
So lets say your domain is example.com. Now in the host, you'll add example.com port will be 5432 and you'll have to open this port in your cloud's firewall, both incoming and outgoing connections database: postgres user: postgres.your-tenant-id (Do note that the user postgres.your-tenant-id, the value after . comes from POOLER_TENANT_ID env variable. By default it is your-tenant-id) password: db password will be present in your env variables
Yonatan
YonatanOP3w ago
I added the port to the firewall on DO. created a tenant id, added all details, but still not working. the domain is on cloudflare, do i have to whitelist softr there?
inder
inder3w ago
What do you mean created a tenant-id? You don't have to do anything extra
Yonatan
YonatanOP3w ago
in my env file it wasnt mentioned
Yonatan
YonatanOP3w ago
Actually DO has one in marketplace https://marketplace.digitalocean.com/apps/supabase
DigitalOcean
Supabase | DigitalOcean Marketplace 1-Click App
Supabase is an open source Firebase alternative.
Yonatan
YonatanOP3w ago
I also installed Docker
inder
inder3w ago
The supabase service versions in this 1-click app are quite old. Also, I've never used this before so don't know how they've configured it. Is a docker-compose.yml file present? You can also try setting up an instance with my project supabase-automated-self-host. You just have to run a script and everything is configured automatically. You'll just need a server
Yonatan
YonatanOP3w ago
i am checking your set up now installation is super easy, can you help with this error? 431 Request Header Fields Too Large - i see it when entering the domain
inder
inder3w ago
Entering the domain where? In softr?
Yonatan
YonatanOP3w ago
in the browser works now, was caching supabase is running. i can access but i didnt manage to connect it to softr yet. Host: my-domain Port: 5432 database: postgres user: postgres.your-tenant-id pw: db password
inder
inder3w ago
Wait, let me test it on my end. @Yonatan I'm able to connect. Not facing any issues. What env variable are you using for db password It has to be POSTGRES_PASSWORD
inder
inder3w ago
You can try with my creds for testing. host: supabase.servehttp.com password: b6b875f52ac37418773f74c14d98e4fd
No description
Yonatan
YonatanOP3w ago
yours worked. mine still dont work
inder
inder3w ago
Check your firewall.
Yonatan
YonatanOP3w ago
maybe its cloudflare?
Yonatan
YonatanOP3w ago
No description
Yonatan
YonatanOP3w ago
ports are open
inder
inder3w ago
I think in cloudflare you will also have to set dns only
Yonatan
YonatanOP3w ago
i changed it to DNS only and still get this error: Something went wrong Error while connecting to SQL Database: Failed to obtain JDBC Connection, The connection attempt failed.
inder
inder3w ago
Maybe try in a private window. Could be caching again. Or first try to connect to self-hosted db with psql. See if that works
Yonatan
YonatanOP3w ago
I used the IP instead of the domain and it worked
inder
inder3w ago
Then maybe cloudflare has still not updated the state could be cached at their end or in your browser which can be verified with private window
Yonatan
YonatanOP3w ago
very nice installatio! super quick thank you for your help, I like also the authentification
inder
inder3w ago
Thankyou. If its a production instance always use 2FA Also I'd recommend to setup a subdomain for db connections. And set dns only for this subdomain
Yonatan
YonatanOP3w ago
I have a subdomain but proxied, why is the dns only important?
inder
inder3w ago
https://community.cloudflare.com/t/what-is-the-difference-between-proxied-and-dns-only/173310/2
The upside of proxied is that you will enjoy the Coudflare benefits but you can not make a direct connection to your IP, which means any custom ports wont work.
Yonatan
YonatanOP3w ago
yes, noticed now when trying to update supabase via n8n. so best to have the supabase on dns only? or for http requests a seperate subdomain?
inder
inder3w ago
Depends on what you're doing. If you want to make a direct connection to db, then you'll need to set dns only. If you're using REST api then you can use proxied mode as it uses http requests. services like n8n or softr require direct connection so you'll need to use dns only mode for them
Yonatan
YonatanOP2w ago
ok, thank you! Hi, a different topic: do you know a self hosted to solution to download vimeo files and convert them to audio? the files are from my account, i just have more than 1000 and need an automation.
inder
inder2w ago
No idea about this, sorry
Yonatan
YonatanOP2w ago
As you know I am using Softr. And I noticed that sometimes the data is showing very quickly there, but most of the times its not showing at all. Is Supabase overwhelmed, although CPU is at 20%? Do I need to change any settings in the installation, like pool size? I found lots of data in supabase regarding slow queries how to optimize
inder
inder2w ago
Are you talking about self-hosted supabase or cloud?
Yonatan
YonatanOP2w ago
Self-hosted via your installation
inder
inder2w ago
The script doesn't modify any internals of supabase. I think this must be an issue with softr platform itself.
Yonatan
YonatanOP2w ago
Ok, that helps. I will check with softr. Thank you Is softr a good frontend solution for supabase? I have about 15 users that need access to data.
inder
inder2w ago
I've never used it so I won't be the best person to answer
Yonatan
YonatanOP2w ago
do you recommend to increase the pool size?
inder
inder2w ago
Why do you think you have to increase the db pool size?
Yonatan
YonatanOP2w ago
The data doesn't show in softr from time to time. Softr suggested to increase pool size. Its not consistently quick showing data. Trying to understand why and how to fix it, before I role out to users I noticed that when n8n is adding new records (every 15min) the data doesn't show in softr, only a few min after it shows
inder
inder2w ago
Currently the connection is made via supavisor to supabase postgres db. Try this In the docker-compose.yml file find out db service and add ports config
db:
ports:
- 5432:5432
db:
ports:
- 5432:5432
inder
inder2w ago
After adding the above config, comment out line 453
No description
inder
inder2w ago
And then restart
docker compose up -d --force-recreate
docker compose up -d --force-recreate
You will have to change only the username on softr side. Now the username will just be postgres. Do note that this way you're making direct connection to db. Previously the connection was made via supavisor pooler in session mode. Maybe that could be causing issues. If this doesn't fix the issue, then maybe softr has aggressive caching. After records are updated, open softr in another browser's private window and see if records are available in that window
Yonatan
YonatanOP2w ago
Ok I will check and let you know Thank you I didnt get it to work. At the moment I have vector unhealthy issues, after updating docker-compose.yml
inder
inder2w ago
What are the exact changes you made?
inder
inder2w ago
This is the how the changes should be made
No description
No description
Yonatan
YonatanOP2w ago
I will check it tomorrow against your file.
inder
inder2w ago
You've not added ports config in db service and no need to comment out port 6543 on supavisor. Make sure to follow the screenshots
Yonatan
YonatanOP2w ago
Could you share the whole docker compose yml?
Yonatan
YonatanOP2w ago
Thank you again! With your file I found the errors, now data shows quick and smooth and consistant. I guess I should increase security now
inder
inder2w ago
I guess softr is already using a pooler so supavisor was affecting it

Did you find this page helpful?