Deploying a plugin / custom deployment with Docker


#1

Hi, I have an automated docker deployment setup deploying reactioncommerce/reaction:latest
But I want to add in plugins/themes.

So my options are to:

Fork reactioncommerce/reaction and create new docker images in dockerhub.

or I was thinking i could paste my plugin files into the meteor build after docker has downloaded the repo but before reaction is run. Looking at the docker file in base it may be hard to get something to happen between scripts.

Any help would be great thanks


#2

You can run reaction init to start a new local project in development, then add your custom plugin(s) to /imports/plugins/custom. When you run reaction locally in development or do a docker build ... your plugin will get loaded and built just like the internal plugins do.

You can check out the example plugin to see the standard structure.

Essentially, you just need to add one (or all) of the following files and the plugin loader will import them automatically…

your-plugin/client/index.js
your-plugin/server/index.js
your-plugin/register.js

Also, see the accompanying docs for creating plugins/themes.

https://docs.reactioncommerce.com/reaction-docs/master/tutorial


#3

i don’t understand how this works on my sever though ? At the moment I upload a docker file and my server pulls reaction and builds/runs it. How can my plugin get inside that process ?

And do i have to fork the reactioncommerce/reaction as well to create custom plugins ? Because reaction init sets up gitignore files so that none of the reaction code gets pushed to my repo… ? (This also stops me from team work with plugins). I’m still trying (struggling) to understand the layout of reaction.


#4

don’t worry i think i have most of this sorted now.


#5

How did you solve it?

Ideally, I’d like to use the Dockerfile approach and add plugins afterwards, maybe from a repo or something.

Would you like to share how your process looks like?

Thanks!


#6

I ended up forking the reaction repo, then adding in plugins. Then building my own docker image and deploying that. I think that is the normal way to go about this.

However it could also be possible to use docker to add in a step between line 22 and 60 of this file executes in the base image here:
_…github.com/reactioncommerce/base/blob/master/Dockerfile

…maybe make a .sh file that install git and pulls code from your repo and dumps it in the correct place in the $APP_SOURCE_DIR. I think you would need to ask someone who is really good with docker if it is possible with out modifying the base image.