heroku / legacy-cli

Heroku CLI
https://cli.heroku.com
MIT License
1.37k stars 382 forks source link

heroku pg:pull ignoring PGPORT when calling `createdb` #2048

Open Alain1405 opened 7 years ago

Alain1405 commented 7 years ago

I have run this command a thousand times and it worked until some days ago. I run a local potsgres server on port 5444.

(venv-development) Alain-MBP:backend alain$ echo $PGPORT
5444
(venv-development) Alain-MBP:backend alain$ heroku pg:pull DATABASE_URL local-development/db/ --app app-name
heroku pg:pull DATABASE_URL local-development/db/ --app app-name
heroku-cli: Pulling postgresql-transparent-31571 ---> local-development/db/
createdb: could not connect to database template1: could not connect to server: Connection refused
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?
make: *** [db-sync-production] Error 1

When creating the db, port 5432 is used instead.

(venv-development) Alain-MBP:backend alain$ heroku --version
heroku-toolbelt/3.43.16 (x86_64-darwin10.8.0) ruby/1.9.3
heroku-cli/5.5.8-df05424 (darwin-amd64) go1.7.4
=== Installed Plugins
heroku-docker@2.0.1
heroku-redis-cli
heroku-repo
heroku-repo@1.0.1
ransombriggs commented 7 years ago

@Alain1405 I just shipped a new version (5.5.10) you can get by running heroku update. Please let me know if that fixes this bug.

Alain1405 commented 7 years ago

Thanks @ransombriggs , that definitely fixed it partially. Now the PGPORT env variable is honored. However I now get, at the end of the procedure:

psql: server does not support SSL, but SSL was required
 ▸    WARNING: Extensions in newly created target database differ from existing source database.
 ▸    Target extensions:
 ▸    
 ▸    Source extensions:
 ▸    extname
 ▸    ---------
 ▸    plpgsql
 ▸    (1 row)
 ▸    
 ▸    
 ▸    HINT: You should review output to ensure that any errors
 ▸    ignored are acceptable - entire tables may have been missed, where a dependency
 ▸    could not be resolved. You may need to to install a postgresql-contrib package
 ▸    and retry.
heroku-cli: Pulling complete.

I don't understand if the SSL message and the extension message are related. For sure after all pg_dums and pg_restores the local db is not in place. I'm figuring out how to debug it.

Btw, I'm on OSX 10.12