Search code examples
sqldatabasepostgresqlsupabasecoolify

What's the correct postgres url when hosting Supabase with Coolify?


Can't figure out what is the correct postgres url when hosting with Coolify. Everything is up and running. I have only changed the service name to db and kong domain to https://mywebsite.com:8000

Coolify is hosted on ubuntu vps_1 and through Coolify I deployed Supabase on ubuntu vps_2

What's the correct postgres url?

npx supabase db push --db-url "postgres://user:[email protected]:5432/postgres"

docker-compose.yml

.env.example

My environment variables:

POSTGRES_DB=postgres
POSTGRES_HOST=supabase-db
POSTGRES_PORT=5432
SERVICE_PASSWORD_POSTGRES=***

Solution

  • With the default Coolify Docker Compose File its as followed:

    Right under supabase-db (inside the Docker Compose File) you add the mapping (ports:) like that:

      supabase-db:
        ports:
         - '${POSTGRES_PORT}:${POSTGRES_PORT}'
        image: ...
    

    Then under Firewall i.e. Hetzner you allow Port: 5432

    Then you construct your url like the following:

    postgresql://postgres:{POSTGRES_PASSWORD}@supabase-db:5432/postgres