How to use pgweb connect Discourse postgresql database?

(bubill) #1

Recently I found PostgreSQL tool: pgweb : GitHub - sosedoff/pgweb: Cross-platform client for PostgreSQL databases

How to use pgweb connect Discourse postgresql database ?

Beginners Guide to Install Discourse on Ubuntu for Development
(Jeff Atwood) #2

I believe @PJH wrote a how to about that here. Check the how to category.

(bubill) #3

I can’t imagine that how to connect category , pgweb and postgresql ??

What is it means "Check the how to category " ?

(PJH) #4

He means check howto on here, one place you can easily get to it is from here - the green one on the left hand side:

Regardless, it never got there AFAIK; the post which @codinghorror mentions is here:

Beginners Guide to Install Discourse on Ubuntu for Development
(bubill) #6

Thanks a lot !

but i wanna use pgweb…

(PJH) #7

Do you want to connect to the live database or a backup?

(bubill) #8

Yes I wanna connect to the live database like use phpmyadmin to check mysql .

(PJH) #9

Then that post is of little use to you.

You question boils down to (to which I don’t have the answer):

Does the docker instance publicly offer the postgres service to public interfaces, if not, can it be made to?

I’m sure someone may be along shortly to answer those.

Once you have that sorted, I presume pgweb has some sort of interface/configuration file where you simply point it to the DC instance by adding a new host.

(bubill) #10

Since you make phpPgAdmin to connect discourse postgresql database.

Could you try to use pgweb or other good Pg tools ???

(PJH) #11

I don’t connect phpPgAdmin to the Discourse site I’m admin for - I don’t have admin access to the actual server - just the admin web-interface.

So I work around that by restoring a recent backup of the database to a totally different server I do have control over - hence the post I linked to earlier on how I did that.

I don’t connect phpPgAdmin to our live database - so I can’t answer the underlying questions that need to be answered to help you.

(bubill) #13

OK Thanks a lot !

I use amazon S3 for backup…

(Kane York) #14

The answer is “not by default” and “yes”.

@bubill, you want to add a port expose to the container definition (app.yml), as well as create a postgres user for outside access.

  - "2222:22"   # ssh internal
  - "4001:443"  # nginx https
  #- "4001:80"
  - "5432:5432" # postgres

To create a user:

./launcher enter app
su postgres

GRANT ... ON discourse ....;

However, I implore you - use a very strong password for this user. Robots will attempt to password-guess it and obtain database access.

Try this for generating a password:

cat /proc/sys/kernel/random/uuid

(bubill) #15

Thanks very much !!! I’ll try this way…

Do you have try this ?

(Dave) #16

Do you need to rebuild the app after exposing the postgres port?

(Kane York) #17

launcher restart will work as well.