From da8c6b7d0f44e482ad9e5ff294250fe70d8e90e0 Mon Sep 17 00:00:00 2001 From: Marton Kiss Date: Mon, 13 Apr 2015 13:07:23 +0200 Subject: [PATCH] Initial commit of ask-staging.o.o site This patch provides the ask-staging.o.o instance and required service dependencies like pgsql database and solr service. The ask-staging.o.o is used to test the development patches of the production ask.o.o, and part of the ask.o.o quality assurance process of a release. New hiera variables: - ask_staging_db_password: staging database password - ask_staging_redis_password: redis password Depends-On: I560c24c3b09e4a8d09b23afa619a4cf361601cbe Depends-On: Id0c414dbac24056aad2a619b09327855f52ec3a9 Change-Id: I605102358a6cb05b1fbdb2564d578e89de253413 --- manifests/site.pp | 13 ++ .../manifests/ask_staging.pp | 114 ++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 modules/openstack_project/manifests/ask_staging.pp diff --git a/manifests/site.pp b/manifests/site.pp index 35bd4814f1..f7ec6b7296 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -737,6 +737,19 @@ node 'ask.openstack.org' { } } +# Node-OS: trusty +node 'ask-staging.openstack.org' { + class { 'openstack_project::server': + iptables_public_tcp_ports => [22, 80, 443], + sysadmins => hiera('sysadmins', []), + } + + class { 'openstack_project::ask_staging': + db_password => hiera('ask_staging_db_password', 'XXX'), + redis_password => hiera('ask_staging_redis_password', 'XXX'), + } +} + # Node-OS: trusty node 'translate-dev.openstack.org' { class { 'openstack_project::translate_dev': diff --git a/modules/openstack_project/manifests/ask_staging.pp b/modules/openstack_project/manifests/ask_staging.pp new file mode 100644 index 0000000000..b7e65ad0a7 --- /dev/null +++ b/modules/openstack_project/manifests/ask_staging.pp @@ -0,0 +1,114 @@ +# == Class: openstack_project::ask_dev +# +# ask-staging.openstack.org Q&A support website +# +class openstack_project::ask_staging ( + $db_password, + $redis_password, + $db_name = 'askbotdb', + $db_user = 'ask', + $redis_port = '6378', + $redis_max_memory = '512m', + $redis_bind = '127.0.0.1', + $solr_version = '4.10.4' +) { + + # solr search engine + class { 'solr': + mirror => 'http://apache.mesi.com.ar/lucene/solr', + version => $solr_version, + cores => [ 'core-default', 'core-en', 'core-zh' ], + } + + file { '/usr/share/solr/core-en/conf/schema.xml': + ensure => present, + content => template('openstack_project/askbot/schema.en.xml.erb'), + replace => true, + owner => 'jetty', + group => 'jetty', + mode => '0644', + require => File['/usr/share/solr/core-zh/conf'], + } + + file { '/usr/share/solr/core-zh/conf/schema.xml': + ensure => present, + content => template('openstack_project/askbot/schema.cn.xml.erb'), + replace => true, + owner => 'jetty', + group => 'jetty', + mode => '0644', + require => File['/usr/share/solr/core-en/conf'], + } + + # deploy smartcn Chinese analyzer from solr contrib/analysys-extras + file { "/usr/share/solr/WEB-INF/lib/lucene-analyzers-smartcn-${solr_version}.jar": + ensure => present, + replace => 'no', + source => "/tmp/solr-${solr_version}/contrib/analysis-extras/lucene-libs/lucene-analyzers-smartcn-${solr_version}.jar", + owner => 'root', + group => 'root', + mode => '0644', + require => Exec['copy-solr'], + } + + # postgresql database + class { 'postgresql::server': } + + postgresql::server::db { $db_name: + user => $db_user, + password => postgresql_password($db_user, $db_password), + } + + # redis cache + class { 'redis': + redis_port => $redis_port, + redis_max_memory => $redis_max_memory, + redis_bind => $redis_bind, + redis_password => $redis_password, + version => '2.8.4', + before => Class['askbot'], + } + + # askbot site + class { 'askbot': + db_provider => 'pgsql', + db_name => $db_name, + db_user => $db_user, + db_password => $db_password, + redis_enabled => true, + redis_port => $redis_port, + redis_max_memory => $redis_max_memory, + redis_bind => $redis_bind, + redis_password => $redis_password, + custom_theme_enabled => true, + custom_theme_name => 'os', + site_name => 'ask-staging.openstack.org', + askbot_debug => true, + solr_enabled => true, + site_ssl_enabled => true, + site_ssl_cert_file => '/etc/ssl/certs/ssl-cert-snakeoil.pem', + site_ssl_key_file => '/etc/ssl/private/ssl-cert-snakeoil.key', + } + + # askbot-theme openstack theme + vcsrepo { '/srv/askbot-site/themes': + ensure => latest, + provider => git, + revision => 'feature/development', + source => 'https://git.openstack.org/openstack-infra/askbot-theme', + require => [ + File['/srv/askbot-site'], Package['git'] + ], + before => Exec['askbot-syncdb'], + notify => [ + Exec['theme-bundle-install-os'], + Exec['theme-bundle-compile-os'], + Exec['askbot-static-generate'], + ], + } + + askbot::theme::compass { 'os': + require => Vcsrepo['/srv/askbot-site/themes'], + before => Exec['askbot-static-generate'], + } +}