diff --git a/.rubocop.yml b/.rubocop.yml index 28ea050..31c7e52 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -37,7 +37,7 @@ Style/NumericPredicate: Layout/EmptyLineAfterGuardClause: Enabled: false -Layout/IndentHeredoc: +Layout/HeredocIndentation: Enabled: false Layout/ClosingHeredocIndentation: diff --git a/config/transport_tasks_config.rb b/config/transport_tasks_config.rb index fdeab2a..5efdf65 100644 --- a/config/transport_tasks_config.rb +++ b/config/transport_tasks_config.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true -#################################################### -## DO NOT EDIT THIS FILE ## -## Use /etc/puppetlabs/ace/conf.d/ace-server.conf ## -## to configure the sinatra server ## -#################################################### +########################################################### +## DO NOT EDIT THIS FILE ## +## Use /etc/puppetlabs/ace-server/conf.d/ace-server.conf ## +## to configure the sinatra server ## +########################################################### require 'ace/transport_app' require 'ace/config' @@ -47,3 +47,24 @@ end app impl + +#### Metrics/Status + +control_token = 'none' +control_url_https = bind_addr.sub(config['port'].to_s, config['status-port'].to_s).sub('force_peer', 'none') + +# Start either the default Puma Control/Status app (if it supports our 'auth_actions' feature) +# or start our custom Puma Status app via our custom 'stats' app/plugin (shipped in the Bolt gem). + +if defined? auth_actions + control_actions = 'gc-stats,stats' + activate_control_app control_url_https, auth_token: control_token, auth_actions: control_actions +else + begin + plugin 'stats' + stats_url control_url_https + stats_token control_token + rescue UnknownPlugin + puts '* Status endpoint disabled' + end +end diff --git a/lib/ace/config.rb b/lib/ace/config.rb index d0a7d48..19831b8 100644 --- a/lib/ace/config.rb +++ b/lib/ace/config.rb @@ -25,6 +25,7 @@ def int_keys def defaults super.merge( 'port' => 44633, + 'status-port' => 44632, 'concurrency' => 10, 'cache-dir' => "/opt/puppetlabs/server/data/ace-server/cache", 'puppet-server-conn-timeout' => 120, diff --git a/spec/unit/ace/config_spec.rb b/spec/unit/ace/config_spec.rb index b80b908..33f94d5 100644 --- a/spec/unit/ace/config_spec.rb +++ b/spec/unit/ace/config_spec.rb @@ -52,6 +52,7 @@ def build_config(config_file, from_env = false) 'ECDHE-ECDSA-AES128-SHA256', 'ECDHE-RSA-AES128-SHA256'], 'port' => 44633, + 'status-port' => 44632, 'concurrency' => 10, 'cache-dir' => "/opt/puppetlabs/server/data/ace-server/cache", 'puppet-server-conn-timeout' => 120,