Added WebClient installer.
This commit is contained in:
parent
7cd53e46c6
commit
0e50af1532
@ -20,22 +20,49 @@
|
|||||||
class refstack::apache::http () {
|
class refstack::apache::http () {
|
||||||
require ::refstack::params
|
require ::refstack::params
|
||||||
require ::refstack::api
|
require ::refstack::api
|
||||||
# require ::refstack::app
|
require ::refstack::app
|
||||||
|
|
||||||
# Pull various variables into this module, for slightly saner templates.
|
# Pull various variables into this module, for slightly saner templates.
|
||||||
$install_api_root = $::refstack::params::install_api_root
|
$install_api_root = $::refstack::params::install_api_root
|
||||||
$install_www_root = $::refstack::params::install_www_root
|
$install_www_root = $::refstack::params::install_www_root
|
||||||
|
$src_www_root = $::refstack::params::src_www_root
|
||||||
$hostname = $::refstack::params::hostname
|
$hostname = $::refstack::params::hostname
|
||||||
$user = $::refstack::params::user
|
$user = $::refstack::params::user
|
||||||
$group = $::refstack::params::group
|
$group = $::refstack::params::group
|
||||||
$server_admin = $::refstack::params::server_admin
|
$server_admin = $::refstack::params::server_admin
|
||||||
$python_version = $::refstack::params::python_version
|
$python_version = $::refstack::params::python_version
|
||||||
|
|
||||||
# Install apache
|
# Install apache
|
||||||
include apache
|
include apache
|
||||||
|
include apache::params
|
||||||
include apache::mod::wsgi
|
include apache::mod::wsgi
|
||||||
|
|
||||||
# Set up refstack as HTTP
|
# Create a copy of the wsgi file with apache user permissions.
|
||||||
|
file { '/etc/refstack/app.wsgi':
|
||||||
|
ensure => present,
|
||||||
|
owner => $::apache::params::user,
|
||||||
|
group => $::apache::params::group,
|
||||||
|
mode => '0644',
|
||||||
|
source => "${src_www_root}/refstack/api/app.wsgi",
|
||||||
|
require => [
|
||||||
|
Class['refstack::api']
|
||||||
|
],
|
||||||
|
notify => Service['httpd'],
|
||||||
|
}
|
||||||
|
|
||||||
|
# Synchronize the app directory and the apache directory.
|
||||||
|
file { $install_www_root:
|
||||||
|
ensure => directory,
|
||||||
|
owner => $::apache::params::user,
|
||||||
|
group => $::apache::params::group,
|
||||||
|
source => "${src_www_root}/refstack-ui/app",
|
||||||
|
recurse => true,
|
||||||
|
purge => true,
|
||||||
|
force => true,
|
||||||
|
notify => Service['httpd'],
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set up refstack as HTTP
|
||||||
apache::vhost { $hostname:
|
apache::vhost { $hostname:
|
||||||
port => 80,
|
port => 80,
|
||||||
docroot => $install_www_root,
|
docroot => $install_www_root,
|
||||||
@ -43,5 +70,6 @@ class refstack::apache::http () {
|
|||||||
template => 'refstack/refstack_http.vhost.erb',
|
template => 'refstack/refstack_http.vhost.erb',
|
||||||
ssl => false,
|
ssl => false,
|
||||||
notify => Service['httpd'],
|
notify => Service['httpd'],
|
||||||
|
require => File['/etc/refstack/app.wsgi'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
# protocol.
|
# protocol.
|
||||||
#
|
#
|
||||||
class refstack::apache::https () {
|
class refstack::apache::https () {
|
||||||
|
|
||||||
require ::refstack::params
|
require ::refstack::params
|
||||||
require ::refstack::api
|
require ::refstack::api
|
||||||
# require ::refstack::app
|
require ::refstack::app
|
||||||
|
|
||||||
# Pull various variables into this module, for slightly saner templates.
|
# Pull various variables into this module, for slightly saner templates.
|
||||||
$install_api_root = $::refstack::params::install_api_root
|
$install_api_root = $::refstack::params::install_api_root
|
||||||
$install_www_root = $::refstack::params::install_www_root
|
$install_www_root = $::refstack::params::install_www_root
|
||||||
|
$src_www_root = $::refstack::params::src_www_root
|
||||||
$hostname = $::refstack::params::hostname
|
$hostname = $::refstack::params::hostname
|
||||||
$user = $::refstack::params::user
|
$user = $::refstack::params::user
|
||||||
$group = $::refstack::params::group
|
$group = $::refstack::params::group
|
||||||
@ -41,8 +41,22 @@ class refstack::apache::https () {
|
|||||||
|
|
||||||
# Install apache
|
# Install apache
|
||||||
include apache
|
include apache
|
||||||
|
include apache::params
|
||||||
include apache::mod::wsgi
|
include apache::mod::wsgi
|
||||||
|
|
||||||
|
# Create a copy of the wsgi file with apache user permissions.
|
||||||
|
file { '/etc/refstack/app.wsgi':
|
||||||
|
ensure => present,
|
||||||
|
owner => $::apache::params::user,
|
||||||
|
group => $::apache::params::group,
|
||||||
|
mode => '0644',
|
||||||
|
source => "${src_www_root}/refstack/api/app.wsgi",
|
||||||
|
require => [
|
||||||
|
Class['refstack::api']
|
||||||
|
],
|
||||||
|
notify => Service['httpd'],
|
||||||
|
}
|
||||||
|
|
||||||
if $ssl_cert_content != undef {
|
if $ssl_cert_content != undef {
|
||||||
file { $ssl_cert:
|
file { $ssl_cert:
|
||||||
owner => 'root',
|
owner => 'root',
|
||||||
@ -73,6 +87,18 @@ class refstack::apache::https () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Synchronize the app directory and the apache directory.
|
||||||
|
file { $install_www_root:
|
||||||
|
ensure => directory,
|
||||||
|
owner => $::apache::params::user,
|
||||||
|
group => $::apache::params::group,
|
||||||
|
source => "${src_www_root}/refstack-ui/app",
|
||||||
|
recurse => true,
|
||||||
|
purge => true,
|
||||||
|
force => true,
|
||||||
|
notify => Service['httpd'],
|
||||||
|
}
|
||||||
|
|
||||||
# Set up ::refstack as HTTPS
|
# Set up ::refstack as HTTPS
|
||||||
apache::vhost { $hostname:
|
apache::vhost { $hostname:
|
||||||
port => 443,
|
port => 443,
|
||||||
@ -81,5 +107,6 @@ class refstack::apache::https () {
|
|||||||
template => 'refstack/refstack_https.vhost.erb',
|
template => 'refstack/refstack_https.vhost.erb',
|
||||||
ssl => true,
|
ssl => true,
|
||||||
notify => Service['httpd'],
|
notify => Service['httpd'],
|
||||||
|
require => File['/etc/refstack/app.wsgi'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,19 +49,12 @@ class refstack::api () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ensure PyMysqldb is present
|
|
||||||
if !defined(Package['python-mysqldb']) {
|
|
||||||
package { 'python-mysqldb':
|
|
||||||
ensure => present
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create the refstack configuration directory.
|
# Create the refstack configuration directory.
|
||||||
file { '/etc/refstack':
|
file { '/etc/refstack':
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
owner => $user,
|
owner => $user,
|
||||||
group => $group,
|
group => $group,
|
||||||
mode => '0700',
|
mode => '0755',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Configure the refstack API
|
# Configure the refstack API
|
||||||
@ -69,7 +62,7 @@ class refstack::api () {
|
|||||||
ensure => present,
|
ensure => present,
|
||||||
owner => $user,
|
owner => $user,
|
||||||
group => $group,
|
group => $group,
|
||||||
mode => '0400',
|
mode => '0644',
|
||||||
content => template('refstack/refstack.conf.erb'),
|
content => template('refstack/refstack.conf.erb'),
|
||||||
require => [
|
require => [
|
||||||
File['/etc/refstack']
|
File['/etc/refstack']
|
||||||
@ -104,14 +97,13 @@ class refstack::api () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Run pip from the venv, install refstack.
|
# Run pip from the venv, install refstack.
|
||||||
python::pip { 'refstack':
|
exec { 'pip install':
|
||||||
pkgname => 'refstack',
|
command => "${install_api_root}/bin/pip install ${src_api_root}",
|
||||||
ensure => present,
|
user => $user,
|
||||||
virtualenv => $install_api_root,
|
group => $group,
|
||||||
url => "file://${src_api_root}",
|
refreshonly => true,
|
||||||
owner => $user,
|
require => Vcsrepo[$src_api_root],
|
||||||
require => Vcsrepo[$src_api_root],
|
subscribe => Vcsrepo[$src_api_root],
|
||||||
subscribe => Vcsrepo[$src_api_root],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Migrate the database
|
# Migrate the database
|
||||||
@ -120,12 +112,11 @@ class refstack::api () {
|
|||||||
path => "${install_api_root}/bin/:/usr/local/bin:/usr/bin:/bin/",
|
path => "${install_api_root}/bin/:/usr/local/bin:/usr/bin:/bin/",
|
||||||
refreshonly => true,
|
refreshonly => true,
|
||||||
subscribe => [
|
subscribe => [
|
||||||
Python::Pip['refstack'],
|
Exec['pip install'],
|
||||||
File['/etc/refstack/refstack.conf'],
|
File['/etc/refstack/refstack.conf'],
|
||||||
],
|
],
|
||||||
require => [
|
require => [
|
||||||
Package['python-mysqldb'],
|
Exec['pip install'],
|
||||||
Python::Pip['refstack'],
|
|
||||||
File['/etc/refstack/refstack.conf'],
|
File['/etc/refstack/refstack.conf'],
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
88
manifests/app.pp
Normal file
88
manifests/app.pp
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
# Copyright (c) 2015 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.
|
||||||
|
|
||||||
|
# == Class: refstack::app
|
||||||
|
#
|
||||||
|
# This class installs the refstack JavaScript Webclient (or app).
|
||||||
|
#
|
||||||
|
# Much of this module is duplicated in ::refstack::api, however it's separated
|
||||||
|
# here so that any future project splits (api vs. client) can be treated
|
||||||
|
# similarly in the puppet module.
|
||||||
|
#
|
||||||
|
class refstack::app () {
|
||||||
|
require ::refstack::params
|
||||||
|
require ::refstack::user
|
||||||
|
|
||||||
|
# Import parameters into local scope.
|
||||||
|
$src_www_root = $::refstack::params::src_www_root
|
||||||
|
$install_www_root = $::refstack::params::install_www_root
|
||||||
|
$user = $::refstack::params::user
|
||||||
|
$group = $::refstack::params::group
|
||||||
|
|
||||||
|
# Ensure Git is present
|
||||||
|
if !defined(Package['git']) {
|
||||||
|
package { 'git':
|
||||||
|
ensure => present
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ensure NPM is present
|
||||||
|
if !defined(Package['npm']) {
|
||||||
|
package { 'npm':
|
||||||
|
ensure => present
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !defined(Package['nodejs']) {
|
||||||
|
package { 'nodejs':
|
||||||
|
ensure => present
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !defined(Package['nodejs-legacy']) {
|
||||||
|
package { 'nodejs-legacy':
|
||||||
|
ensure => present
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Download the latest Refstack Source
|
||||||
|
vcsrepo { $src_www_root:
|
||||||
|
ensure => latest,
|
||||||
|
owner => $user,
|
||||||
|
group => $group,
|
||||||
|
provider => git,
|
||||||
|
revision => 'master',
|
||||||
|
source => 'https://git.openstack.org/stackforge/refstack/',
|
||||||
|
require => Package['git']
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run NPM Install
|
||||||
|
exec { 'npm install':
|
||||||
|
command => 'npm install',
|
||||||
|
path => "/usr/local/bin:/usr/bin:/bin/",
|
||||||
|
cwd => "${src_www_root}/refstack-ui",
|
||||||
|
user => $user,
|
||||||
|
group => $group,
|
||||||
|
refreshonly => true,
|
||||||
|
subscribe => [
|
||||||
|
Vcsrepo[$src_www_root],
|
||||||
|
],
|
||||||
|
require => [
|
||||||
|
Package['npm'],
|
||||||
|
Vcsrepo[$src_www_root],
|
||||||
|
],
|
||||||
|
environment => [
|
||||||
|
# This is not automatically set by exec.
|
||||||
|
'HOME=/home/refstack'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -34,7 +34,7 @@ class refstack (
|
|||||||
}
|
}
|
||||||
|
|
||||||
include ::refstack::mysql
|
include ::refstack::mysql
|
||||||
|
include ::refstack::app
|
||||||
include ::refstack::api
|
include ::refstack::api
|
||||||
|
|
||||||
include ::refstack::apache::http
|
include ::refstack::apache::http
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ class refstack::params (
|
|||||||
$install_api_root = "/var/lib/refstack-py${python_version}"
|
$install_api_root = "/var/lib/refstack-py${python_version}"
|
||||||
|
|
||||||
# Build the connection string from individual parameters
|
# Build the connection string from individual parameters
|
||||||
$mysql_connection_string = "mysql://${mysql_user}:${mysql_user_password}@${mysql_host}:${mysql_port}/${mysql_database}"
|
$mysql_connection_string = "mysql+pymysql://${mysql_user}:${mysql_user_password}@${mysql_host}:${mysql_port}/${mysql_database}"
|
||||||
|
|
||||||
# CA file needs special treatment, since we want the path variable
|
# CA file needs special treatment, since we want the path variable
|
||||||
# to be undef in some cases.
|
# to be undef in some cases.
|
||||||
|
@ -8,9 +8,9 @@ WSGIPythonHome <%= @install_api_root %>
|
|||||||
|
|
||||||
DocumentRoot <%= @install_www_root %>
|
DocumentRoot <%= @install_www_root %>
|
||||||
|
|
||||||
# WSGIDaemonProcess refstack user=<%= @user %> group=<%= @group %> threads=5
|
WSGIDaemonProcess refstack user=<%= @user %> group=<%= @group %> threads=5
|
||||||
# WSGIScriptAlias /api <%= @install_api_root %>/lib/python<%= @python_version %>/site-packages/refstack/api/app.wsgi
|
WSGIScriptAlias /api /etc/refstack/app.wsgi
|
||||||
# WSGIPassAuthorization On
|
WSGIPassAuthorization On
|
||||||
LogLevel warn
|
LogLevel warn
|
||||||
ErrorLog ${APACHE_LOG_DIR}/refstack-error.log
|
ErrorLog ${APACHE_LOG_DIR}/refstack-error.log
|
||||||
CustomLog ${APACHE_LOG_DIR}/refstack-access.log combined
|
CustomLog ${APACHE_LOG_DIR}/refstack-access.log combined
|
||||||
@ -18,4 +18,7 @@ WSGIPythonHome <%= @install_api_root %>
|
|||||||
<Directory "<%= @install_api_root %>">
|
<Directory "<%= @install_api_root %>">
|
||||||
Require all granted
|
Require all granted
|
||||||
</Directory>
|
</Directory>
|
||||||
|
<Directory "/etc/refstack">
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
@ -49,12 +49,15 @@ WSGIPythonHome <%= @install_api_root %>
|
|||||||
|
|
||||||
DocumentRoot <%= @install_www_root %>
|
DocumentRoot <%= @install_www_root %>
|
||||||
|
|
||||||
# WSGIDaemonProcess storyboard user=<%= @user %> group=<%= @group %> threads=5
|
WSGIDaemonProcess refstack user=<%= @user %> group=<%= @group %> threads=5
|
||||||
# WSGIScriptAlias /api <%= @install_api_root %>/lib/python<%= @python_version %>/site-packages/storyboard/api/app.wsgi
|
WSGIScriptAlias /api /etc/refstack/app.wsgi
|
||||||
# WSGIPassAuthorization On
|
WSGIPassAuthorization On
|
||||||
|
|
||||||
<Directory "<%= @install_api_root %>">
|
<Directory "<%= @install_api_root %>">
|
||||||
Require all granted
|
Require all granted
|
||||||
</Directory>
|
</Directory>
|
||||||
|
<Directory "/etc/refstack">
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user