Heroku and PostgreSQL

Using https://devcenter.heroku.com/articles/heroku-postgresql

Some links:

https://github.com/Gangles/every-game-bot/blob/master/everygamebot.js
https://github.com/Gangles/tiny-crossword-bot/blob/master/tinycrossword.py
http://www.developerhc.com/build-twitter-bot-part-1-setup-new-rails-project/
https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-node-js

I really, really thought I had some samples in node.js, but cannot find back.

To install pgsql locally, use the installer at http://www.enterprisedb.com/products-services-training/pgdownload#windows

To connect to the database when running on my dev machine (NOT on heroku server itself) ?ssl=true needed to be appended to the DATABASE_URL .env variable.
No idea what will happen (yet) if I have that config server-side, as well.

Since connecting to the db is an asynchronous operation, the sequencer component (that uses postgreSQL) will have to use promises, or something.

ETIMEDOUT error from local dev

So, you've updated to use SSL, and you're behind a firewall, and you're getting an error like the following:

DB init error: { [Error: connect ETIMEDOUT] code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'connect' }

It's because you're behind a firewall that isn't opening the port you want to use. TOUGH LUCK.

Unfortunately, the best way to get command line access to your Heroku Postgres instance is to have your network admin open up the firewall for the required port. However, if you're willing to consider some other alternatives you could:

  • Use a cloud-friendly admin interface such as JackDB25 to gain access to your db.
  • SSH into a remote shell (VPS, or any machine outside your network) and invoke heroku pg:psql or psql directly from there.