diff --git a/Modulefile b/Modulefile index e8ce469..26d166d 100644 --- a/Modulefile +++ b/Modulefile @@ -10,6 +10,7 @@ project_page 'https://github.com/openstack-ci/puppet-storyboard' ## Add dependencies, if any: dependency 'puppetlabs/mysql', '= 0.6.1' dependency 'puppetlabs/apache', '= 0.0.4' +dependency 'puppetlabs/rabbitmq', '= 4.0.0' dependency 'example42/puppi', '= 2.1.9' dependency 'openstackci/vcsrepo', '= 0.0.8' dependency 'stankevich/python', '= 1.6.6' \ No newline at end of file diff --git a/README.md b/README.md index 670ede3..a0e1f07 100644 --- a/README.md +++ b/README.md @@ -28,22 +28,26 @@ A module that installs a standalone instance of StoryBoard. The standalone StoryBoard module will install a fully functional, independent instance of StoryBoard on your node. It includes a local instance of mysql, -an HTTPS vhost using the apache snakeoil certificates, and an automatic -redirect from http://$hostname to https://$hostname/. +RabbitMQ, an HTTPS vhost using the apache snakeoil certificates, and an +automatic redirect from http://$hostname to https://$hostname/. node default { class { 'storyboard': - mysql_database => 'storyboard', - mysql_user => 'storyboard', - mysql_user_password => 'changeme', - hostname => ::fqdn, - openid_url => 'https://login.launchpad.net/+openid', - ssl_cert_file => '/etc/ssl/certs/ssl-cert-snakeoil.pem', - ssl_cert_content => undef, - ssl_key_file => '/etc/ssl/private/ssl-cert-snakeoil.key', - ssl_key_content => undef, - ssl_ca_file => undef, - ssl_ca_content => undef + mysql_database => 'storyboard', + mysql_user => 'storyboard', + mysql_user_password => 'changeme', + + rabbitmq_user => 'storyboard', + rabbitmq_user_password => 'changemetoo', + + hostname => ::fqdn, + openid_url => 'https://login.launchpad.net/+openid', + ssl_cert_file => '/etc/ssl/certs/ssl-cert-snakeoil.pem', + ssl_cert_content => undef, + ssl_key_file => '/etc/ssl/private/ssl-cert-snakeoil.key', + ssl_key_content => undef, + ssl_ca_file => undef, + ssl_ca_content => undef } } @@ -111,14 +115,34 @@ and adjust the apache vhost accordingly. hostname => ::fqdn, # storyboard.conf parameters - access_token_ttl => 3600, - refresh_token_ttl => 604800, - openid_url => 'https://login.launchpad.net/+openid', - mysql_host => 'localhost', - mysql_port => 3306, - mysql_database => 'storyboard', - mysql_user => 'storyboard', - mysql_user_password => 'changeme' + access_token_ttl => 3600, + refresh_token_ttl => 604800, + openid_url => 'https://login.launchpad.net/+openid', + mysql_host => 'localhost', + mysql_port => 3306, + mysql_database => 'storyboard', + mysql_user => 'storyboard', + mysql_user_password => 'changeme', + + rabbitmq_host => 'localhost', + rabbitmq_port => 5672, + rabbitmq_vhost => '/', + rabbitmq_user => 'storyboard', + rabbitmq_user_password => 'changemetoo' + } + } + +## ::storyboard::rabbit +This module installs StoryBoard's RabbitMQ instance. + +In order to handle subscriptions, emails, and reporting, storyboard uses +rabbitmq for deferred processing. This module installs a standalone, local +instance of rabbit. + + node default { + class { 'storyboard::rabbit': + rabbitmq_user => 'storyboard', + rabbitmq_user_password => 'changeme' } } diff --git a/manifests/application.pp b/manifests/application.pp index 6b21170..5e354ee 100644 --- a/manifests/application.pp +++ b/manifests/application.pp @@ -21,19 +21,25 @@ class storyboard::application ( # Installation parameters - $www_root = '/var/lib/storyboard/www', - $server_admin = undef, - $hostname = $::fqdn, + $www_root = '/var/lib/storyboard/www', + $server_admin = undef, + $hostname = $::fqdn, # storyboard.conf parameters - $access_token_ttl = 3600, - $refresh_token_ttl = 604800, + $access_token_ttl = 3600, + $refresh_token_ttl = 604800, $openid_url, - $mysql_host = 'localhost', - $mysql_port = 3306, - $mysql_database = 'storyboard', - $mysql_user = 'storyboard', - $mysql_user_password = 'changeme', + $mysql_host = 'localhost', + $mysql_port = 3306, + $mysql_database = 'storyboard', + $mysql_user = 'storyboard', + $mysql_user_password = 'changeme', + + $rabbitmq_host = 'localhost', + $rabbitmq_port = 5672, + $rabbitmq_vhost = '/', + $rabbitmq_user = 'storyboard', + $rabbitmq_user_password = 'changemetoo' ) { # Dependencies diff --git a/manifests/init.pp b/manifests/init.pp index 17cbb92..8e51432 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -23,6 +23,10 @@ class storyboard ( $mysql_database = 'storyboard', $mysql_user = 'storyboard', $mysql_user_password = 'changeme', + + $rabbitmq_user = 'storyboard', + $rabbitmq_user_password = 'changemetoo', + $hostname = $::fqdn, $openid_url = 'https://login.launchpad.net/+openid', @@ -43,6 +47,11 @@ class storyboard ( ssl_ca_content => $ssl_ca_content, } + class { '::storyboard::rabbit': + rabbitmq_user => $rabbitmq_user, + rabbitmq_user_password => $rabbitmq_user_password + } + class { '::storyboard::mysql': mysql_database => $mysql_database, mysql_user => $mysql_user, @@ -50,12 +59,15 @@ class storyboard ( } class { '::storyboard::application': - hostname => $hostname, - openid_url => $openid_url, - mysql_host => 'localhost', - mysql_port => 3306, - mysql_database => $mysql_database, - mysql_user => $mysql_user, - mysql_user_password => $mysql_user_password, + hostname => $hostname, + openid_url => $openid_url, + mysql_host => 'localhost', + mysql_port => 3306, + mysql_database => $mysql_database, + mysql_user => $mysql_user, + mysql_user_password => $mysql_user_password, + + rabbitmq_user => $rabbitmq_user, + rabbitmq_user_password => $rabbitmq_user_password } } diff --git a/manifests/rabbit.pp b/manifests/rabbit.pp new file mode 100644 index 0000000..f0acc1c --- /dev/null +++ b/manifests/rabbit.pp @@ -0,0 +1,41 @@ +# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# == Class: storyboard::rabbit +# +# The StoryBoard Rabbit manifest installs a standalone rabbitmq instance +# which is used to handle deferred processing and reporting tasks for +# StoryBoard. +# +class storyboard::rabbit ( + $rabbitmq_user = 'storyboard', + $rabbitmq_user_password = 'changeme' +) { + + class { 'rabbitmq': + service_manage => true, + delete_guest_user => true + } + + rabbitmq_user { $rabbitmq_user: + password => $rabbitmq_user_password + } + + rabbitmq_user_permissions { "${rabbitmq_user}@/": + configure_permission => '.*', + read_permission => '.*', + write_permission => '.*', + require => Rabbitmq_user[$rabbitmq_user] + } +} diff --git a/templates/storyboard.conf.erb b/templates/storyboard.conf.erb index 7a505e2..d2183e9 100644 --- a/templates/storyboard.conf.erb +++ b/templates/storyboard.conf.erb @@ -46,6 +46,10 @@ refresh_token_ttl = <%= @refresh_token_ttl %> # page_size_maximum = 500 # page_size_default = 20 +# Enable notifications. This feature drives deferred processing, reporting, +# and subscriptions. +enable_notifications = True + [database] # This line MUST be changed to actually run storyboard # Example: @@ -85,3 +89,23 @@ connection=mysql://<%= @mysql_user %>:<%= @mysql_user_password %>@<%= @mysql_hos # If set, use this value for pool_timeout with sqlalchemy # pool_timeout = 10 + +[notifications] + +# Host of the rabbitmq server. +rabbit_host=<%= @rabbitmq_host %> + +# The RabbitMQ login method +rabbit_login_method = AMQPLAIN + +# The RabbitMQ userid. +rabbit_userid = <%= @rabbitmq_user %> + +# The RabbitMQ password. +rabbit_password = <%= @rabbitmq_user_password %> + +# The RabbitMQ broker port where a single node is used. +rabbit_port = <%= @rabbitmq_port %> + +# The virtual host within which our queues and exchanges live. +rabbit_virtual_host = <%= @rabbitmq_vhost %>