coollabsio / coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.
https://coolify.io
Apache License 2.0
34.33k stars 1.86k forks source link

[Bug]: Supabase database expose #3297

Open alvarolozano opened 2 months ago

alvarolozano commented 2 months ago

Description

I created a Supabase instance, and my goal was to expose the PostGres database to access it from PGAdmin.

When Supabase is deployed, the PostGres container offers a checkbox to enter the port and expose it directly, but it's not working... I had to manually expose it by modifying the docker compose file.

Minimal Reproduction (if possible, example repository)

  1. Create the Supabase instance
  2. From the stack view, select the PostGres container and click "settings"
  3. Type a port number and mark the ckeckbox to expose the port image

Exception or Error

I thought it was something related with the PostGres config, but the port is not being exposed.

Version

v4.0.0-beta.325

Cloud?

djsisson commented 2 months ago

it looks like it doesnt set internal port here: https://github.com/coollabsio/coolify/blob/eb6add358a5a06cb6dd078d8a184446379fed188/app/Actions/Database/StartDatabaseProxy.php#L70 due to this not being one of teh standalone database types

grantmagdanz commented 2 months ago

Running into this same issue

justinline commented 1 month ago

Can confirm, had to edit the docker-compose file to expose the port (using coolify cloud)

alvarolozano commented 1 month ago

I will check the behaviour with other services... I don't know how it should work internally, but maybe, it is supposed to write into the compose file the expose rule with the desired port.

djsisson commented 1 month ago

@alvarolozano its starts a nginx container so you don't have to start or stop the service, the publicly available is on demand, however it doesn't work for this as there is no internal port specified

scorpionate commented 1 month ago

Same here. Following: https://supabase.com/docs/guides/self-hosting/docker. I have added manually in Coolify's docker-compose editor. My steps from the scratch:

  1. Create new project from the template.
  2. Modify docker-compose:
  supabase-db:
    ports:
      - ${POSTGRES_PORT:-5432}:${POSTGRES_PORT:-5432}
  1. Edit DB port in ENV, because 5432 was busy in my case.
  2. URL is
    postgresql://supabase_admin:{SERVICE_PASSWORD_POSTGRES}@{YOUR_HOST}:{POSTGRES_PORT}/{POSTGRES_DB}

Name reflects ENV names in Coolify cloud.

djsisson commented 1 month ago

i'll just add, this is the auto generated nginx.conf for supabase

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log;

events {
    worker_connections  1024;
}
stream {
   server {
        listen 5432;
        proxy_pass rcoc880:;
   }
}

the tag rcoc880 is part of the url in the browser but is not the supabase-db containerid and as you can see it's also missing the port as suspected

LazerJesus commented 2 weeks ago

I had to apply this fix, but now it works fine. just a question for my understanding:

when does coolify write these docker-compose files? are they written once when i instantiate the service from the coolify UI, or are they written at any other point? how reliable a fix is it to go into the filesystem and manually overwrite config managed by coolify? are there hidden caches or something?

djsisson commented 2 weeks ago

@LazerJesus i dont follow your question, once the template is in your project, no other changes occur unless you change it you dont need to go into file system to change it, you need to do it in coolify ui, and press save and redeploy