141 lines
2.8 KiB
Puppet
141 lines
2.8 KiB
Puppet
# Class to configure hound
|
|
#
|
|
# == Class: hound
|
|
class hound (
|
|
$config_json = 'hound/config.json',
|
|
$datadir = '/home/hound/data',
|
|
$manage_config = true,
|
|
$serveradmin = "webmaster@${::fqdn}",
|
|
$serveraliases = undef,
|
|
$vhost_name = $::fqdn,
|
|
) {
|
|
|
|
package { 'golang':
|
|
ensure => present,
|
|
}
|
|
|
|
user { 'hound':
|
|
ensure => present,
|
|
home => '/home/hound',
|
|
shell => '/bin/bash',
|
|
gid => 'hound',
|
|
managehome => true,
|
|
require => Group['hound'],
|
|
}
|
|
|
|
group { 'hound':
|
|
ensure => present,
|
|
}
|
|
|
|
file {'/home/hound':
|
|
ensure => directory,
|
|
owner => 'hound',
|
|
group => 'hound',
|
|
mode => '0755',
|
|
require => User['hound'],
|
|
}
|
|
|
|
file { $datadir:
|
|
ensure => 'directory',
|
|
owner => 'hound',
|
|
group => 'hound',
|
|
require => User['hound'],
|
|
}
|
|
|
|
if $manage_config {
|
|
file { '/home/hound/config.json':
|
|
ensure => 'present',
|
|
owner => 'hound',
|
|
group => 'hound',
|
|
content => file($config_json),
|
|
require => User['hound'],
|
|
}
|
|
}
|
|
|
|
vcsrepo { '/home/hound/src/github.com/etsy/hound':
|
|
ensure => latest,
|
|
provider => git,
|
|
source => 'git://github.com/etsy/Hound.git',
|
|
notify => Exec['build_hound'],
|
|
}
|
|
|
|
exec { 'build_hound':
|
|
command => 'go install github.com/etsy/hound/cmds/...',
|
|
path => '/bin:/usr/bin:/usr/local/bin',
|
|
environment => 'GOPATH=/home/hound',
|
|
cwd => '/home/hound',
|
|
creates => '/home/hound/bin/houndd',
|
|
user => 'hound',
|
|
timeout => 600,
|
|
require => [
|
|
User['hound'],
|
|
Package['golang'],
|
|
]
|
|
}
|
|
|
|
service { 'hound':
|
|
ensure => running,
|
|
hasrestart => true,
|
|
require => [
|
|
File['/etc/init.d/hound'],
|
|
Exec['build_hound'],
|
|
],
|
|
subscribe => File['/home/hound/config.json'],
|
|
}
|
|
|
|
file { '/etc/init.d/hound':
|
|
ensure => file,
|
|
owner => root,
|
|
group => root,
|
|
mode => '0755',
|
|
source => 'puppet:///modules/hound/hound.init',
|
|
notify => Service['hound'],
|
|
before => Service['hound'],
|
|
}
|
|
|
|
include ::httpd
|
|
|
|
httpd_mod { 'rewrite':
|
|
ensure => present,
|
|
before => Service['hound'],
|
|
}
|
|
|
|
httpd_mod { 'proxy':
|
|
ensure => present,
|
|
before => Service['hound'],
|
|
}
|
|
|
|
httpd_mod { 'proxy_http':
|
|
ensure => present,
|
|
before => Service['hound'],
|
|
}
|
|
|
|
httpd::vhost { $vhost_name:
|
|
port => 80,
|
|
docroot => 'MEANINGLESS ARGUMENT',
|
|
priority => '50',
|
|
template => 'hound/hound.vhost.erb',
|
|
}
|
|
|
|
file { '/var/log/hound.log':
|
|
owner => 'hound',
|
|
group => 'hound',
|
|
mode => '0644',
|
|
require => User['hound'],
|
|
}
|
|
|
|
logrotate::file { 'houndlog':
|
|
ensure => present,
|
|
log => '/var/log/hound.log',
|
|
options => ['compress',
|
|
'copytruncate',
|
|
'delaycompress',
|
|
'missingok',
|
|
'rotate 7',
|
|
'daily',
|
|
'notifempty',
|
|
],
|
|
}
|
|
|
|
}
|