Add Storyboard puppet module
There are two major parts being installed with this module: 1. storyboard-api - REST API service served with apache mod_wsgi module 2. storyboard-webclient - static html/css/js files. This project is built and published to tarballs.o.o, from where it'll be installed with this puppet module This module requires three configs from Hiera: * storyboard_db_host * storyboard_db_password * storyboard_db_user Installed projects: * http://git.openstack.org/cgit/openstack-infra/storyboard/ * http://git.openstack.org/cgit/openstack-infra/storyboard-webclient/ Things to be added in later commits: * Documentation for ci.openstack.org * Configure logging (once supported by storyboard) * SSL Change-Id: If3da06f8d20a6282036f1f9f063c25a6d0db60c6
This commit is contained in:
parent
bfbbcd1368
commit
265bd8fe1d
@ -438,6 +438,16 @@ node 'summit.openstack.org' {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# A machine to run Storyboard
|
||||||
|
node 'storyboard.openstack.org' {
|
||||||
|
class { 'openstack_project::storyboard':
|
||||||
|
sysadmins => hiera('sysadmins'),
|
||||||
|
mysql_host => hiera('storyboard_db_host'),
|
||||||
|
mysql_user => hiera('storyboard_db_user'),
|
||||||
|
mysql_password => hiera('storyboard_db_password'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# A machine to serve static content.
|
# A machine to serve static content.
|
||||||
node 'static.openstack.org' {
|
node 'static.openstack.org' {
|
||||||
class { 'openstack_project::static':
|
class { 'openstack_project::static':
|
||||||
|
22
modules/openstack_project/manifests/storyboard.pp
Normal file
22
modules/openstack_project/manifests/storyboard.pp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# == Class: openstack_project::storyboard
|
||||||
|
#
|
||||||
|
class openstack_project::storyboard(
|
||||||
|
$mysql_host = '',
|
||||||
|
$mysql_password = '',
|
||||||
|
$mysql_user = '',
|
||||||
|
$sysadmins = [],
|
||||||
|
) {
|
||||||
|
class { 'openstack_project::server':
|
||||||
|
sysadmins => $sysadmins,
|
||||||
|
iptables_public_tcp_ports => [80],
|
||||||
|
}
|
||||||
|
|
||||||
|
class { '::storyboard':
|
||||||
|
mysql_host => $mysql_host,
|
||||||
|
mysql_password => $mysql_password,
|
||||||
|
mysql_user => $mysql_user,
|
||||||
|
projects_file =>
|
||||||
|
'puppet:///modules/openstack_project/review.projects.yaml',
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
180
modules/storyboard/manifests/init.pp
Normal file
180
modules/storyboard/manifests/init.pp
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
# Copyright (c) 2014 Mirantis Inc.
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
class storyboard (
|
||||||
|
$vhost_name = $::fqdn,
|
||||||
|
$mysql_host,
|
||||||
|
$mysql_password,
|
||||||
|
$mysql_user,
|
||||||
|
$projects_file,
|
||||||
|
$storyboard_git_source_repo = 'https://git.openstack.org/openstack-infra/storyboard/',
|
||||||
|
$storyboard_revision = 'master',
|
||||||
|
$storyboard_webclient_url = 'http://tarballs.openstack.org/storyboard-webclient/storyboard-webclient-latest.tar.gz'
|
||||||
|
|
||||||
|
) {
|
||||||
|
include apache
|
||||||
|
include mysql::python
|
||||||
|
include pip
|
||||||
|
|
||||||
|
package { 'libapache2-mod-wsgi':
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
|
||||||
|
package { 'curl':
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
|
||||||
|
group { 'storyboard':
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
|
||||||
|
user { 'storyboard':
|
||||||
|
ensure => present,
|
||||||
|
home => '/home/storyboard',
|
||||||
|
shell => '/bin/bash',
|
||||||
|
gid => 'storyboard',
|
||||||
|
managehome => true,
|
||||||
|
require => Group['storyboard'],
|
||||||
|
}
|
||||||
|
|
||||||
|
vcsrepo { '/opt/storyboard':
|
||||||
|
ensure => latest,
|
||||||
|
provider => git,
|
||||||
|
revision => $storyboard_revision,
|
||||||
|
source => $storyboard_git_source_repo,
|
||||||
|
}
|
||||||
|
|
||||||
|
exec { 'install-storyboard' :
|
||||||
|
command => 'pip install /opt/storyboard',
|
||||||
|
path => '/usr/local/bin:/usr/bin:/bin/',
|
||||||
|
refreshonly => true,
|
||||||
|
subscribe => Vcsrepo['/opt/storyboard'],
|
||||||
|
notify => Exec['storyboard-reload'],
|
||||||
|
require => Class['pip'],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/etc/storyboard':
|
||||||
|
ensure => directory,
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/etc/storyboard/storyboard.conf':
|
||||||
|
ensure => present,
|
||||||
|
owner => 'storyboard',
|
||||||
|
mode => '0400',
|
||||||
|
content => template('storyboard/storyboard.conf.erb'),
|
||||||
|
notify => Exec['storyboard-reload'],
|
||||||
|
require => [
|
||||||
|
File['/etc/storyboard'],
|
||||||
|
User['storyboard'],
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/etc/storyboard/projects.yaml':
|
||||||
|
ensure => present,
|
||||||
|
owner => 'storyboard',
|
||||||
|
mode => '0400',
|
||||||
|
source => $projects_file,
|
||||||
|
replace => true,
|
||||||
|
require => [
|
||||||
|
File['/etc/storyboard'],
|
||||||
|
User['storyboard'],
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
exec { 'migrate-storyboard-db':
|
||||||
|
command => 'storyboard-db-manage --config-file /etc/storyboard/storyboard.conf upgrade head',
|
||||||
|
path => '/usr/local/bin:/usr/bin:/bin/',
|
||||||
|
refreshonly => true,
|
||||||
|
subscribe => Exec['install-storyboard'],
|
||||||
|
require => [
|
||||||
|
File['/etc/storyboard/storyboard.conf'],
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/var/log/storyboard':
|
||||||
|
ensure => directory,
|
||||||
|
owner => 'storyboard',
|
||||||
|
require => User['storyboard'],
|
||||||
|
}
|
||||||
|
|
||||||
|
exec { 'storyboard-reload':
|
||||||
|
command => 'touch /usr/local/lib/python2.7/dist-packages/storyboard/api/app.wsgi',
|
||||||
|
path => '/usr/local/bin:/usr/bin:/bin/',
|
||||||
|
refreshonly => true,
|
||||||
|
}
|
||||||
|
|
||||||
|
# START storyboard-webclient
|
||||||
|
$tarball = 'storyboard-webclient.tar.gz'
|
||||||
|
|
||||||
|
file { '/var/lib/storyboard':
|
||||||
|
ensure => directory,
|
||||||
|
owner => 'storyboard',
|
||||||
|
group => 'storyboard',
|
||||||
|
}
|
||||||
|
|
||||||
|
# Using -z here to only download when the tarball has changed.
|
||||||
|
exec { 'get-webclient':
|
||||||
|
command => "curl ${storyboard_webclient_url} -z ./${tarball} -o ${tarball}",
|
||||||
|
path => '/bin:/usr/bin',
|
||||||
|
cwd => '/var/lib/storyboard',
|
||||||
|
require => [
|
||||||
|
File['/var/lib/storyboard'],
|
||||||
|
Package['curl'],
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
exec { 'unpack-webclient':
|
||||||
|
command => "tar -xzf ${tarball}",
|
||||||
|
path => '/bin:/usr/bin',
|
||||||
|
cwd => '/var/lib/storyboard',
|
||||||
|
require => Exec['get-webclient'],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/var/lib/storyboard/www':
|
||||||
|
ensure => directory,
|
||||||
|
owner => 'storyboard',
|
||||||
|
group => 'storyboard',
|
||||||
|
require => Exec['unpack-webclient'],
|
||||||
|
source => '/var/lib/storyboard/dist',
|
||||||
|
recurse => true,
|
||||||
|
purge => true,
|
||||||
|
force => true
|
||||||
|
}
|
||||||
|
|
||||||
|
# END storyboard-webclient
|
||||||
|
|
||||||
|
apache::vhost { $vhost_name:
|
||||||
|
port => 80,
|
||||||
|
docroot => 'MEANINGLESS ARGUMENT',
|
||||||
|
priority => '50',
|
||||||
|
template => 'storyboard/storyboard.vhost.erb',
|
||||||
|
require => Package['libapache2-mod-wsgi'],
|
||||||
|
}
|
||||||
|
|
||||||
|
a2mod { 'proxy':
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
|
||||||
|
a2mod { 'proxy_http':
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
|
||||||
|
a2mod {'wsgi':
|
||||||
|
ensure => present,
|
||||||
|
require => Package['libapache2-mod-wsgi'],
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
2
modules/storyboard/templates/storyboard.conf.erb
Normal file
2
modules/storyboard/templates/storyboard.conf.erb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[database]
|
||||||
|
connection=mysql://<%= mysql_user %>:<%= mysql_password %>@<%= mysql_host %>:3306/storyboard
|
17
modules/storyboard/templates/storyboard.vhost.erb
Normal file
17
modules/storyboard/templates/storyboard.vhost.erb
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<VirtualHost *:80>
|
||||||
|
DocumentRoot /var/lib/storyboard/www
|
||||||
|
ErrorLog /var/log/apache2/storyboard-error.log
|
||||||
|
CustomLog /var/log/apache2/storyboard-access.log common
|
||||||
|
|
||||||
|
WSGIDaemonProcess storyboard user=storyboard group=storyboard threads=5 python-path=/usr/local/lib/python2.7/dist-packages
|
||||||
|
WSGIScriptAlias /api /usr/local/lib/python2.7/dist-packages/storyboard/api/app.wsgi
|
||||||
|
|
||||||
|
# The app.wsgi file has to be accessible by apache. It won't
|
||||||
|
# be visible to clients because of the DocumentRoot though.
|
||||||
|
<Directory /usr/local/lib/python2.7/dist-packages/storyboard/>
|
||||||
|
WSGIProcessGroup storyboard
|
||||||
|
WSGIApplicationGroup %{GLOBAL}
|
||||||
|
Order deny,allow
|
||||||
|
Allow from all
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
Loading…
Reference in New Issue
Block a user