Add site module to deploy frontend to a dir
This commit adds a site.pp file which is used to deploy the frontend to a directory instead of setting up a vhost. When deploying this on status.o.o we need to put the dashboard in a dir on an existing vhost instead of deploying a seperate one. This commit adds the class to do this. Change-Id: Ic47fbd817a293a257f7a9b164682fc96cce5321e
This commit is contained in:
parent
9d625d903d
commit
c974b922e9
@ -2,24 +2,12 @@
|
||||
# params:
|
||||
# source_dir:
|
||||
# The directory where the application will be running
|
||||
# serveradmin:
|
||||
# Used in the Apache virtual host, eg., openstack-health@openstack.org
|
||||
# vhost_name:
|
||||
# Used in the Apache virtual host, eg., health.openstack.org
|
||||
# vhost_port:
|
||||
# Used in the Apache virtual host, eg., 5000
|
||||
# api_endpoint:
|
||||
# The URL where openstack-health API is running
|
||||
|
||||
class openstack_health::frontend(
|
||||
$source_dir = '/opt/openstack-health',
|
||||
$serveradmin = "webmaster@${::fqdn}",
|
||||
$vhost_name = 'localhost',
|
||||
$vhost_port = 80,
|
||||
$api_endpoint = 'http://localhost:5000',
|
||||
$api_endpoint,
|
||||
) {
|
||||
|
||||
$frontend_dir = "${source_dir}/build"
|
||||
|
||||
class { '::nodejs':
|
||||
legacy_debian_symlinks => true,
|
||||
repo_url_suffix => 'node_0.12',
|
||||
@ -57,12 +45,13 @@ class openstack_health::frontend(
|
||||
subscribe => Vcsrepo[$source_dir],
|
||||
}
|
||||
|
||||
::httpd::vhost { "${vhost_name}-frontend":
|
||||
docroot => 'MEANINGLESS ARGUMENT',
|
||||
port => $vhost_port,
|
||||
priority => '100',
|
||||
ssl => false,
|
||||
template => 'openstack_health/openstack-health-frontend.vhost.erb',
|
||||
require => Exec['build-static-files'],
|
||||
file { "${source_dir}/build/config.json":
|
||||
ensure => present,
|
||||
owner => 'openstack_health',
|
||||
group => 'openstack_health',
|
||||
mode => '0755',
|
||||
content => template('openstack_health/config.json.erb'),
|
||||
require => Exec['build-static-files']
|
||||
}
|
||||
|
||||
}
|
||||
|
40
manifests/site.pp
Normal file
40
manifests/site.pp
Normal file
@ -0,0 +1,40 @@
|
||||
# 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.
|
||||
#
|
||||
# == Define: openstack_health::site
|
||||
#
|
||||
|
||||
define openstack_health::site(
|
||||
$httproot,
|
||||
$api_endpoint = 'http://localhost:5000'
|
||||
) {
|
||||
|
||||
class { '::openstack_health::frontend':
|
||||
api_endpoint => $api_endpoint
|
||||
}
|
||||
|
||||
exec {'move-static-files':
|
||||
command => "mv ${openstack_health::source_dir}/build ${httproot}",
|
||||
path => ['/usr/local/bin/', '/usr/bin/', '/bin/'],
|
||||
subscribe => Exec['build-static-files']
|
||||
}
|
||||
|
||||
file {$httproot:
|
||||
ensure => directory,
|
||||
owner => 'openstack_health',
|
||||
group => 'openstack_health',
|
||||
mode => '0755',
|
||||
require => Exec['move-static-files']
|
||||
}
|
||||
}
|
32
manifests/vhost.pp
Normal file
32
manifests/vhost.pp
Normal file
@ -0,0 +1,32 @@
|
||||
# Install and maintain OpenStack Health.
|
||||
# params:
|
||||
# serveradmin:
|
||||
# Used in the Apache virtual host, eg., openstack-health@openstack.org
|
||||
# vhost_name:
|
||||
# Used in the Apache virtual host, eg., health.openstack.org
|
||||
# vhost_port:
|
||||
# Used in the Apache virtual host, eg., 5000
|
||||
# api_endpoint:
|
||||
# The URL where openstack-health API is running
|
||||
class openstack_health::vhost(
|
||||
$serveradmin = "webmaster@${::fqdn}",
|
||||
$vhost_name = 'localhost',
|
||||
$vhost_port = 80,
|
||||
$api_endpoint = 'http://localhost:5000',
|
||||
) {
|
||||
|
||||
class { '::openstack_health::frontend':
|
||||
api_endpoint => $api_endpoint
|
||||
}
|
||||
|
||||
$frontend_dir = "${openstack_health::source_dir}/build"
|
||||
|
||||
httpd::vhost { "${vhost_name}-frontend":
|
||||
docroot => 'MEANINGLESS ARGUMENT',
|
||||
port => $vhost_port,
|
||||
priority => '100',
|
||||
ssl => false,
|
||||
template => 'openstack_health/openstack-health-frontend.vhost.erb',
|
||||
require => Exec['build-static-files'],
|
||||
}
|
||||
}
|
3
templates/config.json.erb
Normal file
3
templates/config.json.erb
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"apiRoot": <%= @api_endpoint %>
|
||||
}
|
Loading…
Reference in New Issue
Block a user