-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Added MONGO_REPLICASET for support to connect to existing replicaset #69
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.
Thanks for opening this pull request! Be sure to follow the pull request template!
I am a bot, here is the pushed image/manifest for this PR:
|
This pull request has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions. |
I am a bot, here is the pushed image/manifest for this PR:
|
Thanks for the PR, but I feel like this is such a niche case that it is best set up via editing the system.properties file. This is likely to confuse new users greatly and create a significant support burden for our team. Folks are already having a really hard time getting this up and running even with a single mongodb instance and with us providing the init script. We can't afford to complicate it any further. That's just my opinion, though. I'll let the maintainer make the final decision. |
@aptalca I am happy to contribute. And thank you for providing awesome containers. I understand your concern, and I don't wish to increase the time you put on support. Just a suggestion. But I understand if you decide not to. |
I am a bot, here is the pushed image/manifest for this PR:
|
I am a bot, here is the pushed image/manifest for this PR:
|
I have had issues twice with mongodb getting corrupted due to ungraceful shutdown when running in standalone mode. A replica set would definitely help with such cases. Thankfully i had config backups and i was able to restore but definitely not a fun time... I would support this as a more robust solution, mongodb is not recommended to run in standalone configuration apart for development or testing as it is a single point of failure. I understand that this would add complexity for novice users, but as @rundqvist mentioned it can be added as an optional or advanced feature. |
If you want multiple mongodb instances, you can edit the The init we provide only works on first boot anyway. If one wants to change the mongodb details later (password, address, etc), they have to edit the There is very little benefit in having our first time only init support a replica setup. But there are huge risks: 1. Code is much more complicated with a larger potential for bugs, 2. Promoting that to a general audience is a support nightmare. |
Description:
Added new environment variable,
MONGO_REPLICASET
, that if set adds "replicaSet=[replicaset value]" to the connection string. It (if set) also reads the existingMONGO_HOST
andMONGO_PORT
as comma separated strings to be able to add all databases participating in the replicaset + checks that there are equal number of values in each variable.Connection test on all nodes are performed.
Benefits of this PR and context:
If one has an existing replicaset it was not possible to add all hosts to the connection string via environment variables. You had to manually edit system.properties and add the compatible connection string.
How Has This Been Tested?
I have tested:
Developing/testing on a Mac running Ventura.
Source / References: