| LEFT | RIGHT |
| 1 class trac( | 1 class trac( |
| 2 $domain, | 2 $domain, |
| 3 $certificate, | 3 $certificate, |
| 4 $private_key, | 4 $private_key, |
| 5 $fcgi_config_dir = '/etc/nginx/trac.d', | 5 $fcgi_config_dir = '/etc/nginx/trac.d', |
| 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: | 14 file {$fcgi_config_dir: |
| 15 ensure => directory, | 15 ensure => directory, |
| 16 owner => 'root', | 16 owner => 'root', |
| 17 mode => 755, | 17 mode => 755, |
| 18 require => Package['nginx'], |
| 18 } | 19 } |
| 19 | 20 |
| 20 nginx::hostconfig {$domain: | 21 nginx::hostconfig {$domain: |
| 21 source => 'puppet:///modules/trac/site.conf', | 22 content => "include $fcgi_config_dir/*;", |
| 22 is_default => $is_default, | 23 is_default => $is_default, |
| 23 certificate => $certificate, | 24 certificate => $certificate, |
| 24 private_key => $private_key, | 25 private_key => $private_key, |
| 25 log => 'access_log_trac', | 26 log => 'access_log_trac', |
| 26 require => File[$fcgi_config_dir], | 27 require => File[$fcgi_config_dir], |
| 27 } | 28 } |
| 28 | 29 |
| 29 user {'trac': | 30 user {'trac': |
| 30 ensure => present, | 31 ensure => present, |
| 31 comment => 'User of the trac installation', | 32 comment => 'User of the trac installation', |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 'python-pip'], | 107 'python-pip'], |
| 107 unless => "python -c 'import tracspamfilter'", | 108 unless => "python -c 'import tracspamfilter'", |
| 108 } | 109 } |
| 109 | 110 |
| 110 exec { 'install_Tractags': | 111 exec { 'install_Tractags': |
| 111 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/", |
| 112 require => Package['python-pip'], | 113 require => Package['python-pip'], |
| 113 unless => "python -c 'import tractags'", | 114 unless => "python -c 'import tractags'", |
| 114 } | 115 } |
| 115 | 116 |
| 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 |
| 116 file { '/home/trac/trac.ini': | 123 file { '/home/trac/trac.ini': |
| 117 ensure => present, | 124 ensure => present, |
| 118 source => 'puppet:///modules/trac/trac.ini', | 125 source => 'puppet:///modules/trac/trac.ini', |
| 119 owner => 'trac', | 126 owner => 'trac', |
| 120 mode => 644, | 127 mode => 644, |
| 121 } | 128 } |
| 122 | 129 |
| 123 define instance ( | 130 define instance ( |
| 124 $config = 'trac/trac.ini.erb', | 131 $config = 'trac/trac.ini.erb', |
| 125 $description = 'Issue Tracker', | 132 $description = 'Issue Tracker', |
| 126 $environment = 'environment', | |
| 127 $location = '/', | 133 $location = '/', |
| 128 $logo = 'eyeo_logo.png', | 134 $logo = 'puppet:///modules/trac/logo.png', |
| 129 $database = 'trac', | 135 $database = 'trac', |
| 130 $permissions = 'puppet:///modules/trac/permissions.csv', | 136 $permissions = 'puppet:///modules/trac/permissions.csv', |
| 131 $theme = 'puppet:///modules/trac/theme.css') { | 137 $theme = 'puppet:///modules/trac/theme.css') { |
| 132 | 138 |
| 133 $database_password = $private::trac::database_password | 139 $database_password = $private::trac::database_password |
| 140 $environment = "environment-$name" |
| 134 | 141 |
| 135 mysql::db {$database: | 142 mysql::db {$database: |
| 136 user => 'trac', | 143 user => 'trac', |
| 137 password => $database_password, | 144 password => $database_password, |
| 138 host => 'localhost', | 145 host => 'localhost', |
| 139 grant => ['all'], | 146 grant => ['all'], |
| 140 charset => 'utf8', | 147 charset => 'utf8', |
| 141 collate => 'utf8_bin', | 148 collate => 'utf8_bin', |
| 142 require => Class['mysql::server'], | 149 require => Class['mysql::server'], |
| 143 } | 150 } |
| 144 | 151 |
| 145 $location_base = $location ? { | 152 $location_base = regsubst($location, '/+$', '') |
| 146 '/' => '', | |
| 147 default => $location, | |
| 148 } | |
| 149 | 153 |
| 150 file {"${trac::fcgi_config_dir}/${name}.conf": | 154 file {"${trac::fcgi_config_dir}/${name}.conf": |
| 151 ensure => file, | 155 ensure => file, |
| 152 owner => 'root', | 156 owner => 'root', |
| 153 mode => 644, | 157 mode => 644, |
| 154 content => " | 158 content => template('trac/fcgi.conf.erb'), |
| 155 location $location_base/ | |
| 156 { | |
| 157 fastcgi_pass unix:/tmp/${name}-fastcgi.sock; | |
| 158 fastcgi_split_path_info ^(${location_base})(.*)\$; | |
| 159 include /etc/nginx/fastcgi_params; | |
| 160 fastcgi_param SCRIPT_NAME \$fastcgi_script_name; | |
| 161 fastcgi_param PATH_INFO \$fastcgi_path_info; | |
| 162 client_max_body_size 20m; | |
| 163 } | |
| 164 location $location_base/chrome/ | |
| 165 { | |
| 166 alias /home/trac/htdocs-$name/htdocs/; | |
| 167 }", | |
| 168 require => File[$trac::fcgi_config_dir], | 159 require => File[$trac::fcgi_config_dir], |
| 160 notify => Service['nginx'], |
| 169 } | 161 } |
| 170 | 162 |
| 171 exec {"trac_env_${name}": | 163 exec {"trac_env_${name}": |
| 172 command => shellquote( | 164 command => shellquote( |
| 173 'trac-admin', "/home/trac/$environment", 'initenv', $description, | 165 'trac-admin', "/home/trac/$environment", 'initenv', $description, |
| 174 "mysql://trac:${database_password}@localhost:3306/$database"), | 166 "mysql://trac:${database_password}@localhost:3306/$database"), |
| 167 logoutput => true, |
| 175 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', | 168 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', |
| 176 require => [ | 169 require => [ |
| 177 Exec['install_trac'], | 170 Exec['install_trac'], |
| 178 Mysql_grant["trac@localhost/${database}.*"]], | 171 Mysql_grant["trac@localhost/${database}.*"]], |
| 179 user => trac, | 172 user => trac, |
| 180 unless => "test -d /home/trac/$environment" | 173 unless => "test -d /home/trac/$environment", |
| 181 } | 174 } |
| 182 | 175 |
| 183 file {"/home/trac/${environment}/conf/permissions.csv": | 176 file {"/home/trac/${environment}/conf/permissions.csv": |
| 184 ensure => present, | 177 ensure => present, |
| 185 owner => trac, | 178 owner => trac, |
| 186 source => $permissions, | 179 source => $permissions, |
| 187 require => Exec["trac_env_$name"], | 180 require => Exec["trac_env_$name"], |
| 188 } | 181 } |
| 189 | 182 |
| 190 file {"/home/trac/$environment/conf/trac.ini": | 183 file {"/home/trac/$environment/conf/trac.ini": |
| (...skipping 18 matching lines...) Expand all Loading... |
| 209 File["/home/trac/$environment/conf/trac.ini"], | 202 File["/home/trac/$environment/conf/trac.ini"], |
| 210 Exec['install_SensitiveTickets'], | 203 Exec['install_SensitiveTickets'], |
| 211 Exec['install_BlackMagicTicketTweaks'], | 204 Exec['install_BlackMagicTicketTweaks'], |
| 212 Exec['install_AccountManager'], | 205 Exec['install_AccountManager'], |
| 213 Exec['install_AutocompleteUsers'], | 206 Exec['install_AutocompleteUsers'], |
| 214 Exec['install_TicketTemplate'], | 207 Exec['install_TicketTemplate'], |
| 215 Exec['install_NeverNotifyUpdater'], | 208 Exec['install_NeverNotifyUpdater'], |
| 216 Exec['install_MasterTickets'], | 209 Exec['install_MasterTickets'], |
| 217 Exec['install_ThemeEngine'], | 210 Exec['install_ThemeEngine'], |
| 218 Exec['install_Tractags'], | 211 Exec['install_Tractags'], |
| 219 Exec['install_TracSpamFilter']], | 212 Exec['install_TracSpamFilter'], |
| 213 Exec['install_PrivateTickets']], |
| 220 } | 214 } |
| 221 | 215 |
| 222 exec {"deploy_$name": | 216 exec {"deploy_$name": |
| 223 command => "trac-admin /home/trac/$environment \ | 217 command => "trac-admin /home/trac/$environment \ |
| 224 deploy /home/trac/htdocs-$name \ | 218 deploy /home/trac/htdocs-$name \ |
| 225 && fromdos /home/trac/htdocs-$name/cgi-bin/trac.fcgi \ | 219 && fromdos /home/trac/htdocs-$name/cgi-bin/trac.fcgi \ |
| 226 && chmod 755 /home/trac/htdocs-$name/cgi-bin/trac.fcgi", | 220 && chmod 755 /home/trac/htdocs-$name/cgi-bin/trac.fcgi", |
| 227 user => trac, | 221 user => trac, |
| 228 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', | 222 path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', |
| 229 require => [ | 223 require => [ |
| 230 Exec["update_env_$name"], | 224 Exec["update_env_$name"], |
| 231 Package["tofrodos"]], | 225 Package["tofrodos"]], |
| 232 } | 226 } |
| 233 | 227 |
| 234 file {"/home/trac/htdocs-$name/htdocs/common/$logo": | 228 file {"/home/trac/htdocs-$name/htdocs/common/logo.png": |
| 235 ensure => present, | 229 ensure => present, |
| 236 source => "puppet:///modules/trac/$logo", | 230 source => $logo, |
| 237 owner => trac, | 231 owner => trac, |
| 238 require => Exec["deploy_$name"], | 232 require => Exec["deploy_$name"], |
| 239 } | 233 } |
| 240 | 234 |
| 241 spawn-fcgi::pool {"${name}d": | 235 spawn-fcgi::pool {"tracd_${name}": |
| 242 ensure => present, | 236 ensure => present, |
| 243 fcgi_app => "/home/trac/htdocs-$name/cgi-bin/trac.fcgi", | 237 fcgi_app => "/home/trac/htdocs-$name/cgi-bin/trac.fcgi", |
| 244 socket => "/tmp/${name}-fastcgi.sock", | 238 socket => "/tmp/${name}-fastcgi.sock", |
| 245 mode => "0666", | 239 mode => "0666", |
| 246 user => trac, | 240 user => trac, |
| 247 children => 1, | 241 children => 1, |
| 248 require => Exec["deploy_$name"], | 242 require => Exec["deploy_$name"], |
| 249 } | 243 } |
| 250 } | 244 } |
| 251 } | 245 } |
| 252 | 246 |
| LEFT | RIGHT |