informatics-isi-edu / ermrest

ERMrest (rhymes with "earn rest") is a general relational data storage service for web-based, data-oriented collaboration.
Apache License 2.0
3 stars 5 forks source link

Support non-local database #180

Open karlcz opened 6 years ago

karlcz commented 6 years ago

Our current packaging and deploy mechanism defaults to and assumes a local web stack on a single server. It uses unix domain sockets between the web server and database, as well as scripts invoking psql to connect to the local database server.

The core system has some primitive but under-used support for a non-local database:

However, to make the software truly usable with multiple web server instances, e.g. for load-balancing, we need to fill in and test several gaps:

Additional enhancements may also be worthwhile when refactoring any of this code:

karlcz commented 4 years ago

Updating this old issue with current (manually tested) status. A deployed cluster can be converted to a remote DB with adjustments to the postgres DSN strings in ermrest_config.json and a local ~ermrest/.pgpass file to hold credentials for the connection.

However, the ermrest-deploy script still assumes a local DB cluster and runs a number of psql commands via sudo. This whole process needs more thought. Presumably, the high privileges used during the deploy process should not be available to the normal web service host. So, perhaps the deployment process should remain a local process the DBA runs on the real DB cluster host? Or perhaps we should more clearly separate:

  1. High privilege setup (usually done once) on the DB cluster
  2. Maintenance setup (done repeatedly/idempotently) via connections as the ermrest role.

In a more complex setup, the maintenance steps might be run from a separate DBA workstation or other client machine, rather than the actual web service host. This holds true for optional cron jobs as well.