More of some questions really...
- Currently there are multiple dockerfiles in the /.docker folder - however it might be an idea to build a multi stage build with named targets? you could pass the environment name through and get the appropriate image from the build.
- Installation notes say I have to install a node environment to build the code before packaging - but this could be solved using the multistage build process.
- I found the inclusion of pm2 confusing - I wasn't sure that it added anything that you don't already get from the docker container restart policies - We could remove this right and use the restart policies right? If we could remove the pm2 use, then this would simplify the build image (particularly for production).
- Found it strange that the secrets were only used to set the password for mongo - when they should also be used to configure the node containers (?)
Thanks Mike! All great observations. Most of what you're seeing there is due to some legacy things I have to support (from older days & older video courses that people still watch). Everything you suggested looks like great updates though.
I'm not going to be able to get to these any time soon but if you ever get bored and have time for a PR let me know and we can work to update these. At this point I'm OK breaking some of the legacy content found in older courses (I think anyway :-)).
Thanks again for making time to comment Mike. I've been thinking through what I can (and can't) change based on some training support I have to maintain and came up with the following.
- Multiple dockerfiles - I'll have to leave that for the time being. Too many references to the specific files in other training content (classes and video courses).
- Node is only needed if running in "dev" mode since that uses volumes. It would be required in that case since npm install is still needed when running in dev mode to get the node_modules in place. It's not needed when doing a "production" build.
- PM2 has been removed (left some "legacy" comments in there).
- For secrets, the goal is to keep things really simple and make setup as easy as possible (multiple courses tie into this for various examples). The node containers could definitely pull from secrets when in Kubernetes. I don't have the bandwidth right now to refactor that since a config manager is used to load JSON throughout the app, but I'll keep that on the "future updates" list.
Thanks again for the feedback. Appreciate it.