mana 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. data/.gitignore +18 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +22 -0
  4. data/README.md +29 -0
  5. data/Rakefile +2 -0
  6. data/cookbooks/monit/attributes/default.rb +13 -0
  7. data/cookbooks/monit/files/ubuntu/monit.default +11 -0
  8. data/cookbooks/monit/libraries/monitrc.rb +21 -0
  9. data/cookbooks/monit/recipes/default.rb +34 -0
  10. data/cookbooks/monit/recipes/ssh.rb +3 -0
  11. data/cookbooks/monit/templates/default/monitrc.erb +31 -0
  12. data/cookbooks/monit/templates/default/ssh.monit.conf.erb +7 -0
  13. data/cookbooks/nginx/attributes/default.rb +3 -0
  14. data/cookbooks/nginx/definitions/nginx_site.rb +15 -0
  15. data/cookbooks/nginx/recipes/default.rb +44 -0
  16. data/cookbooks/nginx/templates/default/default.conf.erb +11 -0
  17. data/cookbooks/nginx/templates/default/nginx.conf.erb +32 -0
  18. data/cookbooks/nginx/templates/default/nginx.monit.conf.erb +8 -0
  19. data/cookbooks/nginx/templates/default/nxdissite.erb +29 -0
  20. data/cookbooks/nginx/templates/default/nxensite.erb +38 -0
  21. data/cookbooks/postgresql/attributes/default.rb +5 -0
  22. data/cookbooks/postgresql/recipes/client.rb +5 -0
  23. data/cookbooks/postgresql/recipes/default.rb +2 -0
  24. data/cookbooks/postgresql/recipes/server.rb +25 -0
  25. data/cookbooks/postgresql/templates/default/pg_hba.conf.erb +4 -0
  26. data/cookbooks/postgresql/templates/default/postgresql.conf.erb +505 -0
  27. data/cookbooks/postgresql/templates/default/postgresql.monit.conf.erb +11 -0
  28. data/cookbooks/railsapp/attributes/default.rb +22 -0
  29. data/cookbooks/railsapp/recipes/default.rb +65 -0
  30. data/cookbooks/railsapp/templates/default/master.monit.conf.erb +8 -0
  31. data/cookbooks/railsapp/templates/default/site.conf.erb +62 -0
  32. data/cookbooks/railsapp/templates/default/unicorn-init.sh.erb +64 -0
  33. data/cookbooks/railsapp/templates/default/unicorn.rb.erb +37 -0
  34. data/cookbooks/railsapp/templates/default/worker.monit.conf.erb +8 -0
  35. data/lib/mana.rb +5 -0
  36. data/lib/mana/capistrano.rb +93 -0
  37. data/lib/mana/railtie.rb +7 -0
  38. data/lib/mana/version.rb +3 -0
  39. data/lib/tasks/mana.rake +9 -0
  40. data/mana.gemspec +21 -0
  41. data/templates/Vagrantfile +4 -0
  42. data/templates/config/deploy.rb +24 -0
  43. data/templates/config/deploy/vagrant.rb +7 -0
  44. metadata +136 -0
@@ -0,0 +1,4 @@
1
+ local all all trust
2
+ <% if node.postgresql.listen_all -%>
3
+ host all all 0.0.0.0/0 trust
4
+ <% end -%>
@@ -0,0 +1,505 @@
1
+ # -----------------------------
2
+ # PostgreSQL configuration file
3
+ # -----------------------------
4
+ #
5
+ # This file consists of lines of the form:
6
+ #
7
+ # name = value
8
+ #
9
+ # (The "=" is optional.) Whitespace may be used. Comments are introduced with
10
+ # "#" anywhere on a line. The complete list of parameter names and allowed
11
+ # values can be found in the PostgreSQL documentation.
12
+ #
13
+ # The commented-out settings shown in this file represent the default values.
14
+ # Re-commenting a setting is NOT sufficient to revert it to the default value;
15
+ # you need to reload the server.
16
+ #
17
+ # This file is read on server startup and when the server receives a SIGHUP
18
+ # signal. If you edit the file on a running system, you have to SIGHUP the
19
+ # server for the changes to take effect, or use "pg_ctl reload". Some
20
+ # parameters, which are marked below, require a server shutdown and restart to
21
+ # take effect.
22
+ #
23
+ # Any parameter can also be given as a command-line option to the server, e.g.,
24
+ # "postgres -c log_connections=on". Some paramters can be changed at run time
25
+ # with the "SET" SQL command.
26
+ #
27
+ # Memory units: kB = kilobytes MB = megabytes GB = gigabytes
28
+ # Time units: ms = milliseconds s = seconds min = minutes h = hours d = days
29
+
30
+
31
+ #------------------------------------------------------------------------------
32
+ # FILE LOCATIONS
33
+ #------------------------------------------------------------------------------
34
+
35
+ # The default values of these variables are driven from the -D command-line
36
+ # option or PGDATA environment variable, represented here as ConfigDir.
37
+
38
+ data_directory = '/var/lib/postgresql/<%= node.postgresql.version -%>/main' # use data in another directory
39
+ # (change requires restart)
40
+ hba_file = '/etc/postgresql/<%= node.postgresql.version -%>/main/pg_hba.conf' # host-based authentication file
41
+ # (change requires restart)
42
+ ident_file = '/etc/postgresql/<%= node.postgresql.version -%>/main/pg_ident.conf' # ident configuration file
43
+ # (change requires restart)
44
+
45
+ # If external_pid_file is not explicitly set, no extra PID file is written.
46
+ external_pid_file = '/var/run/postgresql/<%= node.postgresql.version -%>-main.pid' # write an extra PID file
47
+ # (change requires restart)
48
+
49
+
50
+ #------------------------------------------------------------------------------
51
+ # CONNECTIONS AND AUTHENTICATION
52
+ #------------------------------------------------------------------------------
53
+
54
+ # - Connection Settings -
55
+
56
+ <% if node.postgresql.listen_all -%>
57
+ listen_addresses = '*' # what IP address(es) to listen on;
58
+ <% else -%>
59
+ #listen_addresses = 'localhost' # what IP address(es) to listen on;
60
+ <% end -%>
61
+
62
+ #listen_addresses = 'localhost' # what IP address(es) to listen on;
63
+ # comma-separated list of addresses;
64
+ # defaults to 'localhost', '*' = all
65
+ # (change requires restart)
66
+ port = 5432 # (change requires restart)
67
+ max_connections = 100 # (change requires restart)
68
+ # Note: Increasing max_connections costs ~400 bytes of shared memory per
69
+ # connection slot, plus lock space (see max_locks_per_transaction). You might
70
+ # also need to raise shared_buffers to support more connections.
71
+ #superuser_reserved_connections = 3 # (change requires restart)
72
+ unix_socket_directory = '/var/run/postgresql' # (change requires restart)
73
+ #unix_socket_group = '' # (change requires restart)
74
+ #unix_socket_permissions = 0777 # begin with 0 to use octal notation
75
+ # (change requires restart)
76
+ #bonjour_name = '' # defaults to the computer name
77
+ # (change requires restart)
78
+
79
+ # - Security and Authentication -
80
+
81
+ #authentication_timeout = 1min # 1s-600s
82
+ <% if node.postgresql.ssl -%>
83
+ ssl = true # (change requires restart)
84
+ <% else -%>
85
+ #ssl = off # (change requires restart)
86
+ <% end -%>
87
+ #ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH' # allowed SSL ciphers
88
+ # (change requires restart)
89
+ #password_encryption = on
90
+ #db_user_namespace = off
91
+
92
+ # Kerberos and GSSAPI
93
+ #krb_server_keyfile = '' # (change requires restart)
94
+ #krb_srvname = 'postgres' # (change requires restart, Kerberos only)
95
+ #krb_server_hostname = '' # empty string matches any keytab entry
96
+ # (change requires restart, Kerberos only)
97
+ #krb_caseins_users = off # (change requires restart)
98
+ #krb_realm = '' # (change requires restart)
99
+
100
+ # - TCP Keepalives -
101
+ # see "man 7 tcp" for details
102
+
103
+ #tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
104
+ # 0 selects the system default
105
+ #tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
106
+ # 0 selects the system default
107
+ #tcp_keepalives_count = 0 # TCP_KEEPCNT;
108
+ # 0 selects the system default
109
+
110
+
111
+ #------------------------------------------------------------------------------
112
+ # RESOURCE USAGE (except WAL)
113
+ #------------------------------------------------------------------------------
114
+
115
+ # - Memory -
116
+
117
+ shared_buffers = 24MB # min 128kB or max_connections*16kB
118
+ # (change requires restart)
119
+ #temp_buffers = 8MB # min 800kB
120
+ #max_prepared_transactions = 5 # can be 0 or more
121
+ # (change requires restart)
122
+ # Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory
123
+ # per transaction slot, plus lock space (see max_locks_per_transaction).
124
+ #work_mem = 1MB # min 64kB
125
+ #maintenance_work_mem = 16MB # min 1MB
126
+ #max_stack_depth = 2MB # min 100kB
127
+
128
+ # - Free Space Map -
129
+
130
+ <% if node['postgresql']['version'].to_f < 8.4 -%>
131
+ max_fsm_pages = 153600 # min max_fsm_relations*16, 6 bytes each
132
+ # (change requires restart)
133
+ #max_fsm_relations = 1000 # min 100, ~70 bytes each
134
+ # (change requires restart)
135
+ <% end -%>
136
+
137
+ # - Kernel Resource Usage -
138
+
139
+ #max_files_per_process = 1000 # min 25
140
+ # (change requires restart)
141
+ #shared_preload_libraries = '' # (change requires restart)
142
+
143
+ # - Cost-Based Vacuum Delay -
144
+
145
+ #vacuum_cost_delay = 0 # 0-1000 milliseconds
146
+ #vacuum_cost_page_hit = 1 # 0-10000 credits
147
+ #vacuum_cost_page_miss = 10 # 0-10000 credits
148
+ #vacuum_cost_page_dirty = 20 # 0-10000 credits
149
+ #vacuum_cost_limit = 200 # 1-10000 credits
150
+
151
+ # - Background Writer -
152
+
153
+ #bgwriter_delay = 200ms # 10-10000ms between rounds
154
+ #bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round
155
+ #bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned/round
156
+
157
+
158
+ #------------------------------------------------------------------------------
159
+ # WRITE AHEAD LOG
160
+ #------------------------------------------------------------------------------
161
+
162
+ # - Settings -
163
+
164
+ #fsync = on # turns forced synchronization on or off
165
+ #synchronous_commit = on # immediate fsync at commit
166
+ #wal_sync_method = fsync # the default is the first option
167
+ # supported by the operating system:
168
+ # open_datasync
169
+ # fdatasync
170
+ # fsync
171
+ # fsync_writethrough
172
+ # open_sync
173
+ #full_page_writes = on # recover from partial page writes
174
+ #wal_buffers = 64kB # min 32kB
175
+ # (change requires restart)
176
+ #wal_writer_delay = 200ms # 1-10000 milliseconds
177
+
178
+ #commit_delay = 0 # range 0-100000, in microseconds
179
+ #commit_siblings = 5 # range 1-1000
180
+
181
+ # - Checkpoints -
182
+
183
+ #checkpoint_segments = 3 # in logfile segments, min 1, 16MB each
184
+ #checkpoint_timeout = 5min # range 30s-1h
185
+ #checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
186
+ #checkpoint_warning = 30s # 0 is off
187
+
188
+ # - Archiving -
189
+
190
+ #archive_mode = off # allows archiving to be done
191
+ # (change requires restart)
192
+ #archive_command = '' # command to use to archive a logfile segment
193
+ #archive_timeout = 0 # force a logfile segment switch after this
194
+ # time; 0 is off
195
+
196
+
197
+ #------------------------------------------------------------------------------
198
+ # QUERY TUNING
199
+ #------------------------------------------------------------------------------
200
+
201
+ # - Planner Method Configuration -
202
+
203
+ #enable_bitmapscan = on
204
+ #enable_hashagg = on
205
+ #enable_hashjoin = on
206
+ #enable_indexscan = on
207
+ #enable_mergejoin = on
208
+ #enable_nestloop = on
209
+ #enable_seqscan = on
210
+ #enable_sort = on
211
+ #enable_tidscan = on
212
+
213
+ # - Planner Cost Constants -
214
+
215
+ #seq_page_cost = 1.0 # measured on an arbitrary scale
216
+ #random_page_cost = 4.0 # same scale as above
217
+ #cpu_tuple_cost = 0.01 # same scale as above
218
+ #cpu_index_tuple_cost = 0.005 # same scale as above
219
+ #cpu_operator_cost = 0.0025 # same scale as above
220
+ #effective_cache_size = 128MB
221
+
222
+ # - Genetic Query Optimizer -
223
+
224
+ #geqo = on
225
+ #geqo_threshold = 12
226
+ #geqo_effort = 5 # range 1-10
227
+ #geqo_pool_size = 0 # selects default based on effort
228
+ #geqo_generations = 0 # selects default based on effort
229
+ #geqo_selection_bias = 2.0 # range 1.5-2.0
230
+
231
+ # - Other Planner Options -
232
+
233
+ #default_statistics_target = 10 # range 1-1000
234
+ #constraint_exclusion = off
235
+ #from_collapse_limit = 8
236
+ #join_collapse_limit = 8 # 1 disables collapsing of explicit
237
+ # JOIN clauses
238
+
239
+
240
+ #------------------------------------------------------------------------------
241
+ # ERROR REPORTING AND LOGGING
242
+ #------------------------------------------------------------------------------
243
+
244
+ # - Where to Log -
245
+
246
+ #log_destination = 'stderr' # Valid values are combinations of
247
+ # stderr, csvlog, syslog and eventlog,
248
+ # depending on platform. csvlog
249
+ # requires logging_collector to be on.
250
+
251
+ # This is used when logging to stderr:
252
+ #logging_collector = off # Enable capturing of stderr and csvlog
253
+ # into log files. Required to be on for
254
+ # csvlogs.
255
+ # (change requires restart)
256
+
257
+ # These are only used if logging_collector is on:
258
+ #log_directory = 'pg_log' # directory where log files are written,
259
+ # can be absolute or relative to PGDATA
260
+ #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
261
+ # can include strftime() escapes
262
+ #log_truncate_on_rotation = off # If on, an existing log file of the
263
+ # same name as the new log file will be
264
+ # truncated rather than appended to.
265
+ # But such truncation only occurs on
266
+ # time-driven rotation, not on restarts
267
+ # or size-driven rotation. Default is
268
+ # off, meaning append to existing files
269
+ # in all cases.
270
+ #log_rotation_age = 1d # Automatic rotation of logfiles will
271
+ # happen after that time. 0 to disable.
272
+ #log_rotation_size = 10MB # Automatic rotation of logfiles will
273
+ # happen after that much log output.
274
+ # 0 to disable.
275
+
276
+ # These are relevant when logging to syslog:
277
+ #syslog_facility = 'LOCAL0'
278
+ #syslog_ident = 'postgres'
279
+
280
+
281
+ # - When to Log -
282
+
283
+ #client_min_messages = notice # values in order of decreasing detail:
284
+ # debug5
285
+ # debug4
286
+ # debug3
287
+ # debug2
288
+ # debug1
289
+ # log
290
+ # notice
291
+ # warning
292
+ # error
293
+
294
+ #log_min_messages = notice # values in order of decreasing detail:
295
+ # debug5
296
+ # debug4
297
+ # debug3
298
+ # debug2
299
+ # debug1
300
+ # info
301
+ # notice
302
+ # warning
303
+ # error
304
+ # log
305
+ # fatal
306
+ # panic
307
+
308
+ #log_error_verbosity = default # terse, default, or verbose messages
309
+
310
+ #log_min_error_statement = error # values in order of decreasing detail:
311
+ # debug5
312
+ # debug4
313
+ # debug3
314
+ # debug2
315
+ # debug1
316
+ # info
317
+ # notice
318
+ # warning
319
+ # error
320
+ # log
321
+ # fatal
322
+ # panic (effectively off)
323
+
324
+ #log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements
325
+ # and their durations, > 0 logs only
326
+ # statements running at least this time.
327
+
328
+ #silent_mode = off # DO NOT USE without syslog or
329
+ # logging_collector
330
+ # (change requires restart)
331
+
332
+ # - What to Log -
333
+
334
+ #debug_print_parse = off
335
+ #debug_print_rewritten = off
336
+ #debug_print_plan = off
337
+ #debug_pretty_print = off
338
+ #log_checkpoints = off
339
+ #log_connections = off
340
+ #log_disconnections = off
341
+ #log_duration = off
342
+ #log_hostname = off
343
+ log_line_prefix = '%t ' # special values:
344
+ # %u = user name
345
+ # %d = database name
346
+ # %r = remote host and port
347
+ # %h = remote host
348
+ # %p = process ID
349
+ # %t = timestamp without milliseconds
350
+ # %m = timestamp with milliseconds
351
+ # %i = command tag
352
+ # %c = session ID
353
+ # %l = session line number
354
+ # %s = session start timestamp
355
+ # %v = virtual transaction ID
356
+ # %x = transaction ID (0 if none)
357
+ # %q = stop here in non-session
358
+ # processes
359
+ # %% = '%'
360
+ # e.g. '<%%u%%%d> '
361
+ #log_lock_waits = off # log lock waits >= deadlock_timeout
362
+ #log_statement = 'none' # none, ddl, mod, all
363
+ #log_temp_files = -1 # log temporary files equal or larger
364
+ # than specified size;
365
+ # -1 disables, 0 logs all temp files
366
+ #log_timezone = unknown # actually, defaults to TZ environment
367
+ # setting
368
+
369
+
370
+ #------------------------------------------------------------------------------
371
+ # RUNTIME STATISTICS
372
+ #------------------------------------------------------------------------------
373
+
374
+ # - Query/Index Statistics Collector -
375
+
376
+ #track_activities = on
377
+ #track_counts = on
378
+ #update_process_title = on
379
+
380
+
381
+ # - Statistics Monitoring -
382
+
383
+ #log_parser_stats = off
384
+ #log_planner_stats = off
385
+ #log_executor_stats = off
386
+ #log_statement_stats = off
387
+
388
+
389
+ #------------------------------------------------------------------------------
390
+ # AUTOVACUUM PARAMETERS
391
+ #------------------------------------------------------------------------------
392
+
393
+ #autovacuum = on # Enable autovacuum subprocess? 'on'
394
+ # requires track_counts to also be on.
395
+ #log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and
396
+ # their durations, > 0 logs only
397
+ # actions running at least that time.
398
+ #autovacuum_max_workers = 3 # max number of autovacuum subprocesses
399
+ #autovacuum_naptime = 1min # time between autovacuum runs
400
+ #autovacuum_vacuum_threshold = 50 # min number of row updates before
401
+ # vacuum
402
+ #autovacuum_analyze_threshold = 50 # min number of row updates before
403
+ # analyze
404
+ #autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
405
+ #autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
406
+ #autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
407
+ # (change requires restart)
408
+ #autovacuum_vacuum_cost_delay = 20 # default vacuum cost delay for
409
+ # autovacuum, -1 means use
410
+ # vacuum_cost_delay
411
+ #autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for
412
+ # autovacuum, -1 means use
413
+ # vacuum_cost_limit
414
+
415
+
416
+ #------------------------------------------------------------------------------
417
+ # CLIENT CONNECTION DEFAULTS
418
+ #------------------------------------------------------------------------------
419
+
420
+ # - Statement Behavior -
421
+
422
+ #search_path = '"$user",public' # schema names
423
+ #default_tablespace = '' # a tablespace name, '' uses the default
424
+ #temp_tablespaces = '' # a list of tablespace names, '' uses
425
+ # only default tablespace
426
+ #check_function_bodies = on
427
+ #default_transaction_isolation = 'read committed'
428
+ #default_transaction_read_only = off
429
+ #session_replication_role = 'origin'
430
+ #statement_timeout = 0 # 0 is disabled
431
+ #vacuum_freeze_min_age = 100000000
432
+ #xmlbinary = 'base64'
433
+ #xmloption = 'content'
434
+
435
+ # - Locale and Formatting -
436
+
437
+ datestyle = 'iso, mdy'
438
+ #timezone = unknown # actually, defaults to TZ environment
439
+ # setting
440
+ #timezone_abbreviations = 'Default' # Select the set of available time zone
441
+ # abbreviations. Currently, there are
442
+ # Default
443
+ # Australia
444
+ # India
445
+ # You can create your own file in
446
+ # share/timezonesets/.
447
+ #extra_float_digits = 0 # min -15, max 2
448
+ #client_encoding = sql_ascii # actually, defaults to database
449
+ # encoding
450
+
451
+ # These settings are initialized by initdb, but they can be changed.
452
+ #lc_messages = 'en_US.UTF-8' # locale for system error message
453
+ # strings
454
+ #lc_monetary = 'en_US.UTF-8' # locale for monetary formatting
455
+ #lc_numeric = 'en_US.UTF-8' # locale for number formatting
456
+ #lc_time = 'en_US.UTF-8' # locale for time formatting
457
+
458
+ # default configuration for text search
459
+ default_text_search_config = 'pg_catalog.english'
460
+
461
+ # - Other Defaults -
462
+
463
+ #explain_pretty_print = on
464
+ #dynamic_library_path = '$libdir'
465
+ #local_preload_libraries = ''
466
+
467
+
468
+ #------------------------------------------------------------------------------
469
+ # LOCK MANAGEMENT
470
+ #------------------------------------------------------------------------------
471
+
472
+ #deadlock_timeout = 1s
473
+ #max_locks_per_transaction = 64 # min 10
474
+ # (change requires restart)
475
+ # Note: Each lock table slot uses ~270 bytes of shared memory, and there are
476
+ # max_locks_per_transaction * (max_connections + max_prepared_transactions)
477
+ # lock table slots.
478
+
479
+
480
+ #------------------------------------------------------------------------------
481
+ # VERSION/PLATFORM COMPATIBILITY
482
+ #------------------------------------------------------------------------------
483
+
484
+ # - Previous PostgreSQL Versions -
485
+
486
+ #add_missing_from = off
487
+ #array_nulls = on
488
+ #backslash_quote = safe_encoding # on, off, or safe_encoding
489
+ #default_with_oids = off
490
+ #escape_string_warning = on
491
+ #regex_flavor = advanced # advanced, extended, or basic
492
+ #sql_inheritance = on
493
+ #standard_conforming_strings = off
494
+ #synchronize_seqscans = on
495
+
496
+ # - Other Platforms and Clients -
497
+
498
+ #transform_null_equals = off
499
+
500
+
501
+ #------------------------------------------------------------------------------
502
+ # CUSTOMIZED OPTIONS
503
+ #------------------------------------------------------------------------------
504
+
505
+ #custom_variable_classes = '' # list of custom variable class names