Would be nice to include some plugins that people commonly want so they don't have to build a new image just to install them:
Other suggestions welcome.
(They won't be enabled by default, but people can opt into them on the CLI as usual.)
I'd like to add @graphile-contrib/pg-order-by-related too
@graphile-contrib/pg-many-to-many please!
I think we can just add:
RUN yarn add @graphile/[email protected] @graphile/[email protected] @graphile-contrib/[email protected] [email protected] @graphile-contrib/pg-order-by-related @graphile-contrib/pg-many-to-many
to the very bottom of the Dockerfile:
If someone wants to give this a go and test the various plugins work as expected I'd appreciate it. I've added version numbers for the ~stable ones.
I'm not sure what this means for supporting this docker file; I wonder if there should be a vanilla PostGraphile image, and then a separate one with all the bells and whistles? I'm also concerned about breaking changes in the various plugins. Opinions from people more knowledgeable about Docker than myself very welcome. (I'm not very knowledgeable.)
You could potentially use ARG to add optional features in the build process, via --build-arg ARG_NAME=true.
Then you could use if [$ARG_NAME = "true"]... to run the extra commands.
There are a couple of options I can see being useful
@archlemon Thanks for sharing; I wasn't previously aware of this. So since it's at build time, maybe we need two versions: one that's small that you can customise as you need, and one that's got a load of plugins in it by default (kitchen-sink style)?
While waiting for this issue to get solved, what's the best practice for using the docker image? I'm considering just pulling the dockerfile from this repo and appending the plugins I want as you said here or is there a better way to do that with my own Dockerfile? Something like this?
FROM graphile/postgraphile
WORKDIR /postgraphile/
RUN yarn add @graphile/subscriptions-lds @graphile/pg-pubsub @graphile-contrib/pg-simplify-inflector postgraphile-plugin-connection-filter @graphile-contrib/pg-order-by-related @graphile-contrib/pg-many-to-many
@ardeaf you can use the published docker image instead of pulling the Dockerfile from here:
FROM graphile/postgraphile:v4.4.5
RUN yarn add @graphile/subscriptions-lds @graphile/pg-pubsub @graphile-contrib/pg-simplify-inflector postgraphile-plugin-connection-filter @graphile-contrib/pg-order-by-related @graphile-contrib/pg-many-to-many
@benjie it's probably very hard to include most nice to have plugins, I think including only @graphile-contrib/pg-simplify-inflector in the image should be enough. if you add more you'll have to deal with version upgrade of the plugins, conflicts, etc. it gonna take you a lot of time to maintain
instead what you might want to add a helper that install and enable plugins, eg: docker-postgraphile-plugin-install @graphile/subscriptions-lds @graphile/pg-pubsub
docker-postgraphile-plugin-enable would install them with yarn and configure the image to automatically enable the plugin (the php image has similar helpers for php extensions)
with ONBUILD it would allow to make it very simple to build a new image with additional plugins
if you have this in the Dockerfile :
ARG PLUGINS=""
ONBUILD RUN docker-postgraphile-plugin-enable $PLUGINS
you could build a new image with docker build --arg PLUGINS="postgraphile-plugin-connection-filter @graphile-contrib/pg-order-by-related @graphile-contrib/pg-many-to-many graphile/postgraphile -t my/postgraphile"
Interesting idea. And you're right about maintenance, that's one of the reasons I've not done it already.
Regarding automatically enabling, I'm thinking best bet might be to do that via the postgraphilerc file, like we already do for the host setting.
I'm closing this because I don't want to maintain it :wink: