Skip to content
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

feat: mongo replica sets #926

Merged

Conversation

thewilloftheshadow
Copy link
Contributor

This PR makes the default mongo database be initialized as a single node replica set.
Having a replica set is required for both Prisma to use MongoDB as well as using the MongoDB change streams feature.

Fixes #654

@thewilloftheshadow
Copy link
Contributor Author

I intentionally did not add a toggle to the management page for the database, only in the creation dialog, because users should not be trying to switch a mongo database back and forth without proper backups, and I feel that should be more of a manual process, or a transfer between an old and new mongo database created within Dokploy


const defaultMongoEnv = `MONGO_INITDB_DATABASE=admin\n${env ? `${env}` : ""}`;
const defaultMongoEnv = `MONGO_INITDB_ROOT_USERNAME=${databaseUser}\nMONGO_INITDB_ROOT_PASSWORD=${databasePassword}\nMONGO_INITDB_DATABASE=admin\n${env ? `${env}` : ""}`;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left the username and password env variables here at all times, but they will only be actually used when the non-replica set mode is used because the replica set initialization script does it otherwise.

@Siumauricio
Copy link
Contributor

checked={field.value}
onCheckedChange={field.onChange}
disabled
aria-readonly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
aria-readonly

Perhaps this should go too

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're at it @Siumauricio wouldn't removing this also make sense?

@Siumauricio Siumauricio merged commit 8c8ffe0 into Dokploy:canary Dec 26, 2024
@Siumauricio Siumauricio mentioned this pull request Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for mongodb replicaSets
5 participants