| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 # == Class: hgweb | 1 # == Class: hgweb |
| 2 # | 2 # |
| 3 # A hgweb server setup. | 3 # A hgweb server setup. |
| 4 # | 4 # |
| 5 # === Parameters: | 5 # === Parameters: |
| 6 # | 6 # |
| 7 # [*domain*] | 7 # [*domain*] |
| 8 # The auhority part of the URL the instance is associated with. | 8 # The auhority part of the URL the instance is associated with. |
| 9 # | 9 # |
| 10 # [*is_default*] | 10 # [*is_default*] |
| 11 # Whether the $domain shall become set up as default (or fallback) | 11 # Whether the $domain shall become set up as default (or fallback) |
| 12 # within the HTTP daemon. | 12 # within the HTTP daemon. |
| 13 # | 13 # |
| 14 # [*certificate*] | 14 # [*certificate*] |
| 15 # The name of the SSL certificate file within modules/private/files, if | 15 # The name of the SSL certificate file within modules/private/files, if |
| 16 # any. Requires a private_key as well. | 16 # any. Requires a private_key as well. |
| 17 # | 17 # |
| 18 # [*private_key*] | 18 # [*private_key*] |
| 19 # The name of the private key file within modules/private/files, if any. | 19 # The name of the private key file within modules/private/files, if any. |
| 20 # Requires a certificate as well. | 20 # Requires a certificate as well. |
| 21 # | 21 # |
| 22 # [*hgaccess*] | 22 # [*hgaccess*] |
| 23 # A prototype directory source for the hgaccess repository. | 23 # A prototype directory source for the hgaccess repository. |
| 24 # | |
| 25 # [*templates*] | |
| 26 # A directory providing custom /static/ resources to be used instead | |
| 27 # of the ones that ship with package mercurial. | |
| 24 # | 28 # |
| 25 # === Examples: | 29 # === Examples: |
| 26 # | 30 # |
| 27 # class {'hgweb': | 31 # class {'hgweb': |
| 28 # domain => 'localhost', | 32 # domain => 'localhost', |
| 29 # } | 33 # } |
| 30 # | 34 # |
| 31 class hgweb( | 35 class hgweb( |
| 32 $domain, | 36 $domain, |
| 33 $is_default = false, | 37 $is_default = false, |
| 34 $certificate = hiera('hgweb::certificate', 'undef'), | 38 $certificate = hiera('hgweb::certificate', 'undef'), |
| 35 $private_key = hiera('hgweb::private_key', 'undef'), | 39 $private_key = hiera('hgweb::private_key', 'undef'), |
| 36 $hgaccess = 'puppet:///modules/hgweb/hgaccess', | 40 $hgaccess = 'puppet:///modules/hgweb/hgaccess', |
| 37 $templates = hiera('hgweb::templates', '/usr/share/mercurial/templates'), | 41 $templates = hiera('hgweb::templates', '/usr/share/mercurial/templates'), |
|
Wladimir Palant
2015/08/24 18:37:02
I might have said this before but I'm no fan of ad
mathias
2015/08/24 19:03:08
Me neither.
| |
| 38 ) { | 42 ) { |
| 39 | 43 |
| 40 include ssh, nginx | 44 include ssh, nginx |
| 41 | 45 |
| 42 $required_packages = ['mercurial-common', 'python-flup', 'spawn-fcgi'] | 46 $required_packages = ['mercurial-common', 'python-flup', 'spawn-fcgi'] |
| 43 ensure_packages($required_packages) | 47 ensure_packages($required_packages) |
| 44 | 48 |
| 45 class {'sitescripts': | 49 class {'sitescripts': |
| 46 sitescriptsini_content => template('hgweb/sitescripts.ini.erb'), | 50 sitescriptsini_content => template('hgweb/sitescripts.ini.erb'), |
| 47 } | 51 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 Exec['hgaccess_init'], | 95 Exec['hgaccess_init'], |
| 92 ], | 96 ], |
| 93 } | 97 } |
| 94 | 98 |
| 95 exec {'hgaccess_init': | 99 exec {'hgaccess_init': |
| 96 command => 'hg init .', | 100 command => 'hg init .', |
| 97 creates => '/home/hg/web/hgaccess/.hg', | 101 creates => '/home/hg/web/hgaccess/.hg', |
| 98 cwd => '/home/hg/web/hgaccess', | 102 cwd => '/home/hg/web/hgaccess', |
| 99 logoutput => true, | 103 logoutput => true, |
| 100 path => '/usr/local/bin:/usr/bin:/bin', | 104 path => '/usr/local/bin:/usr/bin:/bin', |
| 101 require => File['/home/hg/web/hgaccess'], | 105 require => [ |
| 106 File['/home/hg/web/hgaccess'], | |
| 107 Package['mercurial'], | |
| 108 ], | |
| 102 user => 'hg', | 109 user => 'hg', |
| 103 } | 110 } |
| 104 | 111 |
| 105 exec {'hgaccess_commit': | 112 exec {'hgaccess_commit': |
| 106 command => 'hg add . && hg commit -u Puppet -m "Initial commit"', | 113 command => 'hg add . && hg commit -u Puppet -m "Initial commit"', |
| 107 creates => '/home/hg/.ssh/authorized_keys', | 114 creates => '/home/hg/.ssh/authorized_keys', |
| 108 cwd => '/home/hg/web/hgaccess', | 115 cwd => '/home/hg/web/hgaccess', |
| 109 environment => ['PYTHONPATH=/opt/sitescripts'], | 116 environment => ['PYTHONPATH=/opt/sitescripts'], |
| 110 logoutput => true, | 117 logoutput => true, |
| 111 path => '/usr/local/bin:/usr/bin:/bin', | 118 path => '/usr/local/bin:/usr/bin:/bin', |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 pattern => 'hgweb.fcgi', | 169 pattern => 'hgweb.fcgi', |
| 163 require => File['/etc/init.d/hgweb'], | 170 require => File['/etc/init.d/hgweb'], |
| 164 subscribe => File['/etc/hgweb.ini'], | 171 subscribe => File['/etc/hgweb.ini'], |
| 165 } | 172 } |
| 166 | 173 |
| 167 nginx::hostconfig {$domain: | 174 nginx::hostconfig {$domain: |
| 168 certificate => $certificate ? { | 175 certificate => $certificate ? { |
| 169 'undef' => undef, | 176 'undef' => undef, |
| 170 default => $certificate, | 177 default => $certificate, |
| 171 }, | 178 }, |
| 172 content => template('hgweb/nginx.conf.erb'), | 179 source => 'puppet:///modules/hgweb/nginx.conf', |
| 173 is_default => $is_default, | 180 is_default => $is_default, |
| 181 global_config => template('hgweb/nginx_global.conf.erb'), | |
| 174 log => 'access_log_hg', | 182 log => 'access_log_hg', |
| 175 private_key => $private_key ? { | 183 private_key => $private_key ? { |
| 176 'undef' => undef, | 184 'undef' => undef, |
| 177 default => $private_key, | 185 default => $private_key, |
| 178 }, | 186 }, |
| 179 } | 187 } |
| 180 } | 188 } |
| LEFT | RIGHT |