
Avoid issues from linter: WARNING: class included by absolute name (::$class) on line ... Change-Id: Ia25bea4693acd44d3541500698e7fa978613f459
177 lines
6.7 KiB
Puppet
177 lines
6.7 KiB
Puppet
# == Class: askbot
|
|
# This class sets up an askbot site
|
|
#
|
|
# == Parameters
|
|
# - $www_group: group name for web writeable directories like upfiles and log
|
|
# - $www_user: user name for web process
|
|
# - $askbot_debug: set to true to enable askbot debug mode
|
|
# - $dist_root: root directory of distribution releases
|
|
# - $site_root: root directory of site config and assets
|
|
# - $site_name: fqdn of askbot site
|
|
# - $template_settings: settings.py configuration template
|
|
#
|
|
# Source repository:
|
|
# - askbot_repo: git repository of askbot source files
|
|
# - versions to checkout (askbot_revision|askbot_branch|askbot_tag)
|
|
# - askbot_revision: commit ref of askbot repo used for deployment
|
|
# - askbot_branch: branch of askbot repo
|
|
# - askbot_tag: a specific version or tag of the askbot repo
|
|
#
|
|
# Custom askbot theme settings:
|
|
# - $custom_theme_enabled: set to true to enable custom themes, default: false
|
|
# - $custom_theme_name: name of custom theme set to default
|
|
#
|
|
# Redis configuration:
|
|
# - $redis_enabled: set to true to use redis as cache backend
|
|
# - $redis_prefix: redis key prefix (required for multi-site setups)
|
|
# - $redis_port: port of redis service
|
|
# - $redis_max_memory: memory allocation for redis
|
|
# - $redis_bind: bind address of redis service
|
|
# - $redis_password: password required for redis connection
|
|
#
|
|
# SSL Settings:
|
|
# - $site_ssl_enabled: set to true for SSL based vhost
|
|
# - $site_ssl_cert_file_contents: x509 certificate in pem format
|
|
# - $site_ssl_key_file_contents: the key of site certificate in pem format
|
|
# - $site_ssl_chain_file_contents: the issuer certs of site cert (optional)
|
|
# - $site_ssl_cert_file: file name of site certificate
|
|
# - $site_ssl_key_file: file name of the site certificate's key file
|
|
# - $site_ssl_chain_file: file name of the issuer certificates
|
|
#
|
|
# Email configuration:
|
|
# - $smtp_host: hostname of smtp service used for email sending
|
|
# - $smtp_port: port of smtp service
|
|
#
|
|
# Database provider and connection details:
|
|
# - $db_provider: database provider (mysql or pgsql)
|
|
# - $db_name: database name
|
|
# - $db_user: user name required for db connection
|
|
# - $db_password: password required for db connection
|
|
# - $db_host: database host
|
|
#
|
|
# Solr support:
|
|
# - solr_enabled: set true to use solr as a search indexing engine
|
|
#
|
|
# == Actions
|
|
#
|
|
class askbot (
|
|
$db_password,
|
|
$redis_password,
|
|
$akismet_api_key = undef,
|
|
$askbot_branch = 'master',
|
|
$askbot_debug = false,
|
|
$askbot_ensure = 'present',
|
|
$askbot_tag = undef,
|
|
$askbot_revision = undef,
|
|
$askbot_repo = 'https://github.com/ASKBOT/askbot-devel.git',
|
|
$custom_theme_enabled = false,
|
|
$custom_theme_name = undef,
|
|
$db_host = 'localhost',
|
|
$db_name = 'askbotdb',
|
|
$db_provider = 'mysql',
|
|
$db_user = 'askbot',
|
|
$dist_root = '/srv/dist',
|
|
$redis_enabled = false,
|
|
$redis_prefix = 'askbot',
|
|
$redis_port = 6378,
|
|
$redis_max_memory = '256m',
|
|
$redis_bind = '127.0.0.1',
|
|
$site_ssl_enabled = false,
|
|
$site_ssl_cert_file_contents = undef,
|
|
$site_ssl_key_file_contents = undef,
|
|
$site_ssl_chain_file_contents = undef,
|
|
$site_ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem',
|
|
$site_ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key',
|
|
$site_ssl_chain_file = undef,
|
|
$site_name = 'askbot',
|
|
$site_root = '/srv/askbot-site',
|
|
$solr_enabled = false,
|
|
$smtp_host = 'localhost',
|
|
$smtp_port = '25',
|
|
$template_settings = 'askbot/settings.py.erb',
|
|
$www_group = 'www-data',
|
|
$www_user = 'www-data',
|
|
) {
|
|
|
|
class { 'askbot::install':
|
|
db_provider => $db_provider,
|
|
dist_root => $dist_root,
|
|
askbot_repo => $askbot_repo,
|
|
askbot_revision => $askbot_revision,
|
|
redis_enabled => $redis_enabled,
|
|
solr_enabled => $solr_enabled,
|
|
}
|
|
|
|
if !defined(File[$dist_root]) {
|
|
file { $dist_root:
|
|
ensure => directory,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0755',
|
|
}
|
|
}
|
|
|
|
if ($askbot_revision) {
|
|
git { 'askbot':
|
|
ensure => present,
|
|
path => "${dist_root}/askbot",
|
|
origin => $askbot_repo,
|
|
latest => true,
|
|
commit => $askbot_revision,
|
|
require => [ File[$dist_root], Package['git'] ],
|
|
}
|
|
} elsif ($askbot_tag) {
|
|
git { 'askbot':
|
|
ensure => present,
|
|
path => "${dist_root}/askbot",
|
|
origin => $askbot_repo,
|
|
latest => true,
|
|
tag => $askbot_tag,
|
|
require => [ File[$dist_root], Package['git'] ],
|
|
}
|
|
} else {
|
|
git { 'askbot':
|
|
ensure => present,
|
|
path => "${dist_root}/askbot",
|
|
origin => $askbot_repo,
|
|
latest => true,
|
|
branch => $askbot_branch,
|
|
require => [ File[$dist_root], Package['git'] ],
|
|
}
|
|
}
|
|
|
|
class { 'askbot::config':
|
|
site_root => $site_root,
|
|
dist_root => $dist_root,
|
|
www_group => $www_group,
|
|
db_provider => $db_provider,
|
|
db_name => $db_name,
|
|
db_user => $db_user,
|
|
db_password => $db_password,
|
|
db_host => $db_host,
|
|
askbot_debug => $askbot_debug,
|
|
redis_enabled => $redis_enabled,
|
|
redis_prefix => $redis_prefix,
|
|
redis_port => $redis_port,
|
|
redis_max_memory => $redis_max_memory,
|
|
redis_bind => $redis_bind,
|
|
redis_password => $redis_password,
|
|
akismet_api_key => $akismet_api_key,
|
|
site_ssl_enabled => $site_ssl_enabled,
|
|
site_ssl_cert_file_contents => $site_ssl_cert_file_contents,
|
|
site_ssl_key_file_contents => $site_ssl_key_file_contents,
|
|
site_ssl_chain_file_contents => $site_ssl_chain_file_contents,
|
|
site_ssl_cert_file => $site_ssl_cert_file,
|
|
site_ssl_key_file => $site_ssl_key_file,
|
|
site_ssl_chain_file => $site_ssl_chain_file,
|
|
site_name => $site_name,
|
|
custom_theme_enabled => $custom_theme_enabled,
|
|
custom_theme_name => $custom_theme_name,
|
|
solr_enabled => $solr_enabled,
|
|
smtp_port => $smtp_port,
|
|
smtp_host => $smtp_host,
|
|
template_settings => $template_settings,
|
|
require => [ Git['askbot'], Class['askbot::install'] ],
|
|
}
|
|
}
|