diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 838f9f8e..e67f77cf 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -83,7 +83,7 @@ jobs: matrix: include: # note: actions/setup-python only allows using a major.minor releases - - python: '3.6' + - python: '3.8' make_target: 'python3' name: 'bolt tasks' steps: @@ -122,7 +122,7 @@ jobs: - ruby: '2.7' name: 'centos7-puppet7' - ruby: '2.7' - name: 'centos7-puppet7-python36' + name: 'centos7-puppet7-python38' - ruby: '2.7' name: 'ubuntu18-puppet6' - ruby: '2.7' diff --git a/.kitchen.yml b/.kitchen.yml index c4b84d07..899747d2 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -62,7 +62,7 @@ platforms: puppetfile_path: build/centos7-puppet7/Puppetfile # CentOS7 with Systemd - Puppet 7 - Python 3.6 - - name: centos7-puppet7-python36 + - name: centos7-puppet7-python38 driver: platform: centos dockerfile: build/centos7-puppet7/Dockerfile.kitchen @@ -71,7 +71,7 @@ platforms: - /sys/fs/cgroup:/sys/fs/cgroup:ro provisioner: puppetfile_path: build/centos7-puppet7/Puppetfile - manifest: test/fullinstall_python36.pp + manifest: test/fullinstall_python38.pp # Ubuntu Bionic with Systemd - Puppet 6 - name: ubuntu18-puppet6 diff --git a/CHANGELOG.md b/CHANGELOG.md index af3b167e..3dd7262e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ ## Development +- Added the ability to manage StackStack metrics giving options for the metric driver, + host and port number defined in st2.conf. Contributed by @bishopbm1 + +- Added nginx web route to get basic nginx metrics. Contributed by @asktheaxis + +- Fixed issues with RabbitMQ @bishopbm1 + +- Fixed and updated all tests @bishopbm1 + ## 2.4.0 (Mar 1, 2022) - Update RabbitMQ installer to use latest Erlang from RabbitMQ repos. Contributed by @rush-skills diff --git a/README.md b/README.md index e2234b09..ac0997ff 100644 --- a/README.md +++ b/README.md @@ -125,8 +125,8 @@ Hiera data bindings. A few notable parameters to take note of: being taken (proper steps detailed here: https://docs.stackstorm.com/install/upgrades.html) * `st2::python_version` - Version to Python to use. The default is `'system'` and the system `python` package will be installed, whatever version that is for your OS. - To explicitly install Python 3.6 specify `'3.6'` if on RHEL/CentOS 7. - If on Ubuntu 16.04 specify `'python3.6'`. + To explicitly install Python 3.8 specify `'3.8'` if on RHEL/CentOS 7. + If on Ubuntu 16.04 specify `'python3.8'`. **Notes** * RHEL 7 - The Red Hat subscription repo `'rhel-7-server-optional-rpms'` will need to be enabled prior to running this module. @@ -134,12 +134,12 @@ Hiera data bindings. A few notable parameters to take note of: ```puppet # CentOS/RHEL 7 class { 'st2': - python_version => '3.6', + python_version => '3.8', } # Ubuntu 18.04/20.04 class { 'st2': - python_version => 'python3.6', + python_version => 'python3.8', } contain st2::profile::fullinstall @@ -161,6 +161,7 @@ classes for use and configuration. * `st2::proflle::server` - st2 server components * `st2::profile::web` - st2 web components * `st2::profile::chatops` - st2 chatops components +* `st2::profile::metrics` - st2 set up metrics #### Installing and Configuring Packs @@ -331,7 +332,7 @@ that can be higher on CPU and Memory to allow more processes to run at the same Configuration all services: ```ruby class { 'st2': - python_version => '3.6', + python_version => '3.8', workflowengine_num => 4, scheduler_num => 2, rulesengine_num => 1, @@ -466,6 +467,24 @@ $res = run_task('st2::key_get', $stackstorm_target, password => $password) ``` +#### Metrics + +This module provides the ability to set up the metrics endpoints to expose different metrics built into StackStorm as documented here: +https://docs.stackstorm.com/reference/metrics.html + +There is also an addition metric that can be auto created which exposes the basic health for NGINX called a basic status page. + +```ruby +class { 'st2': + python_version => '3.8', + metrics_include => true, + nginx_basicstatus_enabled => true, +} +``` + +Once these metrics are setup and enabled it gives the ability to scrape those metrics with an outside source like telegraf +or prometheus or any other scraping tool. + ## Limitations ### Supported platforms diff --git a/build/centos7-puppet6/Puppetfile b/build/centos7-puppet6/Puppetfile index ed3d8378..83a201d4 100644 --- a/build/centos7-puppet6/Puppetfile +++ b/build/centos7-puppet6/Puppetfile @@ -44,7 +44,9 @@ # └── saz-sudo (v6.0.0) forge "https://forgeapi.puppetlabs.com" -mod 'ghoneycutt-facter' +# Current bug: https://github.com/ghoneycutt/puppet-module-facter/issues/70 +# in latest release. Pinning to 3.5 until resolved. +mod 'ghoneycutt/facter', '3.5.0' mod 'jamtur01-httpauth' mod 'npwalker-recursive_file_permissions' mod 'puppet-epel' @@ -55,7 +57,10 @@ mod 'puppet-nginx' mod 'puppetlabs-concat' # dependency of puppet-nginx' mod 'puppet-nodejs' mod 'puppet-python' -mod 'puppet-rabbitmq' +# Using master branch due to new release on hold pending new tests. +mod 'puppet/rabbitmq', + :git => 'https://github.com/voxpupuli/puppet-rabbitmq.git', + :branch => 'master' mod 'camptocamp-systemd' # dependency of puppet-rabbitmq mod 'puppet-archive' # dependency of puppet-rabbitmq mod 'puppet-selinux' diff --git a/build/centos7-puppet7/Puppetfile b/build/centos7-puppet7/Puppetfile index ed3d8378..83a201d4 100644 --- a/build/centos7-puppet7/Puppetfile +++ b/build/centos7-puppet7/Puppetfile @@ -44,7 +44,9 @@ # └── saz-sudo (v6.0.0) forge "https://forgeapi.puppetlabs.com" -mod 'ghoneycutt-facter' +# Current bug: https://github.com/ghoneycutt/puppet-module-facter/issues/70 +# in latest release. Pinning to 3.5 until resolved. +mod 'ghoneycutt/facter', '3.5.0' mod 'jamtur01-httpauth' mod 'npwalker-recursive_file_permissions' mod 'puppet-epel' @@ -55,7 +57,10 @@ mod 'puppet-nginx' mod 'puppetlabs-concat' # dependency of puppet-nginx' mod 'puppet-nodejs' mod 'puppet-python' -mod 'puppet-rabbitmq' +# Using master branch due to new release on hold pending new tests. +mod 'puppet/rabbitmq', + :git => 'https://github.com/voxpupuli/puppet-rabbitmq.git', + :branch => 'master' mod 'camptocamp-systemd' # dependency of puppet-rabbitmq mod 'puppet-archive' # dependency of puppet-rabbitmq mod 'puppet-selinux' diff --git a/build/ubuntu18-puppet6/Puppetfile b/build/ubuntu18-puppet6/Puppetfile index ed3d8378..83a201d4 100644 --- a/build/ubuntu18-puppet6/Puppetfile +++ b/build/ubuntu18-puppet6/Puppetfile @@ -44,7 +44,9 @@ # └── saz-sudo (v6.0.0) forge "https://forgeapi.puppetlabs.com" -mod 'ghoneycutt-facter' +# Current bug: https://github.com/ghoneycutt/puppet-module-facter/issues/70 +# in latest release. Pinning to 3.5 until resolved. +mod 'ghoneycutt/facter', '3.5.0' mod 'jamtur01-httpauth' mod 'npwalker-recursive_file_permissions' mod 'puppet-epel' @@ -55,7 +57,10 @@ mod 'puppet-nginx' mod 'puppetlabs-concat' # dependency of puppet-nginx' mod 'puppet-nodejs' mod 'puppet-python' -mod 'puppet-rabbitmq' +# Using master branch due to new release on hold pending new tests. +mod 'puppet/rabbitmq', + :git => 'https://github.com/voxpupuli/puppet-rabbitmq.git', + :branch => 'master' mod 'camptocamp-systemd' # dependency of puppet-rabbitmq mod 'puppet-archive' # dependency of puppet-rabbitmq mod 'puppet-selinux' diff --git a/build/ubuntu18-puppet7/Puppetfile b/build/ubuntu18-puppet7/Puppetfile index ed3d8378..83a201d4 100644 --- a/build/ubuntu18-puppet7/Puppetfile +++ b/build/ubuntu18-puppet7/Puppetfile @@ -44,7 +44,9 @@ # └── saz-sudo (v6.0.0) forge "https://forgeapi.puppetlabs.com" -mod 'ghoneycutt-facter' +# Current bug: https://github.com/ghoneycutt/puppet-module-facter/issues/70 +# in latest release. Pinning to 3.5 until resolved. +mod 'ghoneycutt/facter', '3.5.0' mod 'jamtur01-httpauth' mod 'npwalker-recursive_file_permissions' mod 'puppet-epel' @@ -55,7 +57,10 @@ mod 'puppet-nginx' mod 'puppetlabs-concat' # dependency of puppet-nginx' mod 'puppet-nodejs' mod 'puppet-python' -mod 'puppet-rabbitmq' +# Using master branch due to new release on hold pending new tests. +mod 'puppet/rabbitmq', + :git => 'https://github.com/voxpupuli/puppet-rabbitmq.git', + :branch => 'master' mod 'camptocamp-systemd' # dependency of puppet-rabbitmq mod 'puppet-archive' # dependency of puppet-rabbitmq mod 'puppet-selinux' diff --git a/build/ubuntu20-puppet6/Puppetfile b/build/ubuntu20-puppet6/Puppetfile index ed3d8378..83a201d4 100644 --- a/build/ubuntu20-puppet6/Puppetfile +++ b/build/ubuntu20-puppet6/Puppetfile @@ -44,7 +44,9 @@ # └── saz-sudo (v6.0.0) forge "https://forgeapi.puppetlabs.com" -mod 'ghoneycutt-facter' +# Current bug: https://github.com/ghoneycutt/puppet-module-facter/issues/70 +# in latest release. Pinning to 3.5 until resolved. +mod 'ghoneycutt/facter', '3.5.0' mod 'jamtur01-httpauth' mod 'npwalker-recursive_file_permissions' mod 'puppet-epel' @@ -55,7 +57,10 @@ mod 'puppet-nginx' mod 'puppetlabs-concat' # dependency of puppet-nginx' mod 'puppet-nodejs' mod 'puppet-python' -mod 'puppet-rabbitmq' +# Using master branch due to new release on hold pending new tests. +mod 'puppet/rabbitmq', + :git => 'https://github.com/voxpupuli/puppet-rabbitmq.git', + :branch => 'master' mod 'camptocamp-systemd' # dependency of puppet-rabbitmq mod 'puppet-archive' # dependency of puppet-rabbitmq mod 'puppet-selinux' diff --git a/build/ubuntu20-puppet7/Puppetfile b/build/ubuntu20-puppet7/Puppetfile index ed3d8378..83a201d4 100644 --- a/build/ubuntu20-puppet7/Puppetfile +++ b/build/ubuntu20-puppet7/Puppetfile @@ -44,7 +44,9 @@ # └── saz-sudo (v6.0.0) forge "https://forgeapi.puppetlabs.com" -mod 'ghoneycutt-facter' +# Current bug: https://github.com/ghoneycutt/puppet-module-facter/issues/70 +# in latest release. Pinning to 3.5 until resolved. +mod 'ghoneycutt/facter', '3.5.0' mod 'jamtur01-httpauth' mod 'npwalker-recursive_file_permissions' mod 'puppet-epel' @@ -55,7 +57,10 @@ mod 'puppet-nginx' mod 'puppetlabs-concat' # dependency of puppet-nginx' mod 'puppet-nodejs' mod 'puppet-python' -mod 'puppet-rabbitmq' +# Using master branch due to new release on hold pending new tests. +mod 'puppet/rabbitmq', + :git => 'https://github.com/voxpupuli/puppet-rabbitmq.git', + :branch => 'master' mod 'camptocamp-systemd' # dependency of puppet-rabbitmq mod 'puppet-archive' # dependency of puppet-rabbitmq mod 'puppet-selinux' diff --git a/manifests/init.pp b/manifests/init.pp index f1456759..cbb70fc7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -259,82 +259,88 @@ # python_version => $st2_python_version, # } class st2( - $version = 'present', - String $python_version = 'system', + $version = 'present', + String $python_version = 'system', St2::Repository $repository = $st2::params::repository, - $conf_dir = $st2::params::conf_dir, - $conf_file = "${st2::params::conf_dir}/st2.conf", - $use_ssl = $st2::params::use_ssl, - $ssl_cert_manage = true, - $ssl_dir = $st2::params::ssl_dir, - $ssl_cert = $st2::params::ssl_cert, - $ssl_key = $st2::params::ssl_key, - $auth = true, - $auth_api_url = "http://${st2::params::hostname}:${st2::params::api_port}", - $auth_debug = false, - $auth_mode = $st2::params::auth_mode, - $auth_backend = $st2::params::auth_backend, - $auth_backend_config = $st2::params::auth_backend_config, - $cli_base_url = "http://${st2::params::hostname}", - $cli_api_version = 'v1', - $cli_debug = false, - $cli_cache_token = true, - $cli_silence_ssl_warnings = false, - $cli_username = $st2::params::admin_username, - $cli_password = $st2::params::admin_password, - $cli_apikey = undef, - $cli_api_url = "http://${st2::params::hostname}:${st2::params::api_port}", - $cli_auth_url = "http://${st2::params::hostname}:${st2::params::auth_port}", - $actionrunner_workers = $st2::params::actionrunner_workers, - $packs = {}, - $packs_group = $st2::params::packs_group_name, - $index_url = undef, - $syslog = false, - $syslog_host = 'localhost', - $syslog_protocol = 'udp', - $syslog_port = 514, - $syslog_facility = 'local7', - $ssh_key_location = '/home/stanley/.ssh/st2_stanley_key', - $db_host = $st2::params::hostname, - $db_port = $st2::params::mongodb_port, - $db_bind_ips = $st2::params::mongodb_bind_ips, - $db_name = $st2::params::mongodb_st2_db, - $db_username = $st2::params::mongodb_st2_username, - $db_password = $st2::params::admin_password, - $mongodb_version = undef, - $mongodb_manage_repo = true, - $mongodb_auth = true, - $ng_init = true, - $datastore_keys_dir = $st2::params::datstore_keys_dir, - $datastore_key_path = "${st2::params::datstore_keys_dir}/datastore_key.json", - $nginx_manage_repo = true, + $conf_dir = $st2::params::conf_dir, + $conf_file = "${st2::params::conf_dir}/st2.conf", + $use_ssl = $st2::params::use_ssl, + $ssl_cert_manage = true, + $ssl_dir = $st2::params::ssl_dir, + $ssl_cert = $st2::params::ssl_cert, + $ssl_key = $st2::params::ssl_key, + $auth = true, + $auth_api_url = "http://${st2::params::hostname}:${st2::params::api_port}", + $auth_debug = false, + $auth_mode = $st2::params::auth_mode, + $auth_backend = $st2::params::auth_backend, + $auth_backend_config = $st2::params::auth_backend_config, + $cli_base_url = "http://${st2::params::hostname}", + $cli_api_version = 'v1', + $cli_debug = false, + $cli_cache_token = true, + $cli_silence_ssl_warnings = false, + $cli_username = $st2::params::admin_username, + $cli_password = $st2::params::admin_password, + $cli_apikey = undef, + $cli_api_url = "http://${st2::params::hostname}:${st2::params::api_port}", + $cli_auth_url = "http://${st2::params::hostname}:${st2::params::auth_port}", + $actionrunner_workers = $st2::params::actionrunner_workers, + $packs = {}, + $packs_group = $st2::params::packs_group_name, + $index_url = undef, + $syslog = false, + $syslog_host = 'localhost', + $syslog_protocol = 'udp', + $syslog_port = 514, + $syslog_facility = 'local7', + $ssh_key_location = '/home/stanley/.ssh/st2_stanley_key', + $db_host = $st2::params::hostname, + $db_port = $st2::params::mongodb_port, + $db_bind_ips = $st2::params::mongodb_bind_ips, + $db_name = $st2::params::mongodb_st2_db, + $db_username = $st2::params::mongodb_st2_username, + $db_password = $st2::params::admin_password, + $mongodb_version = undef, + $mongodb_manage_repo = true, + $mongodb_auth = true, + $ng_init = true, + $datastore_keys_dir = $st2::params::datstore_keys_dir, + $datastore_key_path = "${st2::params::datstore_keys_dir}/datastore_key.json", + $nginx_basicstatus_enabled = $st2::params::basicstatus_enabled, + $nginx_basicstatus_port = $st2::params::basicstatus_port, + $nginx_manage_repo = true, $nginx_client_max_body_size = $st2::params::nginx_client_max_body_size, - $nginx_ssl_ciphers = $st2::params::nginx_ssl_ciphers, - $nginx_ssl_port = $st2::params::nginx_ssl_port, - $nginx_ssl_protocols = $st2::params::nginx_ssl_protocols, - $web_root = $st2::params::web_root, - $rabbitmq_username = $st2::params::rabbitmq_username, - $rabbitmq_password = $st2::params::rabbitmq_password, - $rabbitmq_hostname = $st2::params::rabbitmq_hostname, - $rabbitmq_port = $st2::params::rabbitmq_port, - $rabbitmq_bind_ip = $st2::params::rabbitmq_bind_ip, - $rabbitmq_vhost = $st2::params::rabbitmq_vhost, - $erlang_url = $st2::params::erlang_url, - $erlang_key = $st2::params::erlang_key, - $erlang_key_id = $st2::params::erlang_key_id, - $erlang_key_source = $st2::params::erlang_key_source, - $erlang_packages = $st2::params::erlang_packages, - $redis_bind_ip = $st2::params::redis_bind_ip, - $redis_hostname = $st2::params::redis_hostname, - $redis_port = $st2::params::redis_port, - $redis_password = $st2::params::redis_password, - $timersengine_enabled = $st2::params::timersengine_enabled, - $timersengine_timezone = $st2::params::timersengine_timezone, - $scheduler_sleep_interval = $st2::params::scheduler_sleep_interval, - $scheduler_gc_interval = $st2::params::scheduler_gc_interval, - $scheduler_pool_size = $st2::params::scheduler_pool_size, - $chatops_adapter = $st2::params::chatops_adapter, - $chatops_adapter_conf = $st2::params::chatops_adapter_conf, + $nginx_ssl_ciphers = $st2::params::nginx_ssl_ciphers, + $nginx_ssl_port = $st2::params::nginx_ssl_port, + $nginx_ssl_protocols = $st2::params::nginx_ssl_protocols, + $web_root = $st2::params::web_root, + $rabbitmq_username = $st2::params::rabbitmq_username, + $rabbitmq_password = $st2::params::rabbitmq_password, + $rabbitmq_hostname = $st2::params::rabbitmq_hostname, + $rabbitmq_port = $st2::params::rabbitmq_port, + $rabbitmq_bind_ip = $st2::params::rabbitmq_bind_ip, + $rabbitmq_vhost = $st2::params::rabbitmq_vhost, + $erlang_url = $st2::params::erlang_url, + $erlang_key = $st2::params::erlang_key, + $erlang_key_id = $st2::params::erlang_key_id, + $erlang_key_source = $st2::params::erlang_key_source, + $erlang_packages = $st2::params::erlang_packages, + $erlang_rhel_sslcacert_location = $st2::params::erlang_rhel_sslcacert_location, + $erlang_rhel_sslverify = $st2::params::erlang_rhel_sslverify, + $erlang_rhel_gpgcheck = $st2::params::erlang_rhel_gpgcheck, + $erlang_rhel_repo_gpgcheck = $st2::params::erlang_rhel_repo_gpgcheck, + $redis_bind_ip = $st2::params::redis_bind_ip, + $redis_hostname = $st2::params::redis_hostname, + $redis_port = $st2::params::redis_port, + $redis_password = $st2::params::redis_password, + $timersengine_enabled = $st2::params::timersengine_enabled, + $timersengine_timezone = $st2::params::timersengine_timezone, + $scheduler_sleep_interval = $st2::params::scheduler_sleep_interval, + $scheduler_gc_interval = $st2::params::scheduler_gc_interval, + $scheduler_pool_size = $st2::params::scheduler_pool_size, + $chatops_adapter = $st2::params::chatops_adapter, + $chatops_adapter_conf = $st2::params::chatops_adapter_conf, $chatops_hubot_log_level = $st2::params::hubot_log_level, $chatops_hubot_express_port = $st2::params::hubot_express_port, $chatops_tls_cert_reject_unauthorized = $st2::params::tls_cert_reject_unauthorized, @@ -345,13 +351,17 @@ $chatops_api_url = "https://${st2::params::hostname}/api", $chatops_auth_url = "https://${st2::params::hostname}/auth", $chatops_web_url = undef, - $nodejs_version = undef, - $nodejs_manage_repo = true, - $workflowengine_num = $st2::params::workflowengine_num, - $scheduler_num = $st2::params::scheduler_num, - $rulesengine_num = $st2::params::rulesengine_num, - $notifier_num = $st2::params::notifier_num, - $validate_output_schema = $st2::params::validate_output_schema, + $nodejs_version = undef, + $nodejs_manage_repo = true, + $workflowengine_num = $st2::params::workflowengine_num, + $scheduler_num = $st2::params::scheduler_num, + $rulesengine_num = $st2::params::rulesengine_num, + $notifier_num = $st2::params::notifier_num, + $metrics_include = $st2::params::metrics_include, + $metric_driver = $st2::params::metric_driver, + $metric_host = $st2::params::metric_host, + $metric_port = $st2::params::metric_port, + $validate_output_schema = $st2::params::validate_output_schema, ) inherits st2::params { ######################################## diff --git a/manifests/params.pp b/manifests/params.pp index 15308b0a..14288173 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -46,6 +46,10 @@ # stream settings $stream_port = 9102 + # nginx basic status port + $basicstatus_port = 9103 + $basicstatus_enabled = false + # Non-user configurable parameters $repository = 'stable' $conf_dir = '/etc/st2' @@ -192,9 +196,13 @@ 'Debian' => "http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/${osname}", 'RedHat' => "https://packagecloud.io/rabbitmq/erlang/el/${facts['os'][release][major]}/\$basearch", } - $erlang_key = 'https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey' + $erlang_key = 'https://packagecloud.io/rabbitmq/erlang/gpgkey' $erlang_key_id = 'B279943D2A549531E144B875F77F1EDA57EBB1CC' $erlang_key_source = 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xf77f1eda57ebb1cc' + $erlang_rhel_sslcacert_location = '/etc/pki/tls/certs/ca-bundle.crt' + $erlang_rhel_sslverify = 1 + $erlang_rhel_gpgcheck = 0 + $erlang_rhel_repo_gpgcheck = 1 $erlang_packages = [ 'erlang', ] @@ -229,4 +237,9 @@ $chatops_adapter_conf = { 'HUBOT_ADAPTER' => 'slack', } + + $metrics_include = false + $metric_driver = 'statsd' + $metric_host = '127.0.0.1' + $metric_port = '8125' } diff --git a/manifests/profile/metrics.pp b/manifests/profile/metrics.pp new file mode 100644 index 00000000..8b420243 --- /dev/null +++ b/manifests/profile/metrics.pp @@ -0,0 +1,55 @@ +# @summary StackStorm compatable installation of MongoDB and dependencies. +# +# @param metrics_include +# Should metrics be enabled +# @param metric_driver +# The driver to use for the metrics. Default='statsd' +# @param metric_host +# The host to pull metrics from. Default='127.0.0.1' +# @param metric_port +# The port for the metrics. Default='8125' +# +# @example Basic Usage +# include st2::profile::metrics +# +# @example Customize (done via st2) +# class { 'st2': +# metrics_include => true, +# metric_driver => 'statsd', +# metric_host => '127.0.0.1', +# metric_port => '8125', +# } +# include st2::profile::metrics +# +class st2::profile::metrics ( + $metrics_include = $st2::metrics_include, + $metric_driver = $st2::metric_driver, + $metric_host = $st2::metric_host, + $metric_port = $st2::metric_port, +) inherits st2 { + if $metrics_include { + ini_setting { 'metrics_driver': + path => '/etc/st2/st2.conf', + section => 'metrics', + setting => 'driver', + value => $metric_driver, + tag => 'st2::config', + } + + ini_setting { 'metrics_host': + path => '/etc/st2/st2.conf', + section => 'metrics', + setting => 'host', + value => $metric_host, + tag => 'st2::config', + } + + ini_setting { 'metrics_port': + path => '/etc/st2/st2.conf', + section => 'metrics', + setting => 'port', + value => $metric_port, + tag => 'st2::config', + } + } +} diff --git a/manifests/profile/rabbitmq.pp b/manifests/profile/rabbitmq.pp index f5a78199..e5c6eeab 100644 --- a/manifests/profile/rabbitmq.pp +++ b/manifests/profile/rabbitmq.pp @@ -22,16 +22,20 @@ # include st2::profile::rabbitmq # class st2::profile::rabbitmq ( - $username = $st2::rabbitmq_username, - $password = $st2::rabbitmq_password, - $port = $st2::rabbitmq_port, - $bind_ip = $st2::rabbitmq_bind_ip, - $vhost = $st2::rabbitmq_vhost, - $erlang_url = $st2::erlang_url, - $erlang_key = $st2::erlang_key, - $erlang_key_id = $st2::erlang_key_id, - $erlang_key_source = $st2::erlang_key_source, - $erlang_packages = $st2::erlang_packages, + $username = $st2::rabbitmq_username, + $password = $st2::rabbitmq_password, + $port = $st2::rabbitmq_port, + $bind_ip = $st2::rabbitmq_bind_ip, + $vhost = $st2::rabbitmq_vhost, + $erlang_url = $st2::erlang_url, + $erlang_key = $st2::erlang_key, + $erlang_key_id = $st2::erlang_key_id, + $erlang_key_source = $st2::erlang_key_source, + $erlang_packages = $st2::erlang_packages, + $erlang_rhel_sslcacert_location = $st2::erlang_rhel_sslcacert_location, + $erlang_rhel_sslverify = $st2::erlang_rhel_sslverify, + $erlang_rhel_gpgcheck = $st2::erlang_rhel_gpgcheck, + $erlang_rhel_repo_gpgcheck = $st2::erlang_rhel_repo_gpgcheck, ) inherits st2 { # RHEL 8 Requires another repo in addition to epel to be installed @@ -41,13 +45,16 @@ # This is required because when using the latest version of rabbitmq because the latest version in EPEL # for Erlang is 22.0.7 which is not compatible: https://www.rabbitmq.com/which-erlang.html yumrepo { 'erlang': - ensure => present, - name => 'rabbitmq_erlang', - baseurl => $erlang_url, - gpgkey => $erlang_key, - enabled => 1, - gpgcheck => 1, - before => Class['rabbitmq::repo::rhel'], + ensure => present, + name => 'rabbitmq_erlang', + baseurl => $erlang_url, + gpgkey => $erlang_key, + enabled => 1, + gpgcheck => $erlang_rhel_gpgcheck, + repo_gpgcheck => $erlang_rhel_repo_gpgcheck, + before => Class['rabbitmq::repo::rhel'], + sslverify => $erlang_rhel_sslverify, + sslcacert => $erlang_rhel_sslcacert_location, } } elsif ($facts['os']['family'] == 'Debian') { diff --git a/manifests/profile/server.pp b/manifests/profile/server.pp index 51528495..35b12c18 100644 --- a/manifests/profile/server.pp +++ b/manifests/profile/server.pp @@ -288,6 +288,7 @@ tag => 'st2::config', } + ## Resultstracker Settings ini_setting { 'resultstracker_logging': ensure => present, @@ -328,6 +329,8 @@ tag => 'st2::config', } + class { 'st2::profile::metrics': } + ## Syslog Settings ini_setting { 'syslog_host': ensure => present, diff --git a/manifests/profile/web.pp b/manifests/profile/web.pp index aedb11d5..1e1bc724 100644 --- a/manifests/profile/web.pp +++ b/manifests/profile/web.pp @@ -71,6 +71,8 @@ String $ssl_key = $st2::ssl_key, String $version = $st2::version, String $web_root = $st2::web_root, + Integer $basicstatus_port = $st2::nginx_basicstatus_port, + Boolean $basicstatus_enabled = $st2::nginx_basicstatus_enabled, ) inherits st2 { # include nginx here only # if we include this in st2::profile::fullinstall Anchor['pre_reqs'] then @@ -237,6 +239,34 @@ }, } + if $basicstatus_enabled { + nginx::resource::location { '@basic_statusError': + * => $location_defaults + { + add_header => { + 'Content-Type' => 'application/json always', + }, + location_cfg_append => { + 'return' => '503 \'{ "faultstring": "Nginx is unable to reach basic_status. Make sure service is running." }\'', + }, + tag => ['st2', 'st2::backend', 'st2::backend::basicstatuserror'], + }, + } + + nginx::resource::location { '/basic_status/': + * => $proxy_defaults + { + rewrite_rules => [ + '^/api/(.*) /$1 break', + ], + proxy => "http://127.0.0.1:${basicstatus_port}", + location_cfg_append => { + 'error_page' => '502 = @basic_statusError', + 'stub_status' => 'on', + }, + tag => ['st2', 'st2::backend', 'st2::backend::basic_status'], + }, + } + } + nginx::resource::location { '@streamError': * => $location_defaults + { add_header => { diff --git a/manifests/test/fullinstall_python36.pp b/manifests/test/fullinstall_python38.pp similarity index 81% rename from manifests/test/fullinstall_python36.pp rename to manifests/test/fullinstall_python38.pp index e8fba26a..d98fa13d 100644 --- a/manifests/test/fullinstall_python36.pp +++ b/manifests/test/fullinstall_python38.pp @@ -1,7 +1,7 @@ # Test for installing standalone StackStorm using Python 3.6 $st2_python_version = $facts['os']['family'] ? { - 'RedHat' => '3.6', - 'Debian' => 'python3.6', + 'RedHat' => '3.8', + 'Debian' => 'python3.8', } class { 'st2': python_version => $st2_python_version, diff --git a/metadata.json b/metadata.json index 53891274..c5ce336a 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "stackstorm-st2", - "version": "2.4.0", + "version": "2.5.0", "author": "stackstorm", "summary": "Puppet module to manage/configure StackStorm", "license": "Apache-2.0", diff --git a/spec/classes/profile/web_spec.rb b/spec/classes/profile/web_spec.rb index 56b5887a..ae290998 100644 --- a/spec/classes/profile/web_spec.rb +++ b/spec/classes/profile/web_spec.rb @@ -377,6 +377,40 @@ it { is_expected.to compile.with_all_deps } it { is_expected.not_to contain_exec('generate ssl cert /etc/ssl/st2/st2.crt') } end # context 'with ssl_cert_manage=false' + + context 'with basicstatus_enabled=true' do + let(:params) { { basicstatus_enabled: true } } + + it { is_expected.to compile.with_all_deps } + it do + is_expected.to contain_nginx__resource__location('@basic_statusError') + .with(ensure: 'present', + server: 'ssl-st2webui', + ssl: true, + ssl_only: true, + index_files: [], + add_header: { + 'Content-Type' => 'application/json always', + }, + location_cfg_append: { + 'return' => '503 \'{ "faultstring": "Nginx is unable to reach basic_status. Make sure service is running." }\'', + }, + tag: ['st2', 'st2::backend', 'st2::backend::basicstatuserror']) + end + it do + is_expected.to contain_nginx__resource__location('/basic_status/') + .with(ensure: 'present', + server: 'ssl-st2webui', + ssl: true, + ssl_only: true, + index_files: [], + location_cfg_append: { + 'error_page' => '502 = @basic_statusError', + 'stub_status' => 'on', + }, + tag: ['st2', 'st2::backend', 'st2::backend::basic_status']) + end + end # context 'basicstatus_enabled=true' end # context 'on #{os}' end # on_supported_os(all_os) end # describe 'st2::profile::server' diff --git a/test/unit/st2_test_case.py b/test/unit/st2_test_case.py index 5a92fd44..bdc9209d 100644 --- a/test/unit/st2_test_case.py +++ b/test/unit/st2_test_case.py @@ -1,8 +1,10 @@ import yaml import json import logging +import os +import inspect -from unittest import TestCase +from unittest2 import TestCase class St2TestCase(TestCase): @@ -16,6 +18,27 @@ def tearDown(self): super(St2TestCase, self).tearDown() logging.disable(logging.NOTSET) # enable logging + def get_fixture_content(self, fixture_path): + """ + Return raw fixture content for the provided fixture path. + :param fixture_path: Fixture path relative to the tests/fixtures/ directory. + :type fixture_path: ``str`` + """ + base_pack_path = self._get_base_pack_path() + fixtures_path = os.path.join(base_pack_path, "tests/fixtures/") + fixture_path = os.path.join(fixtures_path, fixture_path) + + with open(fixture_path, "r") as fp: + content = fp.read() + + return content + + def _get_base_pack_path(self): + test_file_path = inspect.getfile(self.__class__) + base_pack_path = os.path.join(os.path.dirname(test_file_path), "..") + base_pack_path = os.path.abspath(base_pack_path) + return base_pack_path + def load_yaml(self, filename): return yaml.safe_load(self.get_fixture_content(filename))