Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Commit 29d9576

Browse files
committed
cleanup todos and add lone + gh release
1 parent a1a25fa commit 29d9576

4 files changed

Lines changed: 44 additions & 50 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules/
33
.dist/
44
.build/
55
npm-debug.log
6+
.lone/

README.md

Lines changed: 20 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -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

gulpfile.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
var gulp = require('gulp'),
22
path = require('path'),
3-
exec = require('child_process').exec;
3+
exec = require('child_process').exec,
4+
release = require('github-release'),
5+
pkg = require('./package.json');
6+
7+
gulp.task('dist', ['upload']);
8+
9+
gulp.task('build', function(cb){
10+
exec('./node_modules/.bin/lone', function(err){
11+
if(err) return cb(err);
12+
cb();
13+
});
14+
});
15+
16+
gulp.task('upload', ['build'], function(){
17+
return gulp.src('./.lone/dist/*').pipe(release(pkg));
18+
});
19+
420

521
gulp.task('keyfile', function(done){
622
var key = path.resolve('./keys/mongodb-keyfile');

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
"author": "Lucas Hrabovsky <hrabovsky.lucas@gmail.com> (http://imlucas.com)",
55
"description": "Starts all of the deployment types for testing",
66
"scripts": {
7-
"test": "mocha -R spec --timeout 60000"
7+
"test": "mocha -R spec --timeout 60000",
8+
"build": "gulp build",
9+
"dist": "gulp dist",
10+
"start": "DEBUG=* ./bin/mongodb-runner.js"
811
},
912
"bin": {
1013
"mongodb-runner": "./bin/mongodb-runner.js"
@@ -33,6 +36,8 @@
3336
"yargs": "^1.2.6"
3437
},
3538
"devDependencies": {
39+
"github-release": "^0.1.0",
40+
"lone": "^0.3.2",
3641
"mocha": "^1.20.1"
3742
}
3843
}

0 commit comments

Comments
 (0)