-
Notifications
You must be signed in to change notification settings - Fork 2
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
Initial public version of the Mongo-Initializr
#1
Conversation
86b1f4d
to
808d8b1
Compare
Added the `Mongo-Initializr` scripts and some helper scripts for building the Docker images.
808d8b1
to
cc8261a
Compare
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.
LGTM
* Remove the ARG instructions from the Dockerfile. We don't need them here. * Distinguish between the Docker entrypoint and the Mongo-Initializr script. It makes more sense to execute the Mongo-Initializr during the Docker build instead of a Docker entrypoint. * Update the README.md
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.
I tried some stuff.. mostly some formatting/linting or stuff that worked well for me in bash scripting (which makes it also more readable for non-shells scripting people).
Though I didn't do it everywhere, just when I was making a change, I updated the formatting as well.
I didn't check some Docker construct fully yet.
and fix simular issues.
And edit the README.md
1d19f16
to
7d3997f
Compare
7d3997f
to
60d56be
Compare
docker/Dockerfile.template
Outdated
COPY docker/docker-entrypoint.sh / | ||
COPY bin/ "${MI_BIN_FOLDER}" | ||
|
||
ENTRYPOINT ["/docker-entrypoint.sh"] |
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 overrides the default mongo entrypoint: https://github.com/docker-library/mongo/blob/e3137ef2ab515a4b7b02487ec72cf3a02d14b667/7.0/docker-entrypoint.sh
Which contains some fixes and workarounds and also does stuff like creating default database and user/passwords based on ENV variables. For the sake of compatibility we would need to call that one somewhere unless it breaks some of the things we do.
Our entrypoint seems to point directly to mongo-initializr.sh
. Technically we could remove ours and just use the as a CMD, or use a RUN construct as done in the example.
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.
I don't like depending on the original entrypoint script. I don't fully understand the script and I'm not sure if it can cause any problems.
We should run our script as ENTRYPOINT
.
In the original base image mongod
is set as CMD
what I would like to keep as is.
And the disadvantage of a RUN
is that it cannot be overwritten like the ENTRYPOINT
.
If this container is build using the example.. How does it start the database? |
The database is started using the CMD instruction in the mongo base image. |
If I understand correctly the CMD is passed to the entrypoint as extra arguments, which the entrypoint can choose to execute or wrap around. That's why most entrypoints end with a call like this. Overview with how ENTRYPOINT and CMD interact: Didn't know there was a difference between Though I also just read a note on that page saying it gets reset in our particular case..
|
* Use Mongo entrypoint to initialize MongoDB instead of doing it ourself. * The MI-bin, -source and -dbdata folder are not customizable anymore and located in the `/mi` root folder which is created during the Docker build stage. * We havent figured out how we still can build the database during the Docker build yet. We have therefore removed this from the `README.md`. * Fixed soms cut/paste errors. `MI_DATABASE_USERNAME` and `MI_DATABASE_PASSWORD` where not set correct.
26d043c
to
51c58b2
Compare
Make it possible to initialize the database during th docker build. During the Docker build, the Mongo database can be initialized and dumped. On startup the dumped database will be restored. The `Mongo-Initializr` script takes care of this all.
51c58b2
to
5ae8a80
Compare
@SerhatG It is now possible to initialize the database during the docker build. Can you please review the code again? |
See |
6460324
to
5da9ed1
Compare
Much has changed since first review
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.
LGTM
I don't see any apparent issues (but I also don't have a lot of shell scripting experience)
Added the
Mongo-Initializr
scripts and some helper scripts for building the Docker images.