Skip to content

Commit 4e6c174

Browse files
committed
Add binary file
1 parent a81f3bf commit 4e6c174

File tree

6 files changed

+170
-10
lines changed

6 files changed

+170
-10
lines changed

LICENSE

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Evan Huang
3+
Copyright (c) 2015 Epharmix <[email protected]>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-

README.md

+108-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,109 @@
1-
### Toureiro
1+
# Toureiro
22

3-
========
3+
A graphical monitoring interface for the distributed job queue [bull](https://github.com/OptimalBits/bull) built using `express` and `react`. Toureiro provides simple monitoring features as well as the ability to promote delayed jobs directly.
4+
5+
## Screenshots
6+
7+
## Get Started
8+
9+
First install `toureiro` from `npm`.
10+
11+
```
12+
npm install toureiro
13+
```
14+
15+
You can then use `toureiro` in your project. The constructor `toureiro()` will return an `express` app, which you can then have it listen to any port you desire:
16+
17+
```javascript
18+
var toureiro = require('toureiro');
19+
var app = toureiro();
20+
var server = app.listen(3000, function() {
21+
console.log('Toureiro is now listening at port 3000...');
22+
});
23+
```
24+
25+
Or you can mount it to a subpath for your own `express` server:
26+
27+
```javascript
28+
var express = require('express');
29+
var toureiro = require('toureiro');
30+
31+
var app = express();
32+
/**
33+
* Your own setup...
34+
*/
35+
app.use('/toureiro', toureiro());
36+
37+
var server = app.listen(8080);
38+
```
39+
40+
You can also run `toureiro` as a standalone program:
41+
42+
```bash
43+
> toureiro
44+
Toureiro is now listening at port 3000...
45+
```
46+
47+
## Config
48+
49+
By default, `toureiro` will try to connect to the redis db #0 at 127.0.0.1:6379, but you can configure it yourself:
50+
51+
```javascript
52+
var app = toureiro({
53+
// Options to be passed directly to redis.createClient(),
54+
// see https://github.com/NodeRedis/node_redis#rediscreateclient
55+
redis: {
56+
// Redis host
57+
host: '127.0.0.1',
58+
// Port
59+
port: 6379
60+
// DB number
61+
db: 1
62+
// Other redis options...
63+
}
64+
});
65+
```
66+
67+
## Usage
68+
69+
```
70+
71+
```
72+
73+
## Why Bull?
74+
75+
Distributed task queue is a necessity in a lot of use cases. Among all the queues out there, [Celery](http://www.celeryproject.org/) is probably the most prominent and has the biggest community. However, it's hard to integrate `Celery` into the Node.js programs, simply because that's another language environment to maintain. Therefore, a javascript native task queue is much needed.
76+
77+
Among the queues written for `javascript`, [Kue](https://github.com/Automattic/kue.git) is the most widely used one. `Kue` is a great library, and we have relied heavily on `Kue` before, but we are gradually troubled by the various bugs of the library. Due to the time when `Kue` was first written, a lot of things weren't possible (for example, atomicity of complex `redis` operations, which is now enabled by the built-in `LUA` scripting engine). What's more, several important features (FIFO behavior of delayed jobs, for instance) are missing from `Kue` or are hard to implement due to the early design decisions.
78+
79+
Then `bull` came along. It's written by the guys from OptimalBits and its APIs are modeled heavily after those of `Kue`. In its core, however, it's written very carefully (and differently from `Kue`) to ensure robustness and atomicity. Bugs that are common to distributed queue designs are not found with `bull` or have been fixed along the way.
80+
81+
As awesome as `bull` is, the only thing that is missing is a web monitoring interface, much like that of `Kue`, so we decided to make our own, thus `toureiro` is born.
82+
83+
## Browser Compatibility
84+
85+
It's compatible with all modern browsers. Since the front end relies on `react`, and `react` does support all the way down to IE8, it's possible that IE8 will work as well, though with messy styles.
86+
87+
## License
88+
89+
The MIT License (MIT)
90+
91+
Copyright (c) 2015 Epharmix <[email protected]>
92+
93+
Permission is hereby granted, free of charge, to any person obtaining a copy
94+
of this software and associated documentation files (the "Software"), to deal
95+
in the Software without restriction, including without limitation the rights
96+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
97+
copies of the Software, and to permit persons to whom the Software is
98+
furnished to do so, subject to the following conditions:
99+
100+
The above copyright notice and this permission notice shall be included in all
101+
copies or substantial portions of the Software.
102+
103+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
104+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
105+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
106+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
107+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
108+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
109+
SOFTWARE.

bin/toureiro.js

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env node
2+
3+
var minimist = require('minimist');
4+
var toureiro = require('../lib/toureiro');
5+
6+
var argv = minimist(process.argv.slice(2));
7+
8+
if (argv.h || argv.help) {
9+
console.log('Usage: toureiro [port]');
10+
console.log('[port] Port for toureiro to listen to');
11+
console.log('Options:');
12+
console.log('--rh Redis host, default to 127.0.0.1');
13+
console.log('--rp Redis port, default to 6379');
14+
console.log('--rdb Redis database number, default to 0');
15+
console.log('--pass Redis password, default to null');
16+
process.exit(0);
17+
}
18+
19+
var port = 3000;
20+
if (argv._.length > 0 && !isNaN(parseInt(argv._[0]))) {
21+
port = parseInt(argv._[0]);
22+
}
23+
var redisHost = '127.0.0.1';
24+
if (argv.rh) {
25+
redisHost = argv.rh;
26+
}
27+
var redisPort = 6379;
28+
if (argv.rp && !isNaN(parseInt(argv.rp))) {
29+
redisPort = argv.rp;
30+
}
31+
var redisDB = 0;
32+
if (argv.rdb && !isNaN(parseInt(argv.rdb))) {
33+
redisDB = argv.rdb;
34+
}
35+
var redisPass = null;
36+
if (argv.pass) {
37+
redisPass = argv.pass;
38+
}
39+
40+
var app = toureiro({
41+
redis: {
42+
host: redisHost,
43+
port: redisPort,
44+
auth_pass: redisPass,
45+
db: redisDB
46+
}
47+
});
48+
var server = app.listen(port, function() {
49+
console.log('Toureiro is now listening at port', port, '...');
50+
});

lib/toureiro.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ module.exports = function(config) {
3030
res.sendStatus(404);
3131
});
3232

33-
var server = app.listen(config.port || 3000, function() {
34-
console.log('Toureiro is now listening at port', server.address().port, '...');
35-
});
33+
return app;
3634

37-
};
35+
};

package.json

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"jade": "1.11.x",
3636
"jquery": "2.1.x",
3737
"lodash": "3.10.x",
38+
"minimist": "1.2.x",
3839
"moment-timezone": "0.4.x",
3940
"react": "0.13.x",
4041
"redis": "2.1.x"
@@ -56,5 +57,8 @@
5657
"vinyl-buffer": "1.0.x",
5758
"vinyl-source-stream": "1.1.x",
5859
"watchify": "3.4.x"
60+
},
61+
"bin": {
62+
"toureiro": "./bin/toureiro.js"
5963
}
6064
}

server.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
require('./lib/toureiro')({
1+
var app = require('./lib/toureiro')({
22
redis: {
33
db: 1
44
}
5-
});
5+
});
6+
var server = app.listen(3000, function() {
7+
console.log('Toureiro is now listening at port 3000...');
8+
});

0 commit comments

Comments
 (0)