sc-MongoDB Cookbook
April 30, 2026 ยท View on GitHub
Provides custom resources for installing and configuring MongoDB Community Edition.
Requirements
Chef Infra Client
Chef Infra Client 15.3 or later.
Platforms
This cookbook targets MongoDB 8.0 Community packages on the platforms listed in metadata.rb.
See LIMITATIONS.md for current vendor package limitations.
Breaking Migration
This cookbook is now a custom-resource cookbook. It no longer ships public recipes, attributes, or definitions. Existing users must move recipe and node-attribute usage into wrapper cookbook resource declarations.
See migration.md for mapping examples.
Resources
- mongodb_repository
- mongodb_install
- mongodb_config
- mongodb_service
- mongodb_instance
- mongodb_replicaset
- mongodb_sharding
- mongodb_ruby_gems
- mongodb_agent
- mongodb_user
Examples
Single Instance
mongodb_instance 'mongod' do
version '8.0'
action :create
end
Custom Configuration
mongodb_instance 'mongod' do
config(
'net' => {
'bindIp' => '127.0.0.1',
'port' => 27_017,
},
'storage' => {
'dbPath' => '/srv/mongodb',
}
)
end
Replicaset
mongodb_replicaset 'rs_default' do
auto_configure false
end
Mongos
mongodb_sharding 'router' do
role 'mongos'
config(
'sharding' => {
'configDB' => 'cfg1.example.com:27019,cfg2.example.com:27019,cfg3.example.com:27019',
}
)
auto_configure false
end
Agent
mongodb_agent 'monitoring' do
api_key 'api-key'
end
User
mongodb_ruby_gems 'mongo driver'
mongodb_user 'app' do
password 'secret'
roles ['readWrite']
database 'app'
end
Maintainers
This cookbook is maintained by the Sous Chefs. For more information, visit sous-chefs.org or the Chef Community Slack #sous-chefs.
Contributors
This project exists thanks to all the people who contribute.
Backers
Thank you to all our backers.
Sponsors
Support this project by becoming a sponsor.