supabase / pgadmin4

Mirror of the pgAdmin 4 GIT repo. DO NOT submit pull requests here! Use the pgadmin-hackers@lists.postgresql.org mailing list. Issues should be logged at https://redmine.postgresql.org/projects/pgadmin4.
https://www.pgadmin.org
Other
12 stars 2 forks source link

Can't connect to database at 127.0.0.1 with `docker run supabase/pgadmin-schema-diff` #26

Open karolzlot opened 2 years ago

karolzlot commented 2 years ago

Bug report

Describe the bug

Can't connect to database at 127.0.0.1 with docker run supabase/pgadmin-schema-diff

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

I have local database running in docker. I can easily connect to it using either psql connection_string or psycopg2.connect(connection_string), but when I use the same connection_string with docker run supabase/pgadmin-schema-diff I am getting:

docker run supabase/pgadmin-schema-diff 'postgres://XXX:XXX@127.0.0.1:5432/postgres' 'postgres://postgres:XXX@XXX.supabase.co:6543/postgres' > diff_demo1.sql
Starting schema diff...
Traceback (most recent call last):
  File "cli.py", line 398, in <module>
    src_db_id, src_schema_id = get_db_and_schema_id(
  File "cli.py", line 227, in get_db_and_schema_id
    conn = psycopg2.connect(connection_string)
  File "/venv/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect  
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not connect to server: Connection refused
        Is the server running on host "127.0.0.1" and accepting
        TCP/IP connections on port 5432?

It seems to me that because this tool runs in docker it has it's own 127.0.0.1.

Expected behavior

It should connect and make diff

Screenshots

n/a

System information

Additional context

n/a

karolzlot commented 2 years ago

I solved it with this hack: https://stackoverflow.com/a/24326540/8896457

karolzlot commented 2 years ago

Now I try to solve another error: https://github.com/supabase/pgadmin4/issues/3

caenguidanos commented 1 year ago

Try with: docker run --network host supabase/...