265bd8fe1d
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
181 lines
4.5 KiB
Puppet
181 lines
4.5 KiB
Puppet
# 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'],
|
|
}
|
|
|
|
}
|