Last active
August 29, 2015 14:08
-
-
Save baurmatt/c45497b980ff787cc638 to your computer and use it in GitHub Desktop.
A Puppet recipe for isso
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Needs the following module: | |
# Apache: https://github.com/puppetlabs/puppetlabs-apache/ | |
# Stdlib: https://github.com/puppetlabs/puppetlabs-stdlib/ | |
# Python: https://github.com/stankevich/puppet-python/ | |
# wget: https://github.com/maestrodev/puppet-wget/ | |
$packages_isso = [ 'python-setuptools', 'sqlite3', 'build-essential', ] | |
package { $packages_isso: } | |
################################################################################## | |
# Apache | |
################################################################################## | |
class { 'apache': | |
default_mods => true, | |
default_vhost => false, | |
default_ssl_vhost => false, | |
server_tokens => 'Prod', | |
mpm_module => 'prefork', | |
} | |
apache::vhost { 'comments.example.org': | |
servername => 'comments.example.org', | |
port => '80', | |
docroot => '/var/www/comments.example.org', | |
redirect_status => 'permanent', | |
redirect_dest => 'https://comments.example.org/' | |
} | |
apache::vhost { 'comments.example.org-ssl': | |
servername => 'comments.example.org', | |
port => '443', | |
docroot => '/var/www/comments.example.org', | |
proxy_dest => 'http://localhost:11550/', | |
proxy_preserve_host => true, | |
ssl => true, | |
ssl_cert => '/etc/ssl/certs/wildcard.example.org_startssl.pem', | |
ssl_chain => '/etc/ssl/certs/StartSSL_class2.pem', | |
ssl_key => '/etc/ssl/private/wildcard.example.org_startssl.key', | |
} | |
################################################################################## | |
# isso | |
################################################################################## | |
class { 'python': | |
version => 'system', | |
pip => true, | |
dev => true, | |
virtualenv => true, | |
} | |
file { [ '/var/log/isso', ]: | |
ensure => directory, | |
owner => 'isso', | |
group => 'isso', | |
require => User['isso'], | |
} | |
user { 'isso': | |
ensure => present, | |
home => '/opt/isso', | |
shell => '/bin/bash', | |
managehome => true, | |
} | |
python::pip { 'isso' : | |
pkgname => 'isso', | |
virtualenv => '/opt/isso', | |
owner => 'isso', | |
require => [ User['isso'], Python::Virtualenv['/opt/isso'], Class['python'], ], | |
} | |
python::pip { 'gunicorn': | |
pkgname => 'gunicorn', | |
virtualenv => '/opt/isso', | |
owner => 'isso', | |
require => [ User['isso'], Python::Virtualenv['/opt/isso'], Class['python'], ], | |
} | |
python::virtualenv { '/opt/isso' : | |
ensure => present, | |
version => 'system', | |
systempkgs => true, | |
owner => 'isso', | |
group => 'isso', | |
cwd => '/opt/isso', | |
timeout => 0, | |
} | |
wget::fetch { 'isso-init': | |
source => 'https://raw.githubusercontent.com/jgraichen/debian-isso/master/debian/isso.init', | |
destination => '/etc/init.d/isso', | |
timeout => 0, | |
verbose => false, | |
} | |
file { '/etc/init.d/isso': | |
mode => '0755', | |
require => Wget::Fetch['isso-init'], | |
} | |
file_line { '/etc/init.d/isso': | |
path => '/etc/init.d/isso', | |
line => 'DAEMON=/opt/isso/bin/gunicorn', | |
match => '^DAEMON=.*$', | |
require => File['/etc/init.d/isso'], | |
} | |
file { '/etc/default/isso': | |
content => 'LOG_FILE=/var/log/isso/isso.log | |
BIND=127.0.0.1:11550', | |
} | |
service { 'isso': | |
ensure => running, | |
hasstatus => true, | |
enable => true, | |
require => [ Python::Pip['isso'], Python::Pip['gunicorn'], File_line['/etc/init.d/isso'], File['/etc/default/isso'], ], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment