puppet-openstack_health/manifests/frontend.pp
Colleen Murphy 7df7a1dddb Install npm
The nodejs module does not install npm by default, and it is needed in
order to use it as a package provider. Also remove the npm package test
from beaker, since it makes no sense for package 'npm' to be installed
by provider 'npm'.

Change-Id: Idc3d51399f1263eded3f373a7c852a609b15a204
2017-06-11 21:14:53 +02:00

59 lines
1.4 KiB
Puppet

# Install and maintain OpenStack Health.
# params:
# source_dir:
# The directory where the application will be running
class openstack_health::frontend(
$api_endpoint,
$source_dir = '/opt/openstack-health',
) {
class { '::nodejs':
legacy_debian_symlinks => true,
repo_url_suffix => 'node_0.12',
npm_package_ensure => 'present',
}
package { 'node-gyp':
ensure => present,
provider => npm,
require => Class['::nodejs'],
}
package { 'gulp':
ensure => present,
provider => npm,
require => Class['::nodejs'],
}
exec { 'install-frontend-requirements':
command => 'npm install',
cwd => $source_dir,
path => ['/usr/local/bin/', '/usr/bin/', '/bin/'],
timeout => 900,
require => [
Package['gulp'],
Package['node-gyp'],
],
subscribe => Vcsrepo[$source_dir],
}
exec { 'build-static-files':
command => 'gulp prod',
cwd => $source_dir,
path => ['/usr/local/bin/', '/usr/bin/', '/bin/'],
require => Exec['install-frontend-requirements'],
subscribe => Vcsrepo[$source_dir],
}
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']
}
}