UofS-Pulse-Binfo / nd_genotypes

Drupal/Tripal: Tripal interface for Chado Natural Diversity Genotypic data.
https://nd-genotypes.readthedocs.io/en/latest/index.html
GNU General Public License v2.0
4 stars 1 forks source link

db password needed in every step of syncing data? #33

Open bradfordcondon opened 5 years ago

bradfordcondon commented 5 years ago

when syncing the data, every step requires the db password.

Undefined variable: databases nd_genotypes.mview.sync.inc:156                                                     [notice]
       - Copying to file...
Command dispatch complete                                                                                         [notice]
Password for user postgres:
       - Copying it into the mview...

for now ill just pipe the password to the command 100x times or so, but is there some permission change i can make to bypass this?

laceysanderson commented 5 years ago

The password prompt is due to permissions meant to protect your server. Specifically, from the PostgreSQL online documentation:

COPY naming a file or command is only allowed to database superusers, since it allows reading or writing any file that the server has privileges to access.

Since our use of the copy functionality is limited to tripal jobs which are run on the command-line they do not pose a risk to your server as they are currently implemented.

How to make sync'ing more automated

If your server is behind a firewall restricting all access to the application/database (e.g. local development site) then one option is to simply give you drupal user superuser access. However, if there is any way for someone from outside your organization to access either the Tripal site or the database, this is not recommended.

A safer way to get around the password prompt is through use of a .pgpass file or environmental variables as documented here. In both cases you must ensure it is available for the user running the Tripal job in order for it to be successful.