I'm submitting a ...
PostGraphile version:
N/A
Please bear with me, I am very new to Postgres and Postgraphile.
I am working on an application consisting of several micro-services, all pointing to one common Database. Each service needs to have its own roles, so that one service should have minimal access to other's data. Each service can share some data/functions to other services.
From what I have read up so far, Postgraphile + Postgres combo looks really promising for this scenario.
Each service has it's own pg schema to store it's data and functions. I wanted to know would it be possible to give each service it's own postgraphile middleware to access the DB? Is postgraphile designed to support this mode where several different postgraphile instances are sharing one DB, each having different level of access? I haven't read anything in the documentation suggesting that this is not possible, but I wanted to confirm and also get an opinion whether this is a good approach.
Or should I run another service which has postgraphile and all other services call this service to access their data/functions?
Also, does Postgraphile store any housekeeping data in the database? If yes, where can I read about it? I'd need to understand how this could be managed in the shared setup.
Thanks in advance.
Assuming you don't use watch mode or live queries, PostGraphile does not modify your database and thus the different instances of PostGraphile will not be aware of each other and should not interfere. PostGraphile does not store any housekeeping data. PostGraphile is designed to live in harmony with other things accessing the database at the same time, including other instances of itself.
This should be fine :+1:
Awesome, thanks for the super fast help @benjie! So, what's the impact of watch mode and live queries on this?
Also, what's your opinion on having individual postgraphiles vs running one shared server?
Thanks!
So, what's the impact of watch mode
Watch mode: not recommended for production. We install the watch schema when PostGraphile starts, so the different postgraphile are going to probably overwrite each other repeatedly. We can improve that.
and live queries
I'm not sure. You might want to set up a shared LDS server; see the Live queries docs at graphile.org
Also, what's your opinion on having individual postgraphiles vs running one shared server?
I prefer a single PostGraphile for simplicity and performance. Each to their own though :)
Thanks, I owe you several ๐บ for your help @benjie!
Bung a few dollars in my Patreon ๐ https://www.patreon.com/benjie

It's not much.
Awesome โ thanks so much, everything helps! ๐ ๐ ๐
Hope you don't mind this one time contribution. I wish to become a full time patreon, just working to get my stuff together atm.
Iโm grateful for all contributions; if you cannot sustain contribution at that level, feel free to drop to a lower level as youโll still get access to most of my Patreon posts then, or of course you can stop at any time ๐
Most helpful comment
It's not much.