@@ -5,14 +5,12 @@ What is it?
5
5
===========
6
6
7
7
1 . A ` Rack::Middleware ` that sends selected parts of the request environment to an UDP socket
8
- 2 . An ` EventMachine ` daemon that opens an UDP socket and sends out received data to CouchDB
9
- 3 . A set of CouchDB map-reduce views, for analysis
10
-
8
+ 2 . An ` EventMachine ` daemon that opens an UDP socket and sends out received data to a database
11
9
12
10
Does it work?
13
11
=============
14
12
15
- Yes but the test suite is incomplete .
13
+ Yes, we are using it in production .
16
14
If you can help in complete the test suite, it is much appreciated :-).
17
15
18
16
Deploying
@@ -22,33 +20,30 @@ Deploying
22
20
23
21
gem 'usage\_ tracker', : require => 'usage\_ tracker/middleware'
24
22
25
- * Add the Middleware to your application:
23
+ * Configure the middleware and plug it into your application:
26
24
25
+ UsageTracker::Middleware.config(: host => '192.168.1.20', : port => '8840')
27
26
Your::Application.config.middleware.use UsageTracker::Middleware
28
27
29
- * The daemon can be started manually with the following command, inside a Rails.root :
28
+ * Install the gem on the target machine and run it with this command :
30
29
31
30
$ usage_tracker [ environment]
32
31
32
+ If you run it into a Rails.root it will log and write pids in canonical dirs.
33
+
33
34
` environment ` is optional and will default to "development" if no command line
34
35
option nor the RAILS\_ ENV environment variable are set.
35
36
36
37
or can be put under Upstart using the provided configuration file located in
37
38
` config/usage_tracker_upstart.conf ` . Check it out and modify it to suit your needs.
38
39
39
- The daemon logs to ` log/usage_tracker.log ` if the log directory exists and rotates its
40
- logs when receives the USR1 signal. If log directory does not exist it logs in the
41
- current directory.
40
+ The daemon logs to ` usage_tracker.log ` if the log directory exists and rotates its
41
+ logs when receives the USR1 signal.
42
42
43
- * The daemon writes its pid into tmp/pids/ usage\_ tracker.pid
43
+ * The daemon writes its pid into usage\_ tracker.pid
44
44
45
- * The daemon connects to a Couch database named ` usage_tracker ` running on ` localhost ` ,
46
- default port ` 5984/TCP ` , and listens on ` localhost ` , port ` 5985/UDP ` by default.
47
- You can change these settings via a ` config/usage_tracker.yml ` file. See the example
48
- in the ` config ` directory of the gem distribution.
49
-
50
- * The CouchDB instance must be running, the database is created (and updated)
51
- if necessary.
45
+ * The daemon can be configured to work with couchdb or mongodb adapter. Look at the
46
+ sample configuration file for hints.
52
47
53
48
* If the daemon cannot start, e.g. because of unavailable database or listening
54
49
address, it will print a diagnostig message to STDERR, log to usage\_ tracker.log
@@ -64,12 +59,10 @@ Tests are still incomplete. You can start the running:
64
59
65
60
> bundle exec rspec spec
66
61
67
-
68
62
All required gems for testing should be installed running:
69
63
70
64
> bundle install
71
65
72
66
About the middleware, it's probably better for you to test that in your own
73
- app's integration test suite. Some sample code has been brutally extracted from
74
- Panmind's codebase and is included in middleware\_ test.rb file.
67
+ app's integration test suite.
75
68
0 commit comments