summaryrefslogtreecommitdiff
path: root/puppet/modules/passenger/manifests/init.pp
blob: ed9b8c315769539f150fe23916a70e5460274194 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# passenger module
#
# Copyright 2010, Riseup Networks
# Micah Anderson micah(at)riseup.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.

class passenger (
  $use_gems = false, $manage_munin = false,
  $passenger_ensure_version = 'installed',
  $librack_ensure_version = 'installed',
  $passenger_bin_path = '/usr/sbin' )
{
  Class['::apache'] -> Class['passenger']

  if ! $use_gems {

    apache::module { 'passenger':
      ensure       => $passenger_ensure_version,
      package_name => 'libapache2-mod-passenger';
    }

    if !defined(Package['librack-ruby']) {
      if $::lsbdistcodename == 'squeeze' {
        package { 'librack-ruby1.8': ensure => $librack_ensure_version }
      }
      else {
        package { 'ruby-rack':
          ensure => $librack_ensure_version;
        }
      }
    }
  }
  else {
    package {
      'passenger':
        ensure   => $passenger_ensure_version,
        provider => gem;
      'rack':
        ensure   => $librack_ensure_version,
        provider => gem;
    }
  }

  apache::config::file { 'mod_passenger':
    ensure => present,
    source => [ "puppet:///modules/site_passenger/${::fqdn}/mod_passenger.conf",
                'puppet:///modules/site_passenger/mod_passenger.conf',
                'puppet:///modules/passenger/mod_passenger.conf',
              ],
  }

  if $manage_munin {
    if $passenger_memory_munin_config == '' {
      $passenger_memory_munin_config = "user root\nenv.passenger_memory_stats ${passenger_bin_path}/passenger-memory-stats"
    }

    if $passenger_stats_munin_config == '' {
      $passenger_stats_munin_config = "user root\nenv.passenger_status ${passenger_bin_path}/passenger-status"
    }

    munin::plugin::deploy {
      'passenger_memory_stats':
        source => 'passenger/munin/passenger_memory_stats',
        config => $passenger_memory_munin_config;
      'passenger_stats':
        source => 'passenger/munin/passenger_stats',
        config => $passenger_stats_munin_config;
    }
  }

}