@@ -7,37 +7,37 @@ Starts all of the deployment types for testing by piping to `mongo` shell.
77## Example
88
99``` javascript
10- var runner = require (' mongodb-runner' );
10+ var mongodb = require (' mongodb-runner' );
1111
12- // Start a standalone, replica set, and cluster
12+ // Start a standalone, standalone with auth, replica set, and cluster
1313// process.env.DEBUG = 'mongodb*'; // uncomment me to get stdout from shell commands
14- runner . listen (function (err ){
14+ mongodb (function (err ){
1515 if (err) return console .error (' Uhoh...' , err);
1616 console .log (' MongoDB deployments for testing ready!' );
1717 // do tests and stuff
1818 // all processes started by runner will be SIGTERM'd when this process exits.
1919});
2020
2121// start just a standalone
22- runner ({port: 27018 , dbpath: ' /ebs/data/' + process .env .JOB_ID + ' _standalone' }, function (err ){
22+ mongodb ({port: 27018 , dbpath: ' /ebs/data/' + process .env .JOB_ID + ' _standalone' }, function (err ){
2323 if (err) return console .error (' Uhoh...' , err);
2424 console .log (' Standalone ready on localhost:27018!' );
2525});
2626
2727// just a replicaset
28- runner . replicaset ( {name: ' replicom' , instances: 3 , startPort: 6000 }, function (err ){
28+ mongodb ( ' replicaset ' , {name: ' replicom' , instances: 3 , startPort: 6000 }, function (err , res ){
2929 if (err) return console .error (' Uhoh...' , err);
30- console .log (' replicaset ready!' );
31- console .log (' primary: localhost:6000' );
32- console .log (' secondaries: localhost:6001, localhost:6002' );
30+ console .log (' replicaset ready!' , res .uri );
3331});
32+ ```
33+
34+ ### Shell
3435
35- // just a cluster
36- runner .replicaset ({db: ' clusterco' , collection: ' users' , shards: 2 }, function (err ){
37- if (err) return console .error (' Uhoh...' , err);
38- console .log (' clusterco ready to be tested!' );
39- });
4036```
37+ npm install -g mongodb-runner
38+ DEBUG=* mongodb-runner
39+ ```
40+
4141
4242## Under the hood
4343
@@ -62,41 +62,13 @@ shell('var opts = {name: \''+opts.name+'\', nodes: '+opts.instances+', useHostNa
6262
6363## Todo
6464
65- - [ ] Integrate @imlucas/mongodb-bridge fully as a option ` bridge: true `
66- - [ ] Use lone to prebake binaries and upload to releases
67- - [ ] Make mongodb-bridge capable of reconfiguring oplog.rs automatically [ per kristina's example] ( http://www.kchodorow.com/blog/2011/04/20/simulating-network-paritions-with-mongobridge/ )
68- - [ ] ` mongodb-runner killall ` for cross platform kill mongod|mongos
69- - [ ] ` mongodb-runner startall ` should fork when everything started
70- - [ ] mongodb-runner keeps pid files in ` {cwd}/.mongodb/pids ` for safe
71- startall and killall
72- - [ ] ALL ci tasks can then just be:
73- ```
74- mongodb-runner startall && mongorella test && mongodb-runner killall
75- ```
76- - [ ] Option for version, integrated with @imlucas/mongodb-version-manager
77- - [ ] Support auth
78-
79- ## Auth
80-
81-
82- ```
83- # Start mongod
84-
85- mongod --keyFile keyFile/1 --setParameter "enableLocalhostAuthBypass=1"
86-
87- # Create a root user
88- db.getMongo().getDB('admin').createUser({user: 'root', pwd: 'password', roles: [ 'root'] });
89-
90-
91- var opts = {
92- dbpath: '~ /.mongodb/data/auth-basic',
93- port: 27001,
94- host: 'localhost',
95- keyFile: __ dirname + '/keyFile/1'
96- };
97- ```
98-
99- mongo localhost:27001 -u root -p password --authenticationDatabase admin
65+ - [x] use lone to prebake binaries and upload to releases
66+ - [x] support auth
67+ - [ ] HTTP control like mongodb-bridge
68+ - [ ] option for version, integrated with @imlucas/mongodb-version-manager
69+ - [ ] integrate @imlucas/mongodb-bridge fully as a option ` bridge: true ` .
70+ make mongodb-bridge capable of reconfiguring oplog.rs automatically
71+ [ per kristina's example] ( http://www.kchodorow.com/blog/2011/04/20/simulating-network-paritions-with-mongobridge/ )
10072
10173## License
10274
0 commit comments