Finally I managed to install and run Ruby 2.3.6 with RVM. But now I have another problem running
heroku pg:pull command, to pull Heroku Postgres database into Postgres running on Gitpod.
Here’s my Dockerfile on Github: https://github.com/kevinhq/gitpod-dockerfile-collections/blob/master/.ruby-2.3.6-with-heroku.Dockerfile
The problem: when I run
heroku pg:pull DATABASE_URL local_db it returned the role doesn’t exist.
The same heroku pg:pull command works normally on my MacOS terminal.
I found out the Gitpod always “force” the
heroku pg:pull command to run on its localhost Postgres using this ENV variable:
When I unset that ENV variable, I got another error: can’t connect to Postgres…blah blah…
A bit about how
heroku pg:pull works:
- It will create a database on local Postgres first.
- Then, it will run pg_dump on remote Postgres on Heroku.
- Then, it will run pg_restore on local Postgres, to import the dumped data from remote Postgres on Heroku.
So, when I unset PGHOSTADDR: The first step to create database failed because it can’t connect to local Postgres.
When I set PGHOSTADDR to 127.0.0.1, the second step failed to connect remote Postgres on Heroku — because it’s likely the Gitpod will force the script to always connect to local Postgres when that PGHOSTADDR is set to 127.0.0.1
Any workaround for this problem?
P.S. I tried to dump and import manually but this is not working too because local Postgres installed for ubuntu 16.04 is 9.5. Is it possible to upgrade it to 9.6 so it will match the Heroku Postgres version?