saltstack-formulas / mongodb-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
31 stars 120 forks source link

Question about best practices with this formula #56

Closed sethcenterbar closed 4 years ago

sethcenterbar commented 5 years ago

I think I'm realizing that this formula was set up with batteries included, and that's why I'm having a hard time with it.

In my environment, I would like to set up mongod in a 3 node replica set, but I don't need sharding or the BI connector.

Say I want to override that behavior, and simply give a replset name, and not set up sharding or BI. Could somebody help me with an example pillar set up?

Edit: Am I correct to assume that the hard-coding of svc in https://github.com/saltstack-formulas/mongodb-formula/blob/master/mongodb/server/config.sls means that what I'm asking for isn't possible from a pillar config?

noelmcloughlin commented 5 years ago

Hi @sethcenterbar Your comment suggests a small PR is badly needed.

1) Remove - mongodb.bic from init.sls so only mongoDB is installed by default. 2) Correct the README accordingly (i.e. mongodb.init is not metastate anymore) 3) Remove hardcoded list/tuple from L45 so svc iterates over mongod only (no mongos).

Meanwhile, according to the README themongodb.server state will not install BI.

Deploy and configure MongoDB "Community Server" and start 'mongos' and 'mongod' services.

But hardcoding of L45 is not best practice - no arguments there and only PR can fix.

I think this formula can be improved by splittingmongodb.server.init.sls and mongodb.server.config into two distinct state directories.

- mongodb-formula/mongodb/mongod/ . (init.sls, clean.sls, config.sls)
- mongodb-formula/mongodb/mongos/ . (init.sls, clean.sls, config.sls)
sethcenterbar commented 5 years ago

I'm interested at taking a stab at it, hopefully this week. I don't have much experience making changes to formulas (especially those other people rely on), but I'll play around with your tests and do my best.

noelmcloughlin commented 5 years ago

Great @sethcenterbar it would be appreciated if you have a go. We'll work through it together.

noelmcloughlin commented 5 years ago

Hi @sethcenterbar I added robo3t state to the formula. Hope you find it useful.

sethcenterbar commented 5 years ago

Hey @noelmcloughlin, I apologize for not being more responsive. Had some opportunities come up the last week or so that have drained my time. Going to put in some work this weekend and see what we can do!

noelmcloughlin commented 5 years ago

No problem @sethcenterbar

andrew-vant commented 5 years ago

I'm having a similar issue -- there's no way to set up a minimal non-sharding replica set. defaults.yaml's server:mongod:conf dict should probably either match whatever comes stock with the package, or only set the minimum options needed to get started. Or default to empty, if mongod can start that way.

(To some extent that's upstream's fault, not yours. I could override the defaults if there was an explicit "sharding off" setting for the sharding:clusterRole option, but there isn't.)

noelmcloughlin commented 4 years ago

Please retry with new release - Hopefully fixed by #83