2017-08-15 10:16:22 +08:00
|
|
|
#
|
|
|
|
# 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 to serve Cinder API with apache mod_wsgi in place of watcher service.
|
|
|
|
#
|
|
|
|
# Serving Cinder API from apache is the recommended way to go for production
|
|
|
|
# because of limited performance for concurrent accesses when running eventlet.
|
|
|
|
#
|
|
|
|
# When using this class you should disable your watcher service.
|
|
|
|
#
|
|
|
|
# == Parameters
|
|
|
|
#
|
|
|
|
# [*servername*]
|
|
|
|
# The servername for the virtualhost.
|
2023-03-02 12:46:00 +09:00
|
|
|
# Optional. Defaults to $facts['networking']['fqdn']
|
2017-08-15 10:16:22 +08:00
|
|
|
#
|
|
|
|
# [*port*]
|
|
|
|
# The port.
|
|
|
|
# Optional. Defaults to 9322
|
|
|
|
#
|
|
|
|
# [*bind_host*]
|
|
|
|
# The host/ip address Apache will listen on.
|
|
|
|
# Optional. Defaults to undef (listen on all ip addresses).
|
|
|
|
#
|
|
|
|
# [*path*]
|
|
|
|
# The prefix for the endpoint.
|
|
|
|
# Optional. Defaults to '/'
|
|
|
|
#
|
|
|
|
# [*ssl*]
|
|
|
|
# Use ssl ? (boolean)
|
2022-05-06 21:09:04 +09:00
|
|
|
# Optional. Defaults to false
|
2017-08-15 10:16:22 +08:00
|
|
|
#
|
|
|
|
# [*workers*]
|
|
|
|
# Number of WSGI workers to spawn.
|
2023-03-02 12:46:00 +09:00
|
|
|
# Optional. Defaults to $facts['os_workers']
|
2017-08-15 10:16:22 +08:00
|
|
|
#
|
|
|
|
# [*priority*]
|
|
|
|
# (optional) The priority for the vhost.
|
2022-08-02 23:28:57 +09:00
|
|
|
# Defaults to 10
|
2017-08-15 10:16:22 +08:00
|
|
|
#
|
|
|
|
# [*threads*]
|
|
|
|
# (optional) The number of threads for the vhost.
|
2020-07-05 00:07:33 +09:00
|
|
|
# Defaults to 1
|
2017-08-15 10:16:22 +08:00
|
|
|
#
|
2017-10-12 09:54:44 +08:00
|
|
|
# [*access_log_file*]
|
|
|
|
# The log file name for the virtualhost.
|
2022-08-02 23:28:57 +09:00
|
|
|
# Optional. Defaults to undef.
|
2017-10-12 09:54:44 +08:00
|
|
|
#
|
2022-08-26 17:35:15 +09:00
|
|
|
# [*access_log_pipe*]
|
|
|
|
# Specifies a pipe where Apache sends access logs for the virtualhost.
|
|
|
|
# Optional. Defaults to undef.
|
|
|
|
#
|
|
|
|
# [*access_log_syslog*]
|
|
|
|
# Sends the virtualhost access log messages to syslog.
|
|
|
|
# Optional. Defaults to undef.
|
|
|
|
#
|
2017-10-12 09:54:44 +08:00
|
|
|
# [*access_log_format*]
|
|
|
|
# The log format for the virtualhost.
|
2022-08-02 23:28:57 +09:00
|
|
|
# Optional. Defaults to undef.
|
2017-10-12 09:54:44 +08:00
|
|
|
#
|
|
|
|
# [*error_log_file*]
|
|
|
|
# The error log file name for the virtualhost.
|
|
|
|
# Optional. Defaults to undef.
|
|
|
|
#
|
2022-08-26 17:35:15 +09:00
|
|
|
# [*error_log_pipe*]
|
|
|
|
# Specifies a pipe where Apache sends error logs for the virtualhost.
|
|
|
|
# Optional. Defaults to undef.
|
|
|
|
#
|
|
|
|
# [*error_log_syslog*]
|
|
|
|
# Sends the virtualhost error log messages to syslog.
|
|
|
|
# Optional. Defaults to undef.
|
|
|
|
#
|
2017-08-15 10:16:22 +08:00
|
|
|
# [*wsgi_process_display_name*]
|
|
|
|
# (optional) Name of the WSGI process display-name.
|
|
|
|
# Defaults to undef
|
|
|
|
#
|
|
|
|
# [*ssl_cert*]
|
|
|
|
# [*ssl_key*]
|
|
|
|
# [*ssl_chain*]
|
|
|
|
# [*ssl_ca*]
|
|
|
|
# [*ssl_crl_path*]
|
|
|
|
# [*ssl_crl*]
|
|
|
|
# [*ssl_certs_dir*]
|
|
|
|
# apache::vhost ssl parameters.
|
|
|
|
# Optional. Default to apache::vhost 'ssl_*' defaults.
|
|
|
|
#
|
2022-07-01 16:18:26 +09:00
|
|
|
# [*custom_wsgi_process_options*]
|
|
|
|
# (optional) gives you the oportunity to add custom process options or to
|
|
|
|
# overwrite the default options for the WSGI main process.
|
|
|
|
# eg. to use a virtual python environment for the WSGI process
|
|
|
|
# you could set it to:
|
|
|
|
# { python-path => '/my/python/virtualenv' }
|
|
|
|
# Defaults to {}
|
|
|
|
#
|
|
|
|
# [*headers*]
|
|
|
|
# (optional) Headers for the vhost.
|
|
|
|
# Defaults to undef
|
|
|
|
#
|
|
|
|
# [*request_headers*]
|
|
|
|
# (optional) Modifies collected request headers in various ways.
|
|
|
|
# Defaults to undef
|
2017-10-23 14:13:37 +08:00
|
|
|
#
|
2017-08-15 10:16:22 +08:00
|
|
|
# == Dependencies
|
|
|
|
#
|
|
|
|
# requires Class['apache'] & Class['watcher']
|
|
|
|
#
|
|
|
|
# == Examples
|
|
|
|
#
|
|
|
|
# include apache
|
|
|
|
#
|
|
|
|
# class { 'watcher::wsgi::apache': }
|
|
|
|
#
|
|
|
|
class watcher::wsgi::apache (
|
2023-03-02 12:46:00 +09:00
|
|
|
$servername = $facts['networking']['fqdn'],
|
2017-10-23 14:13:37 +08:00
|
|
|
$port = 9322,
|
|
|
|
$bind_host = undef,
|
|
|
|
$path = '/',
|
2022-05-06 21:09:04 +09:00
|
|
|
$ssl = false,
|
2023-03-02 12:46:00 +09:00
|
|
|
$workers = $facts['os_workers'],
|
2017-10-23 14:13:37 +08:00
|
|
|
$ssl_cert = undef,
|
|
|
|
$ssl_key = undef,
|
|
|
|
$ssl_chain = undef,
|
|
|
|
$ssl_ca = undef,
|
|
|
|
$ssl_crl_path = undef,
|
|
|
|
$ssl_crl = undef,
|
|
|
|
$ssl_certs_dir = undef,
|
|
|
|
$wsgi_process_display_name = undef,
|
2020-07-05 00:07:33 +09:00
|
|
|
$threads = 1,
|
2022-08-02 23:28:57 +09:00
|
|
|
$priority = 10,
|
|
|
|
$access_log_file = undef,
|
2022-08-26 17:35:15 +09:00
|
|
|
$access_log_pipe = undef,
|
|
|
|
$access_log_syslog = undef,
|
2022-08-02 23:28:57 +09:00
|
|
|
$access_log_format = undef,
|
2017-10-23 14:13:37 +08:00
|
|
|
$error_log_file = undef,
|
2022-08-26 17:35:15 +09:00
|
|
|
$error_log_pipe = undef,
|
|
|
|
$error_log_syslog = undef,
|
2017-10-23 14:13:37 +08:00
|
|
|
$custom_wsgi_process_options = {},
|
2022-07-01 16:18:26 +09:00
|
|
|
$headers = undef,
|
|
|
|
$request_headers = undef,
|
2017-08-15 10:16:22 +08:00
|
|
|
) {
|
|
|
|
|
2019-12-08 23:25:42 +01:00
|
|
|
include watcher::deps
|
|
|
|
include watcher::params
|
2017-08-15 10:16:22 +08:00
|
|
|
|
2022-01-11 18:57:18 +09:00
|
|
|
Anchor['watcher::install::end'] -> Class['apache']
|
|
|
|
|
2025-02-18 02:06:12 +09:00
|
|
|
openstacklib::wsgi::apache { 'watcher_wsgi':
|
2017-10-23 14:13:37 +08:00
|
|
|
bind_host => $bind_host,
|
|
|
|
bind_port => $port,
|
2022-02-21 01:49:40 +09:00
|
|
|
group => $::watcher::params::group,
|
2017-10-23 14:13:37 +08:00
|
|
|
path => $path,
|
|
|
|
priority => $priority,
|
|
|
|
servername => $servername,
|
2022-05-06 21:09:04 +09:00
|
|
|
ssl => $ssl,
|
2017-10-23 14:13:37 +08:00
|
|
|
ssl_ca => $ssl_ca,
|
|
|
|
ssl_cert => $ssl_cert,
|
|
|
|
ssl_certs_dir => $ssl_certs_dir,
|
|
|
|
ssl_chain => $ssl_chain,
|
|
|
|
ssl_crl => $ssl_crl,
|
|
|
|
ssl_crl_path => $ssl_crl_path,
|
|
|
|
ssl_key => $ssl_key,
|
|
|
|
threads => $threads,
|
2022-02-21 01:49:40 +09:00
|
|
|
user => $::watcher::params::user,
|
2017-10-23 14:13:37 +08:00
|
|
|
workers => $workers,
|
|
|
|
wsgi_daemon_process => 'watcher',
|
|
|
|
wsgi_process_display_name => $wsgi_process_display_name,
|
|
|
|
wsgi_process_group => 'watcher',
|
|
|
|
wsgi_script_dir => $::watcher::params::watcher_wsgi_script_path,
|
|
|
|
wsgi_script_file => 'app',
|
|
|
|
wsgi_script_source => $::watcher::params::watcher_wsgi_script_source,
|
2022-07-01 16:18:26 +09:00
|
|
|
headers => $headers,
|
|
|
|
request_headers => $request_headers,
|
2022-08-26 17:35:15 +09:00
|
|
|
custom_wsgi_process_options => $custom_wsgi_process_options,
|
2017-10-23 14:13:37 +08:00
|
|
|
access_log_file => $access_log_file,
|
2022-08-26 17:35:15 +09:00
|
|
|
access_log_pipe => $access_log_pipe,
|
|
|
|
access_log_syslog => $access_log_syslog,
|
2017-10-23 14:13:37 +08:00
|
|
|
access_log_format => $access_log_format,
|
|
|
|
error_log_file => $error_log_file,
|
2022-08-26 17:35:15 +09:00
|
|
|
error_log_pipe => $error_log_pipe,
|
|
|
|
error_log_syslog => $error_log_syslog,
|
2017-08-15 10:16:22 +08:00
|
|
|
}
|
|
|
|
}
|