Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: modules/hgweb/manifests/init.pp

Issue 29323409: Issue 2867 - Introduce module hgweb and corresponding server role (Closed)
Left Patch Set: Created Aug. 10, 2015, 8:15 a.m.
Right Patch Set: Issue 2867 - Now the complete patch-set again Created Aug. 17, 2015, 6:17 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « modules/hgweb/files/robots.txt ('k') | modules/hgweb/templates/hgrc.erb » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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*]
(...skipping 13 matching lines...) Expand all
24 # 24 #
25 # === Examples: 25 # === Examples:
26 # 26 #
27 # class {'hgweb': 27 # class {'hgweb':
28 # domain => 'localhost', 28 # domain => 'localhost',
29 # } 29 # }
30 # 30 #
31 class hgweb( 31 class hgweb(
32 $domain, 32 $domain,
33 $is_default = false, 33 $is_default = false,
34 $certificate = undef, 34 $certificate = hiera('hgweb::certificate', 'undef'),
35 $private_key = undef, 35 $private_key = hiera('hgweb::private_key', 'undef'),
36 $hgaccess = 'puppet:///modules/hgweb/hgaccess', 36 $hgaccess = 'puppet:///modules/hgweb/hgaccess',
37 ) { 37 ) {
38 38
39 include ssh, nginx 39 include ssh, nginx
40 40
41 $required_packages = ['mercurial-common', 'python-flup', 'spawn-fcgi'] 41 $required_packages = ['mercurial-common', 'python-flup', 'spawn-fcgi']
42 ensure_packages($required_packages) 42 ensure_packages($required_packages)
43 43
44 class {'sitescripts': 44 class {'sitescripts':
45 sitescriptsini_content => template('hgweb/sitescripts.ini.erb'), 45 sitescriptsini_content => template('hgweb/sitescripts.ini.erb'),
46 } 46 }
47 47
48 48
49 user {'hg': 49 user {'hg':
50 comment => 'hgweb', 50 comment => 'hgweb',
51 groups => ['www-data'], 51 groups => ['www-data'],
52 home => '/home/hg', 52 home => '/home/hg',
53 managehome => true, 53 managehome => true,
54 shell => '/bin/bash', 54 shell => '/bin/bash',
55 } 55 }
56
57 56
58 file {'/home/hg/.ssh': 57 file {'/home/hg/.ssh':
59 ensure => 'directory', 58 ensure => 'directory',
60 group => 'hg', 59 group => 'hg',
61 mode => 0750, 60 mode => 0750,
62 owner => 'hg', 61 owner => 'hg',
63 require => User['hg'], 62 require => User['hg'],
64 } 63 }
65 64
66 file {'/home/hg/web': 65 file {'/home/hg/web':
(...skipping 19 matching lines...) Expand all
86 content => template('hgweb/hgrc.erb'), 85 content => template('hgweb/hgrc.erb'),
87 group => 'hg', 86 group => 'hg',
88 mode => 0644, 87 mode => 0644,
89 owner => 'hg', 88 owner => 'hg',
90 require => [ 89 require => [
91 Class['sitescripts'], 90 Class['sitescripts'],
92 Exec['hgaccess_init'], 91 Exec['hgaccess_init'],
93 ], 92 ],
94 } 93 }
95 94
96
97 exec {'hgaccess_init': 95 exec {'hgaccess_init':
98 command => 'hg init .', 96 command => 'hg init .',
99 creates => '/home/hg/web/hgaccess/.hg', 97 creates => '/home/hg/web/hgaccess/.hg',
100 cwd => '/home/hg/web/hgaccess', 98 cwd => '/home/hg/web/hgaccess',
101 logoutput => true, 99 logoutput => true,
102 path => '/usr/local/bin:/usr/bin:/bin', 100 path => '/usr/local/bin:/usr/bin:/bin',
103 require => File['/home/hg/web/hgaccess'], 101 require => File['/home/hg/web/hgaccess'],
104 user => 'hg', 102 user => 'hg',
105 } 103 }
106 104
107 exec {'hgaccess_commit': 105 exec {'hgaccess_commit':
108 command => 'hg add . && hg commit -u Puppet -m "Initial commit"', 106 command => 'hg add . && hg commit -u Puppet -m "Initial commit"',
109 creates => '/home/hg/.ssh/authorized_keys', 107 creates => '/home/hg/.ssh/authorized_keys',
110 cwd => '/home/hg/web/hgaccess', 108 cwd => '/home/hg/web/hgaccess',
111 environment => ['PYTHONPATH=/opt/sitescripts'], 109 environment => ['PYTHONPATH=/opt/sitescripts'],
112 logoutput => true, 110 logoutput => true,
113 path => '/usr/local/bin:/usr/bin:/bin', 111 path => '/usr/local/bin:/usr/bin:/bin',
114 require => [ 112 require => [
115 File['/home/hg/web/hgaccess/.hg/hgrc'], 113 File['/home/hg/web/hgaccess/.hg/hgrc'],
116 File['/home/hg/.ssh'], 114 File['/home/hg/.ssh'],
117 ], 115 ],
118 user => 'hg', 116 user => 'hg',
119 } 117 }
120 118
121
122 concat::fragment {'sshd_user_hg': 119 concat::fragment {'sshd_user_hg':
123 content => 'Match User hg 120 content => 'Match User hg
124 AllowTcpForwarding no 121 AllowTcpForwarding no
125 X11Forwarding no 122 X11Forwarding no
126 AllowAgentForwarding no 123 AllowAgentForwarding no
127 GatewayPorts no 124 GatewayPorts no
128 ForceCommand cd ~/web && PYTHONPATH=/opt/sitescripts hg-ssh $HGREPOS 125 ForceCommand cd ~/web && PYTHONPATH=/opt/sitescripts hg-ssh $HGREPOS
129 ', 126 ',
130 order => '99', 127 order => '99',
131 target => 'sshd_config', 128 target => 'sshd_config',
132 } 129 }
133
134 130
135 file {'/etc/hgweb.ini': 131 file {'/etc/hgweb.ini':
136 mode => 644, 132 mode => 644,
137 require => Package[$required_packages], 133 require => Package[$required_packages],
138 source => 'puppet:///modules/hgweb/hgweb.ini', 134 source => 'puppet:///modules/hgweb/hgweb.ini',
139 } 135 }
140 136
141 file {'/opt/hgweb.fcgi': 137 file {'/opt/hgweb.fcgi':
142 mode => 755, 138 mode => 755,
143 require => File['/etc/hgweb.ini'], 139 require => File['/etc/hgweb.ini'],
(...skipping 18 matching lines...) Expand all
162 enable => true, 158 enable => true,
163 ensure => 'running', 159 ensure => 'running',
164 hasrestart => true, 160 hasrestart => true,
165 hasstatus => false, 161 hasstatus => false,
166 pattern => 'hgweb.fcgi', 162 pattern => 'hgweb.fcgi',
167 require => File['/etc/init.d/hgweb'], 163 require => File['/etc/init.d/hgweb'],
168 subscribe => File['/etc/hgweb.ini'], 164 subscribe => File['/etc/hgweb.ini'],
169 } 165 }
170 166
171 nginx::hostconfig {$domain: 167 nginx::hostconfig {$domain:
172 certificate => $certificate, 168 certificate => $certificate ? {
173 content => 'puppet:///modules/hgweb/nginx.conf', 169 'undef' => undef,
170 default => $certificate,
171 },
172 source => 'puppet:///modules/hgweb/nginx.conf',
174 is_default => $is_default, 173 is_default => $is_default,
175 log => 'access_log_hg', 174 log => 'access_log_hg',
176 private_key => $private_key, 175 private_key => $private_key ? {
176 'undef' => undef,
177 default => $private_key,
178 },
177 } 179 }
178 } 180 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld