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

Provide an LWRP and solo friendly #125

Open
wants to merge 77 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
a940a5d
Adding json file.
Feb 11, 2013
5e2828e
Adding ability to use IP addresses and define replicaset members (for…
Feb 13, 2013
c0751db
Making recipe chef-solo friendly.
Feb 13, 2013
2913c2c
Not initializing if replicaset_members is nil and we are using chef-s…
Feb 13, 2013
446b17b
Adding in the firewall recipe
Feb 13, 2013
0a4b364
Trying to fix the metadata
Feb 13, 2013
265742f
Fixing more JSON
Feb 13, 2013
2626854
json
Feb 13, 2013
f20d931
needed deleted
Feb 13, 2013
3d2f065
Adding arbiter initialization.
Feb 15, 2013
0113bd6
Make sure to add self to replicaset if not included. Add ports to rs_…
Feb 17, 2013
5f9f386
Merge pull request #1 from ryandub/master
slizadel Feb 18, 2013
3b61dac
deal with case where another server in the replcation set is already
jro Feb 26, 2013
5658efb
feed Mongo::ReplSetConnection.new the array of servers its expecting
jro Feb 26, 2013
946fea6
this isn't really an error if it's just returning the the result
jro Feb 26, 2013
6cead3a
Testing structure with `test-kitchen` 1.0
gondoi May 10, 2013
cf9b65b
Test replicaset and DRY connection
gondoi May 20, 2013
27456c4
Merge remote-tracking branch 'slizadel/master'
gondoi May 20, 2013
3095b80
Add integration group
gondoi May 20, 2013
46f6587
We depend on firewall
gondoi May 20, 2013
7088ddf
put the depends in the correct area.
gondoi May 20, 2013
90a7d24
Successful replicaset testing
gondoi May 20, 2013
6e147a7
Remove debug lines
gondoi May 20, 2013
5d41c8f
Add auth and testing
gondoi May 28, 2013
ac4f825
Merge branch 'master' of https://github.com/edelight/chef-mongodb
gondoi May 28, 2013
6d646ac
Don't lock cookbooks for development
gondoi May 28, 2013
e1c8dbf
The keyring string must be defined to be used
gondoi May 29, 2013
b2df549
Error on missing attribute
gondoi May 29, 2013
896b78e
Update metadata
gondoi May 29, 2013
acf20cd
Updated docs
gondoi May 29, 2013
a8071b9
Dependencies added to metadata
gondoi May 29, 2013
2db9b46
Merge remote-tracking branch 'gondoi/master'
gondoi May 29, 2013
3c9e763
New Berksfile syntax
gondoi May 29, 2013
fd3a2fc
Remove string from attribute and not require auth
gondoi May 29, 2013
52ce273
Add firewall recipe only when needed
gondoi May 29, 2013
20ca2a0
Version bump
gondoi May 29, 2013
0d56c97
That restriction is old and we can use the latest
gondoi May 29, 2013
c24b3b1
Remove recipes from search.
Jun 13, 2013
a947a99
bump version.
Jun 13, 2013
f275fe5
Merge pull request #1 from ryandub/master
gondoi Jun 13, 2013
5d872e6
Adding json file.
Feb 11, 2013
3a3136c
Adding ability to use IP addresses and define replicaset members (for…
Feb 13, 2013
8d79077
Making recipe chef-solo friendly.
Feb 13, 2013
3f46de0
Not initializing if replicaset_members is nil and we are using chef-s…
Feb 13, 2013
45bb770
Adding in the firewall recipe
Feb 13, 2013
10ce67b
Trying to fix the metadata
Feb 13, 2013
314f996
Fixing more JSON
Feb 13, 2013
5fff14c
json
Feb 13, 2013
2286649
needed deleted
Feb 13, 2013
e3ca097
Adding arbiter initialization.
Feb 15, 2013
8218e0b
Make sure to add self to replicaset if not included. Add ports to rs_…
Feb 17, 2013
8018bd2
Testing structure with `test-kitchen` 1.0
gondoi May 10, 2013
8dc9903
Test replicaset and DRY connection
gondoi May 20, 2013
dfd1249
Add integration group
gondoi May 20, 2013
00830dc
We depend on firewall
gondoi May 20, 2013
497c292
put the depends in the correct area.
gondoi May 20, 2013
4609fc1
Successful replicaset testing
gondoi May 20, 2013
25bc1c5
Remove debug lines
gondoi May 20, 2013
8bc58dc
Add auth and testing
gondoi May 28, 2013
f0ad9e0
Don't lock cookbooks for development
gondoi May 28, 2013
826411c
The keyring string must be defined to be used
gondoi May 29, 2013
4b1f66f
Error on missing attribute
gondoi May 29, 2013
a9c956c
Update metadata
gondoi May 29, 2013
466e5c5
Updated docs
gondoi May 29, 2013
4b582b2
Dependencies added to metadata
gondoi May 29, 2013
13495e8
New Berksfile syntax
gondoi May 29, 2013
e14feb4
Remove string from attribute and not require auth
gondoi May 29, 2013
488932d
Add firewall recipe only when needed
gondoi May 29, 2013
cd683df
Version bump
gondoi May 29, 2013
48a8b10
That restriction is old and we can use the latest
gondoi May 29, 2013
1441b6f
bump version.
Jun 13, 2013
4da3ee7
Merge branch 'master' into jro-replicate_init_breaks_past_second_node
Jun 14, 2013
31d324c
Bump version.
Jun 14, 2013
01aa3cf
Fix syntax error from merging.
Jun 14, 2013
5976120
Merge branch 'ryandub-master'
gondoi Jun 17, 2013
077385d
Update search to only include nodes with mongodb recipes.
Jul 23, 2013
8331312
Merge pull request #4 from ryandub/master
gondoi Sep 19, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
build
.kitchen/
.kitchen.local.yml
.vagrant
Berksfile.lock
*~
*#
.#*
\#*#
.*.sw[a-z]
*.un~
/cookbooks

# Bundler
Gemfile.lock
bin/*
.bundle/*
66 changes: 44 additions & 22 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,54 @@ driver_config:
platforms:
- name: ubuntu-12.04
driver_config:
box: opscode-ubuntu-12.04
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box
box: vagrant-ubuntu-12.04
box_url: http://files.vagrantup.com/precise64.box
require_chef_omnibus: true
run_list:
- "recipe[apt]"
- recipe[apt]
- name: ubuntu-10.04
driver_config:
box: opscode-ubuntu-10.04
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_provisionerless.box
box: vagrant-ubuntu-10.04
box_url: http://files.vagrantup.com/lucid64.box
require_chef_omnibus: true
run_list:
- "recipe[apt]"
- name: centos-6.4
driver_config:
box: opscode-centos-6.4
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box
run_list:
- "recipe[yum]"
- name: centos-5.9
driver_config:
box: opscode-centos-5.9
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-5.9_provisionerless.box
run_list:
- "recipe[yum]"
- recipe[apt]
# - name: centos-6.3
# driver_config:
# box: opscode-centos-6.3
# box_url: http://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-6.3_chef-11.2.0.box
# run_list:
# - recipe[yum]
# - name: centos-5.8
# driver_config:
# box: opscode-centos-5.8
# box_url: http://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-5.8_chef-11.2.0.box
# run_list:
# - recipe[yum]

suites:
- name: default
- name: mongo
run_list:
- recipe[build-essential]
- recipe[mongodb::10gen_repo]
- recipe[mongodb]
- recipe[mongo_test]
attributes:
build_essential:
compiletime: true
mongodb:
auth: true
- name: replicaset
run_list:
- "recipe[mongodb::10gen_repo]"
- "recipe[mongodb]"
attributes: {}
- recipe[build-essential]
- recipe[mongodb::10gen_repo]
- recipe[mongodb]
- recipe[mongodb::replicaset]
- recipe[mongo_test]
attributes:
mongodb:
cluster_name: clustrname
replicaset_name: replset
replicaset_members:
- 127.0.0.1
auth: true
4 changes: 4 additions & 0 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
site :opscode

metadata

group :integration do
cookbook 'mongodb_test', path: './test/cookbooks/mongo_test'
end
14 changes: 0 additions & 14 deletions Berksfile.lock

This file was deleted.

60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@ of a sharded setup.

For examples see the USAGE section below.

# LWRP:

This cookbook defines the LWRP `mongodb_user` to manage users and authentication
in mongodb.

For examples see the USAGE section below.

# ATTRIBUTES:

* `mongodb[:auth]` - Enable or disable auth
* `mongodb[:keyfile]` - keyFile contents for auth w/ replicasets
* `mongodb[:dbpath]` - Location for mongodb data directory, defaults to "/var/lib/mongodb"
* `mongodb[:logpath]` - Path for the logfiles, default is "/var/log/mongodb"
* `mongodb[:port]` - Port the mongod listens on, default is 27017
Expand Down Expand Up @@ -139,6 +148,57 @@ nodes which should be in the same replicaset have the same shard name.

For more details, you can find a [tutorial for Sharding + Replication](https://github.com/edelight/chef-mongodb/wiki/MongoDB%3A-Replication%2BSharding) in the wiki.

## Authentication LWRP

To enable authentication on a database, you need to enable authentication by
setting the `auth` attribute to true

```json
{
"mongodb": {
"auth": true
}
}
```

If you are using replicasets, you only need to define the keyFile secret string.

```json
{
"mongodb": {
"keyfile": "5UJ1aZngn9OM/YN0IsiivhQUmGY..."
}
}
```

The keyFile contents is arbitrary, but a long string is suggested. `openssl` can be used to generate a good string:

```bash
$ openssl rand -base64 753
```

```ruby
require 'openssl'

default['mongodb']['keyfile'] = ::OpenSSL::Random.random_bytes(753).gsub(/\W/, '')
```

Once authentication has been enabled, you can then define users simply by including
`mongodb` in the run list and defining your user.

```ruby
mongodb_user "someguy" do
password "n0ts3cur3"
database "gbs_for_dbs"
end
```

Actions available:

* `:add` - default
* `:delete`
* `:update`

# LICENSE and AUTHOR:

Author:: Markus Korn <[email protected]>
Expand Down
6 changes: 6 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,22 @@
# limitations under the License.
#

default[:mongodb][:auth] = false
default[:mongodb][:keyfile] = nil
default[:mongodb][:dbpath] = "/var/lib/mongodb"
default[:mongodb][:logpath] = "/var/log/mongodb"
default[:mongodb][:use_fqdn] = true
default[:mongodb][:bind_ip] = nil
default[:mongodb][:port] = 27017
default[:mongodb][:configfile] = nil

default[:mongodb][:fqdn_interface] = nil

# cluster identifier
default[:mongodb][:client_roles] = []
default[:mongodb][:cluster_name] = nil
default[:mongodb][:replicaset_name] = nil
default[:mongodb][:replicaset_members] = nil
default[:mongodb][:shard_name] = "default"

default[:mongodb][:auto_configure][:replicaset] = true
Expand Down
96 changes: 96 additions & 0 deletions chefignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Put files/directories that should be ignored in this file when uploading
# or sharing to the community site.
# Lines that start with '# ' are comments.

# OS generated files #
######################
.DS_Store
Icon?
nohup.out
ehthumbs.db
Thumbs.db

# SASS #
########
.sass-cache

# EDITORS #
###########
\#*
.#*
*~
*.sw[a-z]
*.bak
REVISION
TAGS*
tmtags
*_flymake.*
*_flymake
*.tmproj
.project
.settings
mkmf.log

## COMPILED ##
##############
a.out
*.o
*.pyc
*.so
*.com
*.class
*.dll
*.exe
*/rdoc/

# Testing #
###########
.watchr
.rspec
spec/*
spec/fixtures/*
test/*
features/*
Guardfile
Procfile

# SCM #
#######
.git
*/.git
.gitignore
.gitmodules
.gitconfig
.gitattributes
.svn
*/.bzr/*
*/.hg/*
*/.svn/*

# Berkshelf #
#############
Berksfile
Berksfile.lock
cookbooks/*
tmp

# Cookbooks #
#############
CONTRIBUTING
CHANGELOG*

# Strainer #
############
Colanderfile
Strainerfile
.colander
.strainer

# Vagrant #
###########
.vagrant
Vagrantfile

# Travis #
##########
.travis.yml
Loading