2

I am using a CodeAnywhere.com (Firehose) development stack and I am attempting to connect the Postgres SQL database to PGAdmin just so I can have some kind of graphical representation.

The issue is I have no idea how to find the host / server name or databasename.

I saw another question here and saw that I can run this command Rails.configuration.database_configuration[Rails.env] however I am not sure where exactly to run that from the SSH terminal. IRB? Because I get an error running through IRB.

Please let me know if any other information is needed.

Austin
  • 37
  • 7
  • The Firehose stack is just a core box with nothing really set up. You need to configure an app, a DB etc. What have you done so far? – lacostenycoder Mar 28 '18 at 03:12
  • I followed this guide (http://blog.thefirehoseproject.com/posts/setting-codeanywhere-development-environment/) which sets up the Postgres DB as well as creating a rails app and verifying it works – Austin Mar 28 '18 at 03:21
  • Those instructions will get you a basic development app but won't expose a production database which you'd need to connect to remotely. If you need help with that, you'll need to re-write your question to ask for it. – lacostenycoder Mar 28 '18 at 03:28

1 Answers1

1

Try running this command from the terminal.

netstat -tunalp 

And look/grep for Postgres. You can pipe the output of the above command into grep.

This will give you the Host.

If you want to find it via Rails. Try looking for the file

config/database.yml
KayCee
  • 174
  • 1
  • 11
  • Thanks for the response KayCee, I looked in my database.yml file and it shows the host as `localhost`. Does this mean I wouldn't be able to connect to it via PGAdmin installed on my desktop? – Austin Mar 28 '18 at 03:24
  • @Austin If you'd like to connect to it via pgAdmin, you will need to change the binding to the IP of your server. If you want it to work on both localhost and externally, bind it to 0.0.0.0 You might want to setup some firewall rules to allow connections only from certain IPs – KayCee Mar 28 '18 at 03:27
  • @Austin I wasn't clear earlier, the postgres config needs to be changed not rails. Follow the guide [here](https://www.google.com/amp/s/www.cyberciti.biz/tips/postgres-allow-remote-access-tcp-connection.html/amp#ampshare=https://www.cyberciti.biz/tips/postgres-allow-remote-access-tcp-connection.html) – KayCee Mar 28 '18 at 03:33
  • @Austin If this answer solved your problem, make sure to upvote it and select it as correct ([info here](https://stackoverflow.com/help/someone-answers)) – KayCee Mar 28 '18 at 16:36
  • thanks for the guidance. I am going to try that tonight and if all is well I will mark it as correct! Appreciate the help! – Austin Mar 28 '18 at 16:46