Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

TimJones
Copy link

@TimJones TimJones commented Jan 5, 2017

Adds a Dockerfile for publishing a Docker container of the application.

Copy link
Contributor

@dbmurphy dbmurphy left a 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?

@TimJones
Copy link
Author

TimJones commented Jan 5, 2017

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 $ docker run --rm --volume $(pwd):/backup mongodb_consistent_backup --location /backup ...

@fruitl00p
Copy link

@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 ;)

@TimJones
Copy link
Author

TimJones commented Jan 5, 2017

Forgot to add: configuration is provided by command-line parameters, or by mapping an external configuration file into the container.

@timvaillancourt
Copy link
Contributor

Funny enough, I also made a Dockerfile last night for this project. LGTM

@timvaillancourt
Copy link
Contributor

timvaillancourt commented Jan 5, 2017

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/

@TimJones
Copy link
Author

TimJones commented Jan 5, 2017

@timvaillancourt How does the mongo_consistent_backup script call mongodump, I couldn't find it in your container?

@timvaillancourt
Copy link
Contributor

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.

@TimJones
Copy link
Author

TimJones commented Jan 5, 2017

@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 :)

@timvaillancourt
Copy link
Contributor

timvaillancourt commented Jan 5, 2017

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/

@timvaillancourt
Copy link
Contributor

timvaillancourt commented Jan 6, 2017

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.

@timvaillancourt timvaillancourt mentioned this pull request Jan 11, 2017
@dbmurphy dbmurphy closed this Jan 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants