queso-daemon-kit 0.1.7.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. data/Configuration.txt +110 -0
  2. data/Deployment.txt +113 -0
  3. data/History.txt +97 -0
  4. data/Logging.txt +92 -0
  5. data/Manifest.txt +166 -0
  6. data/PostInstall.txt +6 -0
  7. data/README.rdoc +130 -0
  8. data/Rakefile +37 -0
  9. data/RuoteParticipants.txt +113 -0
  10. data/TODO.txt +37 -0
  11. data/app_generators/daemon_kit/USAGE +7 -0
  12. data/app_generators/daemon_kit/daemon_kit_generator.rb +161 -0
  13. data/app_generators/daemon_kit/templates/README +48 -0
  14. data/app_generators/daemon_kit/templates/Rakefile +6 -0
  15. data/app_generators/daemon_kit/templates/bin/daemon.erb +7 -0
  16. data/app_generators/daemon_kit/templates/config/arguments.rb +12 -0
  17. data/app_generators/daemon_kit/templates/config/boot.rb +68 -0
  18. data/app_generators/daemon_kit/templates/config/environment.rb +23 -0
  19. data/app_generators/daemon_kit/templates/config/environments/development.rb +2 -0
  20. data/app_generators/daemon_kit/templates/config/environments/production.rb +2 -0
  21. data/app_generators/daemon_kit/templates/config/environments/test.rb +2 -0
  22. data/app_generators/daemon_kit/templates/config/post-daemonize/readme +5 -0
  23. data/app_generators/daemon_kit/templates/config/pre-daemonize/readme +12 -0
  24. data/app_generators/daemon_kit/templates/lib/daemon.rb +2 -0
  25. data/app_generators/daemon_kit/templates/libexec/daemon.erb +18 -0
  26. data/app_generators/daemon_kit/templates/script/console +3 -0
  27. data/app_generators/daemon_kit/templates/script/destroy +14 -0
  28. data/app_generators/daemon_kit/templates/script/generate +14 -0
  29. data/bin/daemon_kit +18 -0
  30. data/daemon_generators/amqp/USAGE +5 -0
  31. data/daemon_generators/amqp/amqp_generator.rb +65 -0
  32. data/daemon_generators/amqp/templates/config/amqp.yml +28 -0
  33. data/daemon_generators/amqp/templates/config/initializers/amqp.rb +7 -0
  34. data/daemon_generators/amqp/templates/libexec/daemon.rb +37 -0
  35. data/daemon_generators/cron/USAGE +5 -0
  36. data/daemon_generators/cron/cron_generator.rb +64 -0
  37. data/daemon_generators/cron/templates/config/initializers/cron.rb +11 -0
  38. data/daemon_generators/cron/templates/libexec/daemon.rb +43 -0
  39. data/daemon_generators/cucumber/USAGE +11 -0
  40. data/daemon_generators/cucumber/cucumber_generator.rb +38 -0
  41. data/daemon_generators/cucumber/templates/cucumber +8 -0
  42. data/daemon_generators/cucumber/templates/cucumber.rake +13 -0
  43. data/daemon_generators/cucumber/templates/cucumber_environment.rb +2 -0
  44. data/daemon_generators/cucumber/templates/env.rb +7 -0
  45. data/daemon_generators/deploy_capistrano/deploy_capistrano_generator.rb +35 -0
  46. data/daemon_generators/deploy_capistrano/templates/Capfile +10 -0
  47. data/daemon_generators/deploy_capistrano/templates/USAGE +10 -0
  48. data/daemon_generators/deploy_capistrano/templates/config/deploy.rb +53 -0
  49. data/daemon_generators/deploy_capistrano/templates/config/deploy/production.rb +6 -0
  50. data/daemon_generators/deploy_capistrano/templates/config/deploy/staging.rb +6 -0
  51. data/daemon_generators/deploy_capistrano/templates/config/environments/staging.rb +0 -0
  52. data/daemon_generators/jabber/USAGE +5 -0
  53. data/daemon_generators/jabber/jabber_generator.rb +65 -0
  54. data/daemon_generators/jabber/templates/config/initializers/jabber.rb +7 -0
  55. data/daemon_generators/jabber/templates/config/jabber.yml +26 -0
  56. data/daemon_generators/jabber/templates/libexec/daemon.rb +27 -0
  57. data/daemon_generators/nanite_agent/USAGE +5 -0
  58. data/daemon_generators/nanite_agent/nanite_agent_generator.rb +68 -0
  59. data/daemon_generators/nanite_agent/templates/config/initializers/nanite_agent.rb +6 -0
  60. data/daemon_generators/nanite_agent/templates/config/nanite.yml +35 -0
  61. data/daemon_generators/nanite_agent/templates/lib/actors/sample.rb +11 -0
  62. data/daemon_generators/nanite_agent/templates/libexec/daemon.rb +31 -0
  63. data/daemon_generators/rspec/USAGE +5 -0
  64. data/daemon_generators/rspec/rspec_generator.rb +55 -0
  65. data/daemon_generators/rspec/templates/spec.rb +11 -0
  66. data/daemon_generators/rspec/templates/spec/spec.opts +1 -0
  67. data/daemon_generators/rspec/templates/spec/spec_helper.rb +21 -0
  68. data/daemon_generators/rspec/templates/tasks/rspec.rake +21 -0
  69. data/daemon_generators/ruote/USAGE +5 -0
  70. data/daemon_generators/ruote/ruote_generator.rb +67 -0
  71. data/daemon_generators/ruote/templates/config/amqp.yml +30 -0
  72. data/daemon_generators/ruote/templates/config/initializers/ruote.rb +13 -0
  73. data/daemon_generators/ruote/templates/config/ruote.yml +23 -0
  74. data/daemon_generators/ruote/templates/lib/daemon.rb +4 -0
  75. data/daemon_generators/ruote/templates/lib/sample.rb +26 -0
  76. data/daemon_generators/ruote/templates/libexec/daemon.rb +33 -0
  77. data/lib/daemon_kit.rb +62 -0
  78. data/lib/daemon_kit/abstract_logger.rb +235 -0
  79. data/lib/daemon_kit/amqp.rb +38 -0
  80. data/lib/daemon_kit/application.rb +187 -0
  81. data/lib/daemon_kit/arguments.rb +165 -0
  82. data/lib/daemon_kit/commands/console.rb +38 -0
  83. data/lib/daemon_kit/config.rb +108 -0
  84. data/lib/daemon_kit/console_daemon.rb +2 -0
  85. data/lib/daemon_kit/core_ext.rb +1 -0
  86. data/lib/daemon_kit/core_ext/configurable.rb +96 -0
  87. data/lib/daemon_kit/core_ext/string.rb +22 -0
  88. data/lib/daemon_kit/cron.rb +48 -0
  89. data/lib/daemon_kit/cucumber/world.rb +38 -0
  90. data/lib/daemon_kit/deployment/capistrano.rb +482 -0
  91. data/lib/daemon_kit/em.rb +43 -0
  92. data/lib/daemon_kit/error_handlers/base.rb +32 -0
  93. data/lib/daemon_kit/error_handlers/hoptoad.rb +60 -0
  94. data/lib/daemon_kit/error_handlers/mail.rb +85 -0
  95. data/lib/daemon_kit/exceptions.rb +15 -0
  96. data/lib/daemon_kit/initializer.rb +438 -0
  97. data/lib/daemon_kit/jabber.rb +170 -0
  98. data/lib/daemon_kit/nanite.rb +7 -0
  99. data/lib/daemon_kit/nanite/agent.rb +56 -0
  100. data/lib/daemon_kit/pid_file.rb +61 -0
  101. data/lib/daemon_kit/ruote_participants.rb +119 -0
  102. data/lib/daemon_kit/ruote_pseudo_participant.rb +68 -0
  103. data/lib/daemon_kit/ruote_workitem.rb +169 -0
  104. data/lib/daemon_kit/safety.rb +85 -0
  105. data/lib/daemon_kit/tasks.rb +2 -0
  106. data/lib/daemon_kit/tasks/environment.rake +10 -0
  107. data/lib/daemon_kit/tasks/framework.rake +120 -0
  108. data/lib/daemon_kit/tasks/god.rake +62 -0
  109. data/lib/daemon_kit/tasks/log.rake +8 -0
  110. data/lib/daemon_kit/tasks/monit.rake +29 -0
  111. data/script/console +10 -0
  112. data/script/destroy +14 -0
  113. data/script/generate +14 -0
  114. data/script/txt2html +71 -0
  115. data/spec/abstract_logger_spec.rb +126 -0
  116. data/spec/argument_spec.rb +70 -0
  117. data/spec/config_spec.rb +79 -0
  118. data/spec/configurable_spec.rb +56 -0
  119. data/spec/daemon_kit_spec.rb +7 -0
  120. data/spec/error_handlers_spec.rb +23 -0
  121. data/spec/fixtures/env.yml +15 -0
  122. data/spec/fixtures/noenv.yml +4 -0
  123. data/spec/initializer_spec.rb +26 -0
  124. data/spec/spec.opts +1 -0
  125. data/spec/spec_helper.rb +27 -0
  126. data/tasks/rspec.rake +21 -0
  127. data/templates/god/god.erb +69 -0
  128. data/templates/monit/monit.erb +14 -0
  129. data/test/test_amqp_generator.rb +48 -0
  130. data/test/test_cron_generator.rb +45 -0
  131. data/test/test_daemon-kit_generator.rb +84 -0
  132. data/test/test_daemon_kit_config.rb +28 -0
  133. data/test/test_deploy_capistrano_generator.rb +48 -0
  134. data/test/test_generator_helper.rb +29 -0
  135. data/test/test_helper.rb +7 -0
  136. data/test/test_jabber_generator.rb +49 -0
  137. data/test/test_nanite_agent_generator.rb +49 -0
  138. data/test/test_ruote_generator.rb +45 -0
  139. data/vendor/tmail-1.2.3/tmail.rb +5 -0
  140. data/vendor/tmail-1.2.3/tmail/address.rb +426 -0
  141. data/vendor/tmail-1.2.3/tmail/attachments.rb +46 -0
  142. data/vendor/tmail-1.2.3/tmail/base64.rb +46 -0
  143. data/vendor/tmail-1.2.3/tmail/compat.rb +41 -0
  144. data/vendor/tmail-1.2.3/tmail/config.rb +67 -0
  145. data/vendor/tmail-1.2.3/tmail/core_extensions.rb +63 -0
  146. data/vendor/tmail-1.2.3/tmail/encode.rb +581 -0
  147. data/vendor/tmail-1.2.3/tmail/header.rb +960 -0
  148. data/vendor/tmail-1.2.3/tmail/index.rb +9 -0
  149. data/vendor/tmail-1.2.3/tmail/interface.rb +1130 -0
  150. data/vendor/tmail-1.2.3/tmail/loader.rb +3 -0
  151. data/vendor/tmail-1.2.3/tmail/mail.rb +578 -0
  152. data/vendor/tmail-1.2.3/tmail/mailbox.rb +495 -0
  153. data/vendor/tmail-1.2.3/tmail/main.rb +6 -0
  154. data/vendor/tmail-1.2.3/tmail/mbox.rb +3 -0
  155. data/vendor/tmail-1.2.3/tmail/net.rb +248 -0
  156. data/vendor/tmail-1.2.3/tmail/obsolete.rb +132 -0
  157. data/vendor/tmail-1.2.3/tmail/parser.rb +1476 -0
  158. data/vendor/tmail-1.2.3/tmail/port.rb +379 -0
  159. data/vendor/tmail-1.2.3/tmail/quoting.rb +118 -0
  160. data/vendor/tmail-1.2.3/tmail/require_arch.rb +58 -0
  161. data/vendor/tmail-1.2.3/tmail/scanner.rb +49 -0
  162. data/vendor/tmail-1.2.3/tmail/scanner_r.rb +261 -0
  163. data/vendor/tmail-1.2.3/tmail/stringio.rb +280 -0
  164. data/vendor/tmail-1.2.3/tmail/utils.rb +337 -0
  165. data/vendor/tmail-1.2.3/tmail/version.rb +39 -0
  166. data/vendor/tmail.rb +13 -0
  167. metadata +281 -0
data/Configuration.txt ADDED
@@ -0,0 +1,110 @@
1
+ = Configuring your daemon
2
+
3
+ daemon-kit provides a multitude of ways to configure your daemon, this document
4
+ will outline the different options available to you.
5
+
6
+ == Configuration files and #DaemonKit::Config
7
+
8
+ #DaemonKit::Config gives you easy access to any YAML configuration
9
+ files you have in your <em>config</em> directory.
10
+
11
+ You can access the configuration files like this:
12
+
13
+ config = DaemonKit::Config.load('sample')
14
+
15
+ The above snippet relies on the presence of a <em>config/sample.yml</em> file.
16
+
17
+ #DaemonKit::Config is environment aware, so configuration files are
18
+ parsed for a top-level key that is the same as the value of
19
+ <em>DAEMON_ENV</em>, and if present is loaded into the object as the
20
+ configuration data. If the key is not present, the whole YAML
21
+ document is exposed as configuration data.
22
+
23
+ == Command line arguments
24
+
25
+ The most flexible way to configure your daemon is through command line
26
+ arguments, or switches.
27
+
28
+ DaemonKit includes a couple of its own arguments that can be used:
29
+
30
+ -e ENV (or --env ENV) to set the daemon environment
31
+ --pid /path/to/pidfile to set the path to a pidfile
32
+ -l path (or --log path) to set the path for the log file
33
+ -v shows the DaemonKit version
34
+ -h shows a useful help message
35
+
36
+ === Custom arguments
37
+
38
+ It is possible for you to specify your own arguments as well, by
39
+ updating the <em>config/arguments.rb</em> file. This file is eval'd
40
+ inside #DaemonKit::Arguments and gives you access to the following two
41
+ variables:
42
+
43
+ * opts - Instance of OptionParser[http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/classes/OptionParser.html]
44
+ * @options - A standard Ruby hash that you can populate and access later
45
+
46
+ Your custom arguments can be accessed like this:
47
+
48
+ DaemonKit.arguments.options
49
+
50
+ === Advanced Configuration
51
+
52
+ All the writable attributes of the default #DaemonKit::Configuration
53
+ instance call also be modified from the command line using the special
54
+ <em>--config</em> arguments:
55
+
56
+ --config force_kill_wait=30
57
+
58
+ This happens after <em>config/environment.rb</em> is processed, so all
59
+ command line arguments will overwrite those values.
60
+
61
+ === Daemon umask
62
+
63
+ By default daemon processes run with a umask of 022, but this can be changed
64
+ on the command line or in +config/environment.rb+.
65
+
66
+ To set a more restrictive umask via command line arguments, you can start your
67
+ daemon like this:
68
+
69
+ $ ./bin/daemon start --config umask=0077
70
+
71
+ Or the same in +config/environment.rb+
72
+
73
+ DaemonKit::Initializer.run do |config|
74
+ # ...
75
+
76
+ # restrictive umask
77
+ config.umask = 0077
78
+
79
+ # ...
80
+ end
81
+
82
+ === Privilege Separation
83
+
84
+ By default daemon processes run as the user that starts them, inheriting all
85
+ their privileges (or lack thereof). Getting daemon-kit to drop privileges
86
+ can currently only be done using command-line parameters, and only works
87
+ reliable on *nix (OSX seemed cranky at the time of testing).
88
+
89
+ $ ./bin/daemon start --config user=nobody --config group=nobody
90
+
91
+ Privileges are dropped at the earliest possible phase of starting the daemon.
92
+
93
+ Things to note on privilege separation:
94
+
95
+ * You generally have to be root to be able to perform this
96
+ * File system permissions for +log/+ needs to be correct
97
+ * Daemon-kit will only shed privileges on the +start+ command, not on +run+
98
+ * Make sure your code is secure if accepting stuff from the outside world
99
+ * The daemon will continue to run if it failed, this is because the feature is experimental and could change in the future.
100
+ * The damon logs the reduced privileges in the log file shortly after booting, please check it carefully
101
+
102
+ The implementation stems from the advice given by Joe Damato on his blog post
103
+ http://timetobleed.com/tag/privilege-escalation/
104
+
105
+ IMPORTANT NOTE FOR OSX USERS:
106
+
107
+ Testing on my iBook with OSX 10.5.8 using Ruby 1.8.6-p287 failed to drop
108
+ privileges correctly because of the 'nobody' user's UID being too large
109
+ (Bignum), however testing with Ruby 1.9.1-p129 on OSX 10.5.8 did work as
110
+ expected.
data/Deployment.txt ADDED
@@ -0,0 +1,113 @@
1
+ = Deploying your daemons
2
+
3
+ daemon-kit provides built-in support for
4
+ Capistrano[http://www.capify.org] deployments, using a customized
5
+ version of the standard 'deploy' recipe for Ruby on Rails
6
+ applications.
7
+
8
+ User of Vlad[http://hitsquad.rubyforge.org/vlad/]? Get in touch so we
9
+ can discuss your contribution to daemon-kit ;)
10
+
11
+ == Generating capistrano configurations
12
+
13
+ When generating a new daemon, you can pass the <em>-d capistrano</em>
14
+ argument to the <em>daemon_kit</em> command. In case you already have
15
+ a generated daemon, run the following command inside your project:
16
+
17
+ $ ruby script/generate deploy_capistrano
18
+
19
+ == Overview of generated configurations
20
+
21
+ The generator creates the following files worth noticing:
22
+
23
+ config/deploy.rb
24
+ config/deploy/*.rb
25
+
26
+ The generator also creates a new environment for you, a
27
+ <em>staging</em> environment. Useful for testing your deployments
28
+ before taking anything into production.
29
+
30
+ == Configuring capistrano
31
+
32
+ For each environment (staging & production) you only need to specify
33
+ the target hosts in <em>config/deploy/(staging|production).rb</em>.
34
+
35
+ Each of the stub files have example configuration values you can just
36
+ edit.
37
+
38
+ The rest of your configuration generally occurs in
39
+ <em>config/deploy.rb</em>.
40
+
41
+ Everything works exactly like standard capistrano, with the exception
42
+ of the following directives:
43
+
44
+ * :config_files
45
+ * :shared_children
46
+
47
+ === :config_files
48
+
49
+ Since the daemon configuration files will almost always differ between
50
+ your development environment and your staging/production environment,
51
+ the deployment recipe makes adequate provision for this.
52
+
53
+ Use the :config_files directive to set an array of file names from the
54
+ <em>config</em> directory that you want replaced with production
55
+ configuration files found on the server:
56
+
57
+ set :config_files, %w{ amqp.yaml }
58
+
59
+ On your target server, in the <em>:deploy_to</em> folder, create a
60
+ <em>config</em> directory and place your configuration files in
61
+ there. One each deploy, capistrano will rename the files in your
62
+ deployed configuration directory with a <em>.orig</em> extension, and copy
63
+ the files from <em>:deploy_to/config</em> into the newly deployed
64
+ release.
65
+
66
+ This makes it easy to keep production configurations out of your
67
+ working directories or version control systems.
68
+
69
+ === :shared_children
70
+
71
+ The original capistrano recipe that daemon-kit's recipe is built from
72
+ provided support for tracking shared directories between
73
+ deployments. This works by removing the deployed directory, and
74
+ creating a symlink from <em>:deploy_to/shared/</em> into the correct
75
+ location within the deployed release.
76
+
77
+ You specify your list of directories with the
78
+ <em>:shared_children</em>, each being relative to the DAEMON_ROOT.
79
+
80
+ set :shared_children, %w{ log }
81
+
82
+ The daemon-kit deployment recipe makes no assumptions on shared
83
+ directories, and gives you full control. The default only includes the
84
+ log directory, which you can remove if you want separate log
85
+ directories for each deployed release.
86
+
87
+ == Remote dependencies
88
+
89
+ By default, the deployment configuration file is configured to check
90
+ the remote dependencies before updating the code on the target
91
+ host. You can disable this behaviour by commenting out the following
92
+ line:
93
+
94
+ before "deploy:update_code", "deploy:check"
95
+
96
+ The only default remote dependency is the daemon-kit gem, and it will
97
+ check for the same version you currently have installed (or a later
98
+ one).
99
+
100
+ == More capistrano resources
101
+
102
+ To see a list of available commands, please run the following command
103
+ in the root of your project:
104
+
105
+ $ cap -vT
106
+
107
+ For more information on capistrano, please refer to the following list
108
+ of online resources:
109
+
110
+ * Capistrano Website[http://www.capify.org]
111
+ * Capistrano Wiki[http://wiki.capify.org]
112
+ * Capistrano Group[http://groups.google.com/group/capistrano]
113
+ * #capistrano on Freenode
data/History.txt ADDED
@@ -0,0 +1,97 @@
1
+ == 0.1.7.10 (2009-08-12)
2
+
3
+ * Ruote remote participants
4
+ * Allow process umask to be configured, defaults to 022
5
+ * Updates to DaemonKit::Config hashes
6
+ * Fixed argument parsing bug (reported by Mathijs Kwik (bluescreen303)
7
+ * Support for privilege separation (See Configuration.txt)
8
+
9
+ == 0.1.7.9 2009-06-22
10
+
11
+ * Backtraces only logged on unclean shutdown
12
+ * AMQP generator got new keep alive code
13
+
14
+ == 0.1.7.8 2009-06-22
15
+
16
+ * Optional logging of all exceptions when the daemon process dies
17
+ unexpectedly
18
+ * Update generated environment.rb to reflect new backtraces option
19
+
20
+ == 0.1.7.7 2009-06-22
21
+
22
+ * Fixed compatibility with rufus-scheduler-2.0.0 (or newer) in cron
23
+ generator
24
+ * Started central eventmachine reactor management code
25
+ * Now depends on eventmachine
26
+
27
+ == 0.1.7.6 (Not released)
28
+
29
+ * Support for cucumber
30
+ * Fixed issue in daemon_kit:upgrade task
31
+ * Moved rspec generator into new home
32
+ * Removed conflicting rubigen generator, messed with our script directory
33
+ * Fixed bug where environment.rb overwrites some --config values (reported by Josh Owens)
34
+
35
+ == 0.1.7.5 2009-06-08
36
+
37
+ * New AbstractLogger
38
+ ** Default Logger backend
39
+ ** SysLogLogger support
40
+ * More documentation
41
+
42
+ == 0.1.7.4 2009-06-05
43
+
44
+ * Fixed bug with control script generator (thanks Sho Fukamachi)
45
+ * Enhanced deploy.rb template to check for current dk gem verion,
46
+ unless vendored
47
+ * Fix bug in capistrano recipe for restarting daemons
48
+ * Added log:truncate rake task
49
+ * Error mails now handled by TMail
50
+
51
+ == 0.1.7.3 2009-05-31
52
+
53
+ * Removed dependency on daemons gem, now handled in house
54
+ * New argument management
55
+ * Some more docs
56
+
57
+ == 0.1.7.1 2009-05-28
58
+
59
+ * Fixed some minor issue with Capistrano support
60
+ * Added support for generating dog/monit configuration files via rake
61
+ * Initial implementation of ./script/* utilities
62
+
63
+ == 0.1.7 2009-05-26
64
+
65
+ * Capistrano deployment support
66
+
67
+ == 0.1.6 2009-05-13
68
+
69
+ * DaemonKit::Safety class to handle the trapping and logging of
70
+ exceptions, as well as email notifications or Hoptoad notifications.
71
+ * New config/pre-daemonize and config/post-daemonize structure
72
+ * New tasks to simplify upgrading daemon-kit projects
73
+ * Fixed some other annoyances and bugs
74
+ * Bigger TODO list
75
+
76
+ == 0.1.5 2009-05-07
77
+
78
+ * DaemonKit::Config class to easy the use of YAML configs internally,
79
+ and in generated daemons
80
+
81
+ == 0.1.2 2009-04-28
82
+
83
+ * Added missing rubigen dependency
84
+
85
+ == 0.1.1 2009-04-27
86
+
87
+ * AMQP consumer generator added
88
+ * 'cron' style generator added
89
+ * Allow configuring dir_mode and dir (pid file location) (Jim Lindley)
90
+
91
+ == 0.1.0 2009-01-08
92
+
93
+ * Ability to freeze the gem/edge copies of DaemonKit
94
+ * Simple non-evented Jabber generator
95
+ * Flexible UNIX signal trapping configuration
96
+ * Basic generator completed
97
+ * 1 small step for man, 1 giant leap for mankind
data/Logging.txt ADDED
@@ -0,0 +1,92 @@
1
+ = Logging from inside your daemon
2
+
3
+ Proper logging inside your daemon process is critical, and daemon-kit
4
+ provides you with a great logging facility to (ab)use.
5
+
6
+ == Logging examples
7
+
8
+ From anywhere in your code you can access the
9
+ <em>DaemonKit.logger</em> instance, which is a configured
10
+ DaemonKit::AbstractLogger. It is compatible with Ruby's Logger class
11
+ but is much more verbose to help you gain some insight into your
12
+ running process.
13
+
14
+ DaemonKit.logger.info( "Hello world" )
15
+
16
+ This logs a 'Hello world' line to the log file, complete with the
17
+ calling file name and line number. Log lines look something like this:
18
+
19
+ 2009-06-07 23:21:30.248575 capd(32513) [INFO] initializer.rb:91: DaemonKit (0.1.7.4) booted, now running capd
20
+
21
+ Log as much as you can, but be careful not to abuse the <em>info</em>
22
+ level since your log files can become huge. For general processing
23
+ hints, use the <em>debug</em> level.
24
+
25
+ To log exceptions, use the special <em>exception</em> helper:
26
+
27
+ begin
28
+ # dangerous operation
29
+ rescue => e
30
+ DaemonKit.logger.exception( e )
31
+ end
32
+
33
+ == Controlling logging in a running process
34
+
35
+ Logging can be controlled in a running process, either via code or by
36
+ sending UNIX signals to the running process.
37
+
38
+ === Changing log levels in your code
39
+
40
+ Log levels can be toggled with the <em>level=</em> method:
41
+
42
+ DaemonKit.logger.level = :info
43
+
44
+ Alternatively you can silence all the logging activity for a while
45
+ using the silence helper:
46
+
47
+ DaemonKit.logger.silence do |logger|
48
+ # logger will only report :error or higher levels
49
+ end
50
+
51
+ === Changing log levels via UNIX signals
52
+
53
+ Send your process the +USR1+ signal to toggle between <em>:debug</em>
54
+ and <em>:info</em> log levels. Sending a +USR2+ signal will force the
55
+ logger into <em>:debug</em> mode (+USR1+ will revert).
56
+
57
+ == Support for log rotation
58
+
59
+ Support for logrotate is baked right into daemon-kit. By sending your
60
+ daemon a +HUP+ signal all the log files file be closed and re-opened
61
+ again on first use. Here is an example logrotate configuration:
62
+
63
+ /path/to/daemon.log {
64
+ rotate 5
65
+ weekly
66
+ postrotate
67
+ kill -HUP `cat /path/to/daemon.pid`
68
+ endscript
69
+ }
70
+
71
+ == Support for syslog logging
72
+
73
+ If you have the
74
+ SyslogLogger[http://seattlerb.rubyforge.org/SyslogLogger/] gem
75
+ installed, you can have your process log to a UNIX syslog server. You
76
+ can change the logging to syslog by either updating your
77
+ <em>environment.rb</em> file like this:
78
+
79
+ config.log_path = :syslog
80
+
81
+ Or by passing 'syslog' as the logfile argument when starting a daemon
82
+
83
+ $ ruby ./bin/daemon start -l syslog
84
+
85
+ The SyslogLogger rdoc's provide configuration examples for configuring
86
+ various UNIX syslog servers.
87
+
88
+ == More logging information
89
+
90
+ If you're running your daemon in the foreground (with the <em>run</em>
91
+ command, you'll get copies of all the log messages on STDOUT, and thus
92
+ voiding the need to tail log files the whole time.
data/Manifest.txt ADDED
@@ -0,0 +1,166 @@
1
+ Configuration.txt
2
+ Deployment.txt
3
+ History.txt
4
+ Logging.txt
5
+ Manifest.txt
6
+ PostInstall.txt
7
+ README.rdoc
8
+ Rakefile
9
+ RuoteParticipants.txt
10
+ TODO.txt
11
+ app_generators/daemon_kit/USAGE
12
+ app_generators/daemon_kit/daemon_kit_generator.rb
13
+ app_generators/daemon_kit/templates/README
14
+ app_generators/daemon_kit/templates/Rakefile
15
+ app_generators/daemon_kit/templates/bin/daemon.erb
16
+ app_generators/daemon_kit/templates/config/arguments.rb
17
+ app_generators/daemon_kit/templates/config/boot.rb
18
+ app_generators/daemon_kit/templates/config/environment.rb
19
+ app_generators/daemon_kit/templates/config/environments/development.rb
20
+ app_generators/daemon_kit/templates/config/environments/production.rb
21
+ app_generators/daemon_kit/templates/config/environments/test.rb
22
+ app_generators/daemon_kit/templates/config/post-daemonize/readme
23
+ app_generators/daemon_kit/templates/config/pre-daemonize/readme
24
+ app_generators/daemon_kit/templates/lib/daemon.rb
25
+ app_generators/daemon_kit/templates/libexec/daemon.erb
26
+ app_generators/daemon_kit/templates/script/console
27
+ app_generators/daemon_kit/templates/script/destroy
28
+ app_generators/daemon_kit/templates/script/generate
29
+ bin/daemon_kit
30
+ daemon_generators/amqp/USAGE
31
+ daemon_generators/amqp/amqp_generator.rb
32
+ daemon_generators/amqp/templates/config/amqp.yml
33
+ daemon_generators/amqp/templates/config/initializers/amqp.rb
34
+ daemon_generators/amqp/templates/libexec/daemon.rb
35
+ daemon_generators/cron/USAGE
36
+ daemon_generators/cron/cron_generator.rb
37
+ daemon_generators/cron/templates/config/initializers/cron.rb
38
+ daemon_generators/cron/templates/libexec/daemon.rb
39
+ daemon_generators/cucumber/USAGE
40
+ daemon_generators/cucumber/cucumber_generator.rb
41
+ daemon_generators/cucumber/templates/cucumber
42
+ daemon_generators/cucumber/templates/cucumber.rake
43
+ daemon_generators/cucumber/templates/cucumber_environment.rb
44
+ daemon_generators/cucumber/templates/env.rb
45
+ daemon_generators/deploy_capistrano/deploy_capistrano_generator.rb
46
+ daemon_generators/deploy_capistrano/templates/Capfile
47
+ daemon_generators/deploy_capistrano/templates/USAGE
48
+ daemon_generators/deploy_capistrano/templates/config/deploy.rb
49
+ daemon_generators/deploy_capistrano/templates/config/deploy/production.rb
50
+ daemon_generators/deploy_capistrano/templates/config/deploy/staging.rb
51
+ daemon_generators/deploy_capistrano/templates/config/environments/staging.rb
52
+ daemon_generators/jabber/USAGE
53
+ daemon_generators/jabber/jabber_generator.rb
54
+ daemon_generators/jabber/templates/config/initializers/jabber.rb
55
+ daemon_generators/jabber/templates/config/jabber.yml
56
+ daemon_generators/jabber/templates/libexec/daemon.rb
57
+ daemon_generators/nanite_agent/USAGE
58
+ daemon_generators/nanite_agent/nanite_agent_generator.rb
59
+ daemon_generators/nanite_agent/templates/config/initializers/nanite_agent.rb
60
+ daemon_generators/nanite_agent/templates/config/nanite.yml
61
+ daemon_generators/nanite_agent/templates/lib/actors/sample.rb
62
+ daemon_generators/nanite_agent/templates/libexec/daemon.rb
63
+ daemon_generators/rspec/USAGE
64
+ daemon_generators/rspec/rspec_generator.rb
65
+ daemon_generators/rspec/templates/spec.rb
66
+ daemon_generators/rspec/templates/spec/spec.opts
67
+ daemon_generators/rspec/templates/spec/spec_helper.rb
68
+ daemon_generators/rspec/templates/tasks/rspec.rake
69
+ daemon_generators/ruote/USAGE
70
+ daemon_generators/ruote/ruote_generator.rb
71
+ daemon_generators/ruote/templates/config/amqp.yml
72
+ daemon_generators/ruote/templates/config/initializers/ruote.rb
73
+ daemon_generators/ruote/templates/config/ruote.yml
74
+ daemon_generators/ruote/templates/lib/daemon.rb
75
+ daemon_generators/ruote/templates/lib/sample.rb
76
+ daemon_generators/ruote/templates/libexec/daemon.rb
77
+ lib/daemon_kit.rb
78
+ lib/daemon_kit/abstract_logger.rb
79
+ lib/daemon_kit/amqp.rb
80
+ lib/daemon_kit/application.rb
81
+ lib/daemon_kit/arguments.rb
82
+ lib/daemon_kit/commands/console.rb
83
+ lib/daemon_kit/config.rb
84
+ lib/daemon_kit/console_daemon.rb
85
+ lib/daemon_kit/core_ext.rb
86
+ lib/daemon_kit/core_ext/configurable.rb
87
+ lib/daemon_kit/core_ext/string.rb
88
+ lib/daemon_kit/cron.rb
89
+ lib/daemon_kit/cucumber/world.rb
90
+ lib/daemon_kit/deployment/capistrano.rb
91
+ lib/daemon_kit/em.rb
92
+ lib/daemon_kit/error_handlers/base.rb
93
+ lib/daemon_kit/error_handlers/hoptoad.rb
94
+ lib/daemon_kit/error_handlers/mail.rb
95
+ lib/daemon_kit/exceptions.rb
96
+ lib/daemon_kit/initializer.rb
97
+ lib/daemon_kit/jabber.rb
98
+ lib/daemon_kit/nanite.rb
99
+ lib/daemon_kit/nanite/agent.rb
100
+ lib/daemon_kit/pid_file.rb
101
+ lib/daemon_kit/ruote_participants.rb
102
+ lib/daemon_kit/ruote_pseudo_participant.rb
103
+ lib/daemon_kit/ruote_workitem.rb
104
+ lib/daemon_kit/safety.rb
105
+ lib/daemon_kit/tasks.rb
106
+ lib/daemon_kit/tasks/environment.rake
107
+ lib/daemon_kit/tasks/framework.rake
108
+ lib/daemon_kit/tasks/god.rake
109
+ lib/daemon_kit/tasks/log.rake
110
+ lib/daemon_kit/tasks/monit.rake
111
+ script/console
112
+ script/destroy
113
+ script/generate
114
+ script/txt2html
115
+ spec/abstract_logger_spec.rb
116
+ spec/argument_spec.rb
117
+ spec/config_spec.rb
118
+ spec/configurable_spec.rb
119
+ spec/daemon_kit_spec.rb
120
+ spec/error_handlers_spec.rb
121
+ spec/fixtures/env.yml
122
+ spec/fixtures/noenv.yml
123
+ spec/initializer_spec.rb
124
+ spec/spec.opts
125
+ spec/spec_helper.rb
126
+ tasks/rspec.rake
127
+ templates/god/god.erb
128
+ templates/monit/monit.erb
129
+ test/test_amqp_generator.rb
130
+ test/test_cron_generator.rb
131
+ test/test_daemon-kit_generator.rb
132
+ test/test_daemon_kit_config.rb
133
+ test/test_deploy_capistrano_generator.rb
134
+ test/test_generator_helper.rb
135
+ test/test_helper.rb
136
+ test/test_jabber_generator.rb
137
+ test/test_nanite_agent_generator.rb
138
+ test/test_ruote_generator.rb
139
+ vendor/tmail-1.2.3/tmail.rb
140
+ vendor/tmail-1.2.3/tmail/address.rb
141
+ vendor/tmail-1.2.3/tmail/attachments.rb
142
+ vendor/tmail-1.2.3/tmail/base64.rb
143
+ vendor/tmail-1.2.3/tmail/compat.rb
144
+ vendor/tmail-1.2.3/tmail/config.rb
145
+ vendor/tmail-1.2.3/tmail/core_extensions.rb
146
+ vendor/tmail-1.2.3/tmail/encode.rb
147
+ vendor/tmail-1.2.3/tmail/header.rb
148
+ vendor/tmail-1.2.3/tmail/index.rb
149
+ vendor/tmail-1.2.3/tmail/interface.rb
150
+ vendor/tmail-1.2.3/tmail/loader.rb
151
+ vendor/tmail-1.2.3/tmail/mail.rb
152
+ vendor/tmail-1.2.3/tmail/mailbox.rb
153
+ vendor/tmail-1.2.3/tmail/main.rb
154
+ vendor/tmail-1.2.3/tmail/mbox.rb
155
+ vendor/tmail-1.2.3/tmail/net.rb
156
+ vendor/tmail-1.2.3/tmail/obsolete.rb
157
+ vendor/tmail-1.2.3/tmail/parser.rb
158
+ vendor/tmail-1.2.3/tmail/port.rb
159
+ vendor/tmail-1.2.3/tmail/quoting.rb
160
+ vendor/tmail-1.2.3/tmail/require_arch.rb
161
+ vendor/tmail-1.2.3/tmail/scanner.rb
162
+ vendor/tmail-1.2.3/tmail/scanner_r.rb
163
+ vendor/tmail-1.2.3/tmail/stringio.rb
164
+ vendor/tmail-1.2.3/tmail/utils.rb
165
+ vendor/tmail-1.2.3/tmail/version.rb
166
+ vendor/tmail.rb