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

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

Issue 5735669590654976: #753 - set up an order system to let eyeo employees file order requests (Closed)
Left Patch Set: #753 - set up an order system to let eyeo employees file order requests Created July 22, 2014, 12:47 a.m.
Right Patch Set: #753 - set up an order system to let eyeo employees file order requests Created Aug. 6, 2014, 12:38 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/trac/files/trac.ini ('k') | modules/trac/templates/fcgi.conf.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 trac( 1 class trac(
2 $domain, 2 $domain,
3 $certificate, 3 $certificate,
4 $private_key, 4 $private_key,
5 $permissions = "puppet:///modules/trac/permissions.csv", 5 $fcgi_config_dir = '/etc/nginx/trac.d',
Wladimir Palant 2014/07/22 13:52:24 Shouldn't this be an instance parameter? While thi
6 $is_default = false) inherits private::trac { 6 $is_default = false) inherits private::trac {
7 7
8 package {['python-mysqldb','python-pip','subversion', 'tofrodos', 'graphviz']: 8 package {['python-mysqldb','python-pip','subversion', 'tofrodos', 'graphviz']:
9 ensure => present 9 ensure => present
10 } 10 }
11 11
12 include nginx, spawn-fcgi 12 include nginx, spawn-fcgi
13 13
14 file {$fcgi_config_dir:
15 ensure => directory,
16 owner => 'root',
17 mode => 755,
18 require => Package['nginx'],
19 }
20
14 nginx::hostconfig {$domain: 21 nginx::hostconfig {$domain:
15 source => 'puppet:///modules/trac/site.conf', 22 content => "include $fcgi_config_dir/*;",
mathias 2014/07/24 16:36:49 What about a directory to write the necessary frag
16 is_default => $is_default, 23 is_default => $is_default,
17 certificate => $certificate, 24 certificate => $certificate,
18 private_key => $private_key, 25 private_key => $private_key,
19 log => 'access_log_trac' 26 log => 'access_log_trac',
27 require => File[$fcgi_config_dir],
20 } 28 }
21 29
22 user {'trac': 30 user {'trac':
23 ensure => present, 31 ensure => present,
24 comment => 'User of the trac installation', 32 comment => 'User of the trac installation',
25 home => '/home/trac', 33 home => '/home/trac',
26 managehome => true 34 managehome => true
27 } 35 }
28 36
29 class {'mysql::server': 37 class {'mysql::server':
30 root_password => $database_root_password, 38 root_password => $database_root_password,
31 override_options => {
32 'mysqld' => { 'federated' => true },
33 },
34 restart => true,
35 } 39 }
36 40
37 Exec { 41 Exec {
38 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', 42 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
39 } 43 }
40 44
41 exec { 'install_trac': 45 exec { 'install_trac':
42 command => "pip install Trac==1.0.1", 46 command => "pip install Trac==1.0.1",
43 require => Package['python-pip'], 47 require => Package['python-pip'],
44 unless => "python -c 'import trac,sys;sys.exit(0 if trac.__version__ == \"1. 0.1\" else 1)'", 48 unless => "python -c 'import trac,sys;sys.exit(0 if trac.__version__ == \"1. 0.1\" else 1)'",
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 'python-pip'], 107 'python-pip'],
104 unless => "python -c 'import tracspamfilter'", 108 unless => "python -c 'import tracspamfilter'",
105 } 109 }
106 110
107 exec { 'install_Tractags': 111 exec { 'install_Tractags':
108 command => "pip install svn+http://trac-hacks.org/svn/tagsplugin/tags/0.7/", 112 command => "pip install svn+http://trac-hacks.org/svn/tagsplugin/tags/0.7/",
109 require => Package['python-pip'], 113 require => Package['python-pip'],
110 unless => "python -c 'import tractags'", 114 unless => "python -c 'import tractags'",
111 } 115 }
112 116
113 file {"/home/trac/permissions.csv": 117 exec { 'install_PrivateTickets':
118 command => "pip install svn+http://trac-hacks.org/svn/privateticketsplugin/t ags/2.0.2/",
119 require => Package['subversion', 'python-pip'],
120 unless => "python -c 'import privatetickets'",
121 }
122
123 file { '/home/trac/trac.ini':
114 ensure => present, 124 ensure => present,
115 owner => trac, 125 source => 'puppet:///modules/trac/trac.ini',
116 source => $permissions, 126 owner => 'trac',
127 mode => 644,
117 } 128 }
118 129
119 define instance ( 130 define instance (
120 $config = 'trac/trac.ini.erb', 131 $config = 'trac/trac.ini.erb',
121 $description = 'Issue Tracker', 132 $description = 'Issue Tracker',
122 $environment = 'environment',
123 $location = '/', 133 $location = '/',
124 $logo = 'eyeo_logo.png', 134 $logo = 'puppet:///modules/trac/logo.png',
125 $database = 'trac', 135 $database = 'trac',
126 $database_password = $private::trac::database_password, 136 $permissions = 'puppet:///modules/trac/permissions.csv',
127 $theme = 'puppet:///modules/trac/theme.css') { 137 $theme = 'puppet:///modules/trac/theme.css') {
138
139 $database_password = $private::trac::database_password
140 $environment = "environment-$name"
128 141
129 mysql::db {$database: 142 mysql::db {$database:
130 user => 'trac', 143 user => 'trac',
131 password => $database_password, 144 password => $database_password,
132 host => 'localhost', 145 host => 'localhost',
133 grant => ['all'], 146 grant => ['all'],
134 charset => 'utf8', 147 charset => 'utf8',
135 collate => 'utf8_bin', 148 collate => 'utf8_bin',
136 require => Class['mysql::server'], 149 require => Class['mysql::server'],
137 } 150 }
138 151
139 exec {"trac_env_$name": 152 $location_base = regsubst($location, '/+$', '')
140 command => "trac-admin /home/trac/$environment initenv \"$description\" my sql://trac:${database_password}@localhost:3306/$database", 153
Wladimir Palant 2014/07/31 09:46:53 Indeed, didn't know it existed. We should use that
154 file {"${trac::fcgi_config_dir}/${name}.conf":
155 ensure => file,
156 owner => 'root',
157 mode => 644,
158 content => template('trac/fcgi.conf.erb'),
159 require => File[$trac::fcgi_config_dir],
160 notify => Service['nginx'],
161 }
162
163 exec {"trac_env_${name}":
164 command => shellquote(
165 'trac-admin', "/home/trac/$environment", 'initenv', $description,
166 "mysql://trac:${database_password}@localhost:3306/$database"),
167 logoutput => true,
141 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', 168 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
142 require => [ 169 require => [
143 Exec['install_trac'], 170 Exec['install_trac'],
144 Mysql_grant["trac@localhost/$database.*"] 171 Mysql_grant["trac@localhost/${database}.*"]],
145 ], 172 user => trac,
146 user => trac, 173 unless => "test -d /home/trac/$environment",
147 unless => "test -d /home/trac/$environment" 174 }
175
176 file {"/home/trac/${environment}/conf/permissions.csv":
177 ensure => present,
178 owner => trac,
179 source => $permissions,
180 require => Exec["trac_env_$name"],
148 } 181 }
149 182
150 file {"/home/trac/$environment/conf/trac.ini": 183 file {"/home/trac/$environment/conf/trac.ini":
151 ensure => present, 184 ensure => present,
152 content => template($config), 185 content => template($config),
153 owner => trac, 186 owner => trac,
154 require => Exec["trac_env_$name"] 187 require => Exec["trac_env_$name"]
155 } 188 }
156 189
157 file {"/home/trac/$environment/htdocs/theme.css": 190 file {"/home/trac/$environment/htdocs/theme.css":
(...skipping 11 matching lines...) Expand all
169 File["/home/trac/$environment/conf/trac.ini"], 202 File["/home/trac/$environment/conf/trac.ini"],
170 Exec['install_SensitiveTickets'], 203 Exec['install_SensitiveTickets'],
171 Exec['install_BlackMagicTicketTweaks'], 204 Exec['install_BlackMagicTicketTweaks'],
172 Exec['install_AccountManager'], 205 Exec['install_AccountManager'],
173 Exec['install_AutocompleteUsers'], 206 Exec['install_AutocompleteUsers'],
174 Exec['install_TicketTemplate'], 207 Exec['install_TicketTemplate'],
175 Exec['install_NeverNotifyUpdater'], 208 Exec['install_NeverNotifyUpdater'],
176 Exec['install_MasterTickets'], 209 Exec['install_MasterTickets'],
177 Exec['install_ThemeEngine'], 210 Exec['install_ThemeEngine'],
178 Exec['install_Tractags'], 211 Exec['install_Tractags'],
179 Exec['install_TracSpamFilter']] 212 Exec['install_TracSpamFilter'],
213 Exec['install_PrivateTickets']],
180 } 214 }
181 215
182 exec {"deploy_$name": 216 exec {"deploy_$name":
183 command => "trac-admin /home/trac/$environment deploy /home/trac/htdocs && fromdos /home/trac/htdocs/cgi-bin/trac.fcgi && chmod 755 /home/trac/htdocs/cgi- bin/trac.fcgi", 217 command => "trac-admin /home/trac/$environment \
218 deploy /home/trac/htdocs-$name \
219 && fromdos /home/trac/htdocs-$name/cgi-bin/trac.fcgi \
220 && chmod 755 /home/trac/htdocs-$name/cgi-bin/trac.fcgi",
184 user => trac, 221 user => trac,
185 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', 222 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
186 require => [ 223 require => [
187 Exec["update_env_$name"], 224 Exec["update_env_$name"],
188 Package["tofrodos"]] 225 Package["tofrodos"]],
189 } 226 }
190 227
191 file {"/home/trac/htdocs/htdocs/common/$logo": 228 file {"/home/trac/htdocs-$name/htdocs/common/logo.png":
192 ensure => present, 229 ensure => present,
193 source => "puppet:///modules/trac/$logo", 230 source => $logo,
194 owner => trac, 231 owner => trac,
195 require => Exec["deploy_$name"], 232 require => Exec["deploy_$name"],
196 } 233 }
197 234
198 file {"/home/trac/htdocs/cgi-bin/trac.fcgi.$name": 235 spawn-fcgi::pool {"tracd_${name}":
199 ensure => present, 236 ensure => present,
200 owner => trac, 237 fcgi_app => "/home/trac/htdocs-$name/cgi-bin/trac.fcgi",
201 mode => 774,
202 content => "#!/bin/sh
203 SCRIPT=`dirname \$0`/`basename \$0 .$name`
204 TRAC_ENV=/home/trac/$environment \$SCRIPT \"\$@\"
Wladimir Palant 2014/07/22 13:52:24 This hack is only necessary because of reusing the
205 ",
206 require => Exec["deploy_$name"],
207 }
208
209 spawn-fcgi::pool {"tracd_$name":
210 ensure => present,
211 fcgi_app => "/home/trac/htdocs/cgi-bin/trac.fcgi.$name",
212 socket => "/tmp/${name}-fastcgi.sock", 238 socket => "/tmp/${name}-fastcgi.sock",
213 mode => "0666", 239 mode => "0666",
214 user => trac, 240 user => trac,
215 children => 1, 241 children => 1,
216 require => File["/home/trac/htdocs/cgi-bin/trac.fcgi.$name"], 242 require => Exec["deploy_$name"],
217 } 243 }
218
219 } 244 }
220 } 245 }
221 246
LEFTRIGHT

Powered by Google App Engine
This is Rietveld