Update zuul-web install for javascript stack
With the update to the use of yarn/webpack for the zuul-web javascript stack, there is now a pre-built tarball of the web assets. Update the code to use it. An alternative to this approach would be to install nodejs and yarn on the machine and just do a pip install . in the zuul source dir which would also work ... but since there is an option that doesn't require the need to run the build tools, why not use it? Because spec/acceptance/fixtures/default.pp is hard-coded to the zuulv3 install path, we can remove the now unnecessary checks from it. Move the status backups to /var/lib/zuul/backup, instead of www/backup as the www directory no longer exists. Also remove it as the documentroot. Depends-On: https://review.openstack.org/547790 Change-Id: Ib88b48ddea26ef5d8d0d152774112844b180f77e
This commit is contained in:
parent
8f68109b2e
commit
2fb12bb339
@ -114,8 +114,6 @@ class zuul (
|
|||||||
$packages = [
|
$packages = [
|
||||||
'libffi-dev',
|
'libffi-dev',
|
||||||
'libssl-dev',
|
'libssl-dev',
|
||||||
'python-paste',
|
|
||||||
'python-webob',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
package { $packages:
|
package { $packages:
|
||||||
@ -135,6 +133,7 @@ class zuul (
|
|||||||
require => Class['pip'],
|
require => Class['pip'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ! $zuulv3 {
|
||||||
# needed by python-keystoneclient, has system bindings
|
# needed by python-keystoneclient, has system bindings
|
||||||
# Zuul and Nodepool both need it, so make it conditional
|
# Zuul and Nodepool both need it, so make it conditional
|
||||||
if ! defined(Package['python-lxml']) {
|
if ! defined(Package['python-lxml']) {
|
||||||
@ -168,6 +167,7 @@ class zuul (
|
|||||||
ensure => present,
|
ensure => present,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
user { 'zuul':
|
user { 'zuul':
|
||||||
ensure => present,
|
ensure => present,
|
||||||
@ -199,17 +199,19 @@ class zuul (
|
|||||||
Package['build-essential'],
|
Package['build-essential'],
|
||||||
Package['libffi-dev'],
|
Package['libffi-dev'],
|
||||||
Package['libssl-dev'],
|
Package['libssl-dev'],
|
||||||
Package['python-daemon'],
|
|
||||||
Package['python-lxml'],
|
|
||||||
Package['python-paramiko'],
|
|
||||||
Package['python-paste'],
|
|
||||||
Package['python-webob'],
|
|
||||||
Package['python-yaml'],
|
|
||||||
Package['yappi'],
|
Package['yappi'],
|
||||||
Package['yui-compressor'],
|
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ! $zuulv3 {
|
||||||
|
Exec['install_zuul'] -> Package['python-daemon']
|
||||||
|
Exec['install_zuul'] -> Package['python-daemon']
|
||||||
|
Exec['install_zuul'] -> Package['python-lxml']
|
||||||
|
Exec['install_zuul'] -> Package['python-paramiko']
|
||||||
|
Exec['install_zuul'] -> Package['python-yaml']
|
||||||
|
Exec['install_zuul'] -> Package['yui-compressor']
|
||||||
|
}
|
||||||
|
|
||||||
file { '/etc/zuul':
|
file { '/etc/zuul':
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
group => 'zuul',
|
group => 'zuul',
|
||||||
@ -365,6 +367,23 @@ class zuul (
|
|||||||
content => $zuul_ssh_private_key,
|
content => $zuul_ssh_private_key,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $zuulv3 {
|
||||||
|
package { 'libjs-jquery':
|
||||||
|
ensure => absent,
|
||||||
|
}
|
||||||
|
$v2_web_dirs = [
|
||||||
|
'/opt/twitter-bootstrap',
|
||||||
|
'/opt/jquery-visibility',
|
||||||
|
'/var/lib/zuul/www',
|
||||||
|
'/opt/graphitejs',
|
||||||
|
]
|
||||||
|
|
||||||
|
file { $v2_web_dirs:
|
||||||
|
ensure => absent,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
file { '/var/lib/zuul/www':
|
file { '/var/lib/zuul/www':
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
require => File['/var/lib/zuul'],
|
require => File['/var/lib/zuul'],
|
||||||
@ -477,6 +496,7 @@ class zuul (
|
|||||||
target => '/opt/zuul/etc/status/public_html/images',
|
target => '/opt/zuul/etc/status/public_html/images',
|
||||||
require => File['/var/lib/zuul/www'],
|
require => File['/var/lib/zuul/www'],
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if $zuulv3 {
|
if $zuulv3 {
|
||||||
file { '/etc/default/zuul-executor':
|
file { '/etc/default/zuul-executor':
|
||||||
|
133
manifests/web.pp
133
manifests/web.pp
@ -77,9 +77,9 @@ class zuul::web (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/var/lib/zuul/www/backup':
|
file { '/var/lib/zuul/backup':
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
require => File['/var/lib/zuul/www'],
|
require => File['/var/lib/zuul'],
|
||||||
}
|
}
|
||||||
|
|
||||||
if $enable_status_backups {
|
if $enable_status_backups {
|
||||||
@ -97,10 +97,10 @@ class zuul::web (
|
|||||||
}
|
}
|
||||||
cron { 'zuul_scheduler_status_backup':
|
cron { 'zuul_scheduler_status_backup':
|
||||||
user => 'root',
|
user => 'root',
|
||||||
command => "timeout -k 5 10 curl ${status} -o /var/lib/zuul/www/backup/status_$(date +\\%s).json 2>/dev/null",
|
command => "timeout -k 5 10 curl ${status} -o /var/lib/zuul/backup/status_$(date +\\%s).json 2>/dev/null",
|
||||||
require => [Package['curl'],
|
require => [Package['curl'],
|
||||||
User['zuul'],
|
User['zuul'],
|
||||||
File['/var/lib/zuul/www/backup']],
|
File['/var/lib/zuul/backup']],
|
||||||
}
|
}
|
||||||
# Rotate backups and keep no more than 120 files -- or 2 hours worth of
|
# Rotate backups and keep no more than 120 files -- or 2 hours worth of
|
||||||
# backup if Zuul has 100% uptime.
|
# backup if Zuul has 100% uptime.
|
||||||
@ -111,84 +111,85 @@ class zuul::web (
|
|||||||
cron { 'zuul_scheduler_status_prune':
|
cron { 'zuul_scheduler_status_prune':
|
||||||
user => 'root',
|
user => 'root',
|
||||||
minute => '0',
|
minute => '0',
|
||||||
command => 'flock -n /var/run/status_prune.lock ls -dt -1 /var/lib/zuul/www/backup/* |sed -e "1,120d" |xargs rm -f',
|
command => 'flock -n /var/run/status_prune.lock ls -dt -1 /var/lib/zuul/backup/* |sed -e "1,120d" |xargs rm -f',
|
||||||
require => Cron['zuul_scheduler_status_backup'],
|
require => Cron['zuul_scheduler_status_backup'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/var/lib/zuul/www/static':
|
file { '/var/lib/zuul/www/static':
|
||||||
|
ensure => absent,
|
||||||
|
}
|
||||||
|
|
||||||
|
$zuul_web_root = '/opt/zuul-web'
|
||||||
|
$zuul_web_content_root = '/opt/zuul-web/content'
|
||||||
|
$zuul_web_src_root = '/opt/zuul-web/source'
|
||||||
|
$zuul_web_filename = 'zuul-content-latest.tar.gz'
|
||||||
|
$zuul_web_url = "http://tarballs.openstack.org/zuul/${zuul_web_filename}"
|
||||||
|
|
||||||
|
file { $zuul_web_root:
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
require => File['/var/lib/zuul/www'],
|
group => 'zuul',
|
||||||
|
mode => '0755',
|
||||||
|
owner => 'zuul',
|
||||||
|
require => User['zuul'],
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/var/lib/zuul/www/static/js':
|
file { $zuul_web_content_root:
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
require => File['/var/lib/zuul/www/static'],
|
group => 'zuul',
|
||||||
|
mode => '0755',
|
||||||
|
owner => 'zuul',
|
||||||
|
require => [
|
||||||
|
File[$zuul_web_root],
|
||||||
|
User['zuul'],
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/var/lib/zuul/www/static/js/jquery.min.js':
|
file { $zuul_web_src_root:
|
||||||
ensure => link,
|
ensure => directory,
|
||||||
target => '/usr/share/javascript/jquery/jquery.min.js',
|
group => 'zuul',
|
||||||
require => [File['/var/lib/zuul/www/static/js'],
|
mode => '0755',
|
||||||
Package['libjs-jquery']],
|
owner => 'zuul',
|
||||||
|
require => [
|
||||||
|
File[$zuul_web_root],
|
||||||
|
User['zuul'],
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/var/lib/zuul/www/static/bootstrap':
|
# Download the latest zuul-web
|
||||||
ensure => link,
|
exec { 'get-zuul-web':
|
||||||
target => '/opt/twitter-bootstrap/dist',
|
command => "curl ${zuul_web_url} -z ./${zuul_web_filename} -o ${zuul_web_filename}",
|
||||||
require => [File['/var/lib/zuul/www/static'],
|
|
||||||
Package['libjs-jquery'],
|
|
||||||
Vcsrepo['/opt/twitter-bootstrap']],
|
|
||||||
}
|
|
||||||
|
|
||||||
exec { 'install-jquery-visibility-zuul-web':
|
|
||||||
command => 'yui-compressor -o /var/lib/zuul/www/static/js/jquery-visibility.js /opt/jquery-visibility/jquery-visibility.js',
|
|
||||||
path => 'bin:/usr/bin',
|
|
||||||
refreshonly => true,
|
|
||||||
subscribe => Vcsrepo['/opt/jquery-visibility'],
|
|
||||||
require => [File['/var/lib/zuul/www/static/js'],
|
|
||||||
Package['yui-compressor'],
|
|
||||||
Vcsrepo['/opt/jquery-visibility']],
|
|
||||||
}
|
|
||||||
|
|
||||||
file { '/var/lib/zuul/www/static/js/jquery.graphite.js':
|
|
||||||
ensure => link,
|
|
||||||
target => '/opt/graphitejs/jquery.graphite.js',
|
|
||||||
require => [File['/var/lib/zuul/www/static/js'],
|
|
||||||
Vcsrepo['/opt/graphitejs']],
|
|
||||||
}
|
|
||||||
|
|
||||||
# Download angular
|
|
||||||
# NOTE: This is using a hardcoded URL because soon this will shift to being
|
|
||||||
# based on a more javascript-native toolchain.
|
|
||||||
exec { 'get-angular-zuul-web':
|
|
||||||
command => 'curl https://code.angularjs.org/1.5.8/angular.min.js -z /var/lib/zuul/www/static/js/angular.min.js -o /var/lib/zuul/www/static/js/angular.min.js',
|
|
||||||
path => '/bin:/usr/bin',
|
path => '/bin:/usr/bin',
|
||||||
require => [Package[curl],
|
cwd => $zuul_web_root,
|
||||||
File['/var/lib/zuul/www/static/js']],
|
require => [
|
||||||
onlyif => "curl -I https://code.angularjs.org/1.5.8/angular.min.js -z /var/lib/zuul/www/static/js/angular.min.js | grep '200 OK'",
|
File[$zuul_web_root],
|
||||||
creates => '/var/lib/zuul/www/static/js/angular.min.js',
|
File[$zuul_web_content_root],
|
||||||
|
File[$zuul_web_src_root],
|
||||||
|
],
|
||||||
|
onlyif => "curl -I ${zuul_web_url} -z ./${zuul_web_filename} | grep '200 OK'",
|
||||||
}
|
}
|
||||||
|
|
||||||
# For now, symlink in the static parts of zuul-web which are not
|
# Unpack storyboard-zuul_web
|
||||||
# tenant-scoped since they share a URL space with the external
|
exec { 'unpack-zuul-web':
|
||||||
# dependencies.
|
command => "rm -rf ${zuul_web_src_root}/* && tar -C ${zuul_web_src_root} -xzf ./${zuul_web_filename}",
|
||||||
file { '/var/lib/zuul/www/static/javascripts':
|
path => '/bin:/usr/bin',
|
||||||
ensure => link,
|
refreshonly => true,
|
||||||
target => '/opt/zuul/zuul/web/static/javascripts',
|
cwd => $zuul_web_root,
|
||||||
require => [File['/var/lib/zuul/www/static'],
|
require => Exec['get-zuul-web'],
|
||||||
Vcsrepo['/opt/zuul']],
|
subscribe => Exec['get-zuul-web'],
|
||||||
}
|
}
|
||||||
file { '/var/lib/zuul/www/static/images':
|
|
||||||
ensure => link,
|
# Sync zuul-web to the directory we serve it from. This is so that we don't
|
||||||
target => '/opt/zuul/zuul/web/static/images',
|
# have files go missing - but also so that we can clean up old verisons of
|
||||||
require => [File['/var/lib/zuul/www/static'],
|
# files. The assets built by webpack have hashes in the filenames to help
|
||||||
Vcsrepo['/opt/zuul']],
|
# with caching.
|
||||||
}
|
exec { 'sync-zuul-web':
|
||||||
file { '/var/lib/zuul/www/static/styles':
|
command => "rsync -rl --delete-delay . ${zuul_web_content_root}/",
|
||||||
ensure => link,
|
path => '/bin:/usr/bin',
|
||||||
target => '/opt/zuul/zuul/web/static/styles',
|
refreshonly => true,
|
||||||
require => [File['/var/lib/zuul/www/static'],
|
cwd => $zuul_web_src_root,
|
||||||
Vcsrepo['/opt/zuul']],
|
require => Exec['unpack-zuul-web'],
|
||||||
|
subscribe => Exec['unpack-zuul-web'],
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
# coding: utf-8
|
||||||
require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
|
require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
|
||||||
|
|
||||||
# https://blog.lorentzca.me/add-custom-matcher-of-serverspec/
|
# https://blog.lorentzca.me/add-custom-matcher-of-serverspec/
|
||||||
@ -63,13 +64,6 @@ describe 'puppet-zuul module', :if => ['debian', 'ubuntu'].include?(os[:family])
|
|||||||
packages = [
|
packages = [
|
||||||
package('git'),
|
package('git'),
|
||||||
package('build-essential'),
|
package('build-essential'),
|
||||||
package('python-lxml'),
|
|
||||||
package('python-yaml'),
|
|
||||||
package('python-paramiko'),
|
|
||||||
package('python-daemon'),
|
|
||||||
package('yui-compressor'),
|
|
||||||
package('python-paste'),
|
|
||||||
package('python-webob')
|
|
||||||
]
|
]
|
||||||
packages << package('apache2') if ['ubuntu', 'debian'].include?(os[:family])
|
packages << package('apache2') if ['ubuntu', 'debian'].include?(os[:family])
|
||||||
packages << package('httpd') if ['centos', 'redhat'].include?(os[:family])
|
packages << package('httpd') if ['centos', 'redhat'].include?(os[:family])
|
||||||
@ -136,25 +130,6 @@ describe 'puppet-zuul module', :if => ['debian', 'ubuntu'].include?(os[:family])
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'public_html symlinks' do
|
|
||||||
symlinkies = {
|
|
||||||
file('/var/lib/zuul/www/images') => '/opt/zuul/etc/status/public_html/images',
|
|
||||||
file('/var/lib/zuul/www/index.html') => '/opt/zuul/etc/status/public_html/index.html',
|
|
||||||
file('/var/lib/zuul/www/jquery.zuul.js') => '/opt/zuul/etc/status/public_html/jquery.zuul.js',
|
|
||||||
file('/var/lib/zuul/www/styles') => '/opt/zuul/etc/status/public_html/styles',
|
|
||||||
file('/var/lib/zuul/www/zuul.app.js') => '/opt/zuul/etc/status/public_html/zuul.app.js',
|
|
||||||
file('/var/lib/zuul/www/lib/jquery.graphite.js') => '/opt/graphitejs/jquery.graphite.js',
|
|
||||||
file('/var/lib/zuul/www/lib/bootstrap') => '/opt/twitter-bootstrap/dist',
|
|
||||||
}
|
|
||||||
|
|
||||||
symlinkies.each do |link, destination|
|
|
||||||
describe link do
|
|
||||||
it { should be_symlink }
|
|
||||||
it { should be_linked_to destination }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe file('/var/lib/zuul/ssh/id_rsa') do
|
describe file('/var/lib/zuul/ssh/id_rsa') do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should contain('-----BEGIN RSA PRIVATE KEY-----') }
|
it { should contain('-----BEGIN RSA PRIVATE KEY-----') }
|
||||||
|
@ -1,17 +1,7 @@
|
|||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName <%= @vhost_name %>
|
ServerName <%= @vhost_name %>
|
||||||
ServerAdmin <%= @serveradmin %>
|
ServerAdmin <%= @serveradmin %>
|
||||||
DocumentRoot /var/lib/zuul/www
|
|
||||||
|
|
||||||
<Directory /var/lib/zuul/www>
|
|
||||||
<IfVersion >= 2.4>
|
|
||||||
Require all granted
|
|
||||||
</IfVersion>
|
|
||||||
<IfVersion < 2.4>
|
|
||||||
Order deny,allow
|
|
||||||
Allow from all
|
|
||||||
</IfVersion>
|
|
||||||
</Directory>
|
|
||||||
<Directory /usr/lib/git-core>
|
<Directory /usr/lib/git-core>
|
||||||
<IfVersion >= 2.4>
|
<IfVersion >= 2.4>
|
||||||
Require all granted
|
Require all granted
|
||||||
@ -42,19 +32,8 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @zuulv3 %>
|
<% if @zuulv3 %>
|
||||||
RewriteRule ^/connection/(.*) <%= @zuul_web_url %>/connection/$1 [P]
|
|
||||||
RewriteRule ^/status.json <%= @zuul_web_full_url %>/status.json [P]
|
|
||||||
RewriteRule ^/status.html <%= @zuul_web_full_url %>/status.html [P]
|
|
||||||
RewriteRule ^/status <%= @zuul_web_full_url %>/status [P]
|
|
||||||
RewriteRule ^/jobs.json <%= @zuul_web_full_url %>/jobs.json [P]
|
|
||||||
RewriteRule ^/jobs.html <%= @zuul_web_full_url %>/jobs.html [P]
|
|
||||||
RewriteRule ^/jobs <%= @zuul_web_full_url %>/jobs [P]
|
|
||||||
RewriteRule ^/builds.json <%= @zuul_web_full_url %>/builds.json [P]
|
|
||||||
RewriteRule ^/builds.html <%= @zuul_web_full_url %>/builds.html [P]
|
|
||||||
RewriteRule ^/builds <%= @zuul_web_full_url %>/builds [P]
|
|
||||||
RewriteRule ^/console-stream <%= @zuul_web_full_url.sub('http://', 'ws://') %>/console-stream [P]
|
RewriteRule ^/console-stream <%= @zuul_web_full_url.sub('http://', 'ws://') %>/console-stream [P]
|
||||||
RewriteRule ^/stream.html <%= @zuul_web_full_url %>/stream.html [P]
|
RewriteRule ^/(.*)$ <%= @zuul_web_full_url %>/$1 [P]
|
||||||
RewriteRule ^/(.*).pub$ <%= @zuul_web_full_url %>/$1.pub [P]
|
|
||||||
RewriteRule ^/$ <%= @zuul_web_full_url %>/status.html [P]
|
RewriteRule ^/$ <%= @zuul_web_full_url %>/status.html [P]
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
@ -138,19 +117,8 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @zuulv3 %>
|
<% if @zuulv3 %>
|
||||||
RewriteRule ^/connection/(.*) <%= @zuul_web_url %>/connection/$1 [P]
|
|
||||||
RewriteRule ^/status.json <%= @zuul_web_full_url %>/status.json [P]
|
|
||||||
RewriteRule ^/status.html <%= @zuul_web_full_url %>/status.html [P]
|
|
||||||
RewriteRule ^/status <%= @zuul_web_full_url %>/status [P]
|
|
||||||
RewriteRule ^/jobs.json <%= @zuul_web_full_url %>/jobs.json [P]
|
|
||||||
RewriteRule ^/jobs.html <%= @zuul_web_full_url %>/jobs.html [P]
|
|
||||||
RewriteRule ^/jobs <%= @zuul_web_full_url %>/jobs [P]
|
|
||||||
RewriteRule ^/builds.json <%= @zuul_web_full_url %>/builds.json [P]
|
|
||||||
RewriteRule ^/builds.html <%= @zuul_web_full_url %>/builds.html [P]
|
|
||||||
RewriteRule ^/builds <%= @zuul_web_full_url %>/builds [P]
|
|
||||||
RewriteRule ^/console-stream <%= @zuul_web_full_url.sub('http://', 'ws://') %>/console-stream [P]
|
RewriteRule ^/console-stream <%= @zuul_web_full_url.sub('http://', 'ws://') %>/console-stream [P]
|
||||||
RewriteRule ^/stream.html <%= @zuul_web_full_url %>/stream.html [P]
|
RewriteRule ^/(.*)$ <%= @zuul_web_full_url %>/$1 [P]
|
||||||
RewriteRule ^/(.*).pub$ <%= @zuul_web_full_url %>/$1.pub [P]
|
|
||||||
RewriteRule ^/$ <%= @zuul_web_full_url %>/status.html [P]
|
RewriteRule ^/$ <%= @zuul_web_full_url %>/status.html [P]
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ disk_limit_per_job=<%= @disk_limit_per_job %>
|
|||||||
|
|
||||||
[web]
|
[web]
|
||||||
log_config=/etc/zuul/web-logging.conf
|
log_config=/etc/zuul/web-logging.conf
|
||||||
|
static_path=/opt/zuul-web/content
|
||||||
<% if @web_listen_address != "" -%>
|
<% if @web_listen_address != "" -%>
|
||||||
listen_address=<%= @web_listen_address %>
|
listen_address=<%= @web_listen_address %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
Loading…
Reference in New Issue
Block a user