-
Notifications
You must be signed in to change notification settings - Fork 81
Dockerize app #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerize app #59
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This item is a bit perplexing to me as you would be providing no configuration and the backups should be run from something with a good deal of storage. Due to this is docker a good course of action?
It is simply to have a containerised deployment of the app, as I would like to launch this as a job from our Kubernetes cluster. The backup location can be mapped to an external volume with lots of space at run-time. For example, I run this with |
@TimJones I was looking into this as well. @dbmurphy This allows the backups to be created with a single command accross nodes that might not have the full mongo (already) there (aside from the kubernetes / mesos) usage... I threw this (https://github.com/fruitl00p/mongodb_consistent_backup-docker) together to achieve the same thing ;) |
Forgot to add: configuration is provided by command-line parameters, or by mapping an external configuration file into the container. |
Funny enough, I also made a Dockerfile last night for this project. LGTM |
You can see my Dockerfile here: https://github.com/timvaillancourt/mongodb_consistent_backup/tree/dockerfile_v1/Dockerfile. It's a bit simpler because it relies on the project being built outside of the image with "make docker" (added to Makefile: https://github.com/timvaillancourt/mongodb_consistent_backup/blob/dockerfile_v1/Makefile#L28-L29). Dockerhub: https://hub.docker.com/r/timvaillancourt/mongodb_consistent_backup/ |
@timvaillancourt How does the mongo_consistent_backup script call mongodump, I couldn't find it in your container? |
Good catch @TimJones, it looks like I didn't commit my change to install mongodump! I'll add that so we can compare which approach is best. |
@timvaillancourt I'm not familiar with pex, but if the resulting binary is static, I prefer your approach. The smaller the end container the better :) |
Yes @TimJones, pex contains all dependencies minus Python itself - very cool tool! This allows a very thin container. I've committed that change, now mongodump 3.2 is installed (3.2 so we get threading on backups): https://github.com/timvaillancourt/mongodb_consistent_backup/tree/dockerfile_v1/Dockerfile I have also pushed this to dockerhub: https://hub.docker.com/r/timvaillancourt/mongodb_consistent_backup/ |
I've realised I've made a poor assumption in my Dockerfile: while pex does build binaries with all python dependencies contained, some of those dependencies have linkages to C-based libraries on the host. This means that copying the binary into the Docker image is a bad idea as it could build on a different OS than what is inside the Docker, causing C-level linkages to libraries that may be different. This means we should build the whole project in Docker, like @TimJones did to begin with. Hopefully there are ways to trim down the image post-build to still make it thin. |
Adds a Dockerfile for publishing a Docker container of the application.