Puppet Class: role::horizon
- Defined in:
- puppet/modules/role/manifests/horizon.pp
Overview
Class: role::horizon
Provision an OpenStack horizon service accessible on the horizon.local.wmftest.net vhost.
- log_dir
-
Directory to write log files to. Directory must already exist. A 'horizon' subdirectory will be created.
- vhost_name
-
Apache vhost name. (example: 'striker.local.wmftest.net')
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'puppet/modules/role/manifests/horizon.pp', line 12
class role::horizon (
$log_dir,
$vhost_name,
) {
include ::role::keystone
include ::apache
include ::apache::mod::uwsgi
include ::apache::mod::headers
include ::apache::mod::proxy
include ::apache::mod::proxy_balancer
include ::apache::mod::proxy_http
$deploy_dir = '/usr/share/openstack-dashboard/openstack_dashboard'
$static_dir = '/var/lib/openstack-dashboard/static'
$packages = [
'fonts-font-awesome',
'fonts-materialdesignicons-webfont',
'fonts-roboto-fontface',
'libjs-angular-gettext',
'libjs-angularjs',
'libjs-angularjs-smart-table',
'libjs-bootswatch',
'libjs-d3',
'libjs-jquery-cookie',
'libjs-jquery-metadata',
'libjs-jquery-tablesorter',
'libjs-jquery-ui',
'libjs-jquery.quicksearch',
'libjs-jsencrypt',
'libjs-lrdragndrop',
'libjs-magic-search',
'libjs-rickshaw',
'libjs-spin.js',
'libjs-term.js',
'libjs-twitter-bootstrap',
'libjs-twitter-bootstrap-datepicker',
'openstack-dashboard',
'python-ceilometerclient',
'python-compressor',
'python-csscompressor',
'python-designate-dashboard',
'python-django',
'python-django-appconf',
'python-django-babel',
'python-django-common',
'python-django-compressor',
'python-django-horizon',
'python-django-openstack-auth',
'python-django-overextends',
'python-django-pyscss',
'python-heatclient',
'python-keystoneclient',
'python-openstack-auth',
'python-pint',
'python-pyscss',
'python-rcssmin',
'python-rjsmin',
'python-xstatic',
'python-xstatic-angular',
'python-xstatic-angular-bootstrap',
'python-xstatic-angular-gettext',
'python-xstatic-angular-lrdragndrop',
'python-xstatic-bootstrap-datepicker',
'python-xstatic-bootstrap-scss',
'python-xstatic-bootswatch',
'python-xstatic-d3',
'python-xstatic-font-awesome',
'python-xstatic-hogan',
'python-xstatic-jasmine',
'python-xstatic-jquery',
'python-xstatic-jquery-migrate',
'python-xstatic-jquery-ui',
'python-xstatic-jquery.quicksearch',
'python-xstatic-jquery.tablesorter',
'python-xstatic-jsencrypt',
'python-xstatic-magic-search',
'python-xstatic-mdi',
'python-xstatic-rickshaw',
'python-xstatic-roboto-fontface',
'python-xstatic-smart-table',
'python-xstatic-spin',
'python-xstatic-term.js',
]
package { $packages:
ensure => 'present',
}
file { "${log_dir}/horizon":
ensure => 'directory',
mode => '0777',
}
file { '/etc/openstack-dashboard/local_settings.py':
ensure => 'present',
content => template('role/horizon/local_settings.py.erb'),
owner => 'www-data',
group => 'www-data',
mode => '0440',
require => Package['openstack-dashboard'],
notify => [
Systemd::Service['uwsgi-horizon'],
Exec['djangorefresh'],
],
}
$port = 8081
uwsgi::app { 'horizon':
settings => {
uwsgi => {
plugins => 'python, logfile',
master => true,
http-socket => "127.0.0.1:${port}",
processes => 2,
threads => 2,
die-on-term => true,
chdir => '/etc/openstack-dashboard',
wsgi-file => "${deploy_dir}/wsgi/django.wsgi",
uid => 'www-data',
gid => 'www-data',
logger => "file:${log_dir}/horizon/main.log",
req-logger => "file:${log_dir}/horizon/access.log",
log-format => '%(addr) - %(user) [%(ltime)] "%(method) %(uri) (proto)" %(status) %(size) "%(referer)" "%(uagent)" %(micros)',
},
},
}
apache::site { $vhost_name:
ensure => present,
# Load before MediaWiki wildcard vhost for Labs.
priority => 40,
content => template('role/horizon/apache.conf.erb'),
require => Uwsgi::App['horizon'],
notify => Service['apache2'],
}
exec { 'djangorefresh':
refreshonly => true,
command => 'python manage.py collectstatic --noinput && python manage.py compress',
path => '/usr/bin',
cwd => '/usr/share/openstack-dashboard',
require => File['/etc/openstack-dashboard/local_settings.py'],
notify => Systemd::Service['uwsgi-horizon'],
}
}
|