diff --git a/.rubocop_local.yml b/.rubocop_local.yml index 5abe0506a56..a179336eac0 100644 --- a/.rubocop_local.yml +++ b/.rubocop_local.yml @@ -23,7 +23,7 @@ GlobalVars: - $scvmm_log - $vcloud_log - $vim_log - - $websocket_log + - $remote_console_log - $nuage_log - $redfish_log Rails/Exit: diff --git a/Procfile.example b/Procfile.example index 56f188f06a2..2c896e40c37 100644 --- a/Procfile.example +++ b/Procfile.example @@ -15,9 +15,9 @@ # So, the first ui worker will get PORT=3000 while the next will get PORT=3001 # The first api worker will get PORT=3100 and the next will get PORT=3101 -# ui: env PORT=$PORT ruby lib/workers/bin/run_single_worker.rb MiqUiWorker -# api: env PORT=$PORT ruby lib/workers/bin/run_single_worker.rb MiqWebServiceWorker -# websocket: env PORT=$PORT ruby lib/workers/bin/run_single_worker.rb MiqWebsocketWorker +# ui: env PORT=$PORT ruby lib/workers/bin/run_single_worker.rb MiqUiWorker +# api: env PORT=$PORT ruby lib/workers/bin/run_single_worker.rb MiqWebServiceWorker +# remote_console: env PORT=$PORT ruby lib/workers/bin/run_single_worker.rb MiqRemoteConsoleWorker # schedule: ruby lib/workers/bin/run_single_worker.rb MiqScheduleWorker diff --git a/app/models/miq_websocket_worker.rb b/app/models/miq_remote_console_worker.rb similarity index 64% rename from app/models/miq_websocket_worker.rb rename to app/models/miq_remote_console_worker.rb index 78c8711483d..59b0f264646 100644 --- a/app/models/miq_websocket_worker.rb +++ b/app/models/miq_remote_console_worker.rb @@ -1,13 +1,13 @@ -class MiqWebsocketWorker < MiqWorker +class MiqRemoteConsoleWorker < MiqWorker require_nested :Runner - self.required_roles = ['websocket'] + self.required_roles = ['remote_console'] RACK_APPLICATION = WebsocketServer STARTING_PORT = 5000 def friendly_name - @friendly_name ||= "Websocket Worker" + @friendly_name ||= "Remote Console Worker" end include MiqWebServerWorkerMixin diff --git a/app/models/miq_websocket_worker/runner.rb b/app/models/miq_remote_console_worker/runner.rb similarity index 60% rename from app/models/miq_websocket_worker/runner.rb rename to app/models/miq_remote_console_worker/runner.rb index 15e2288beab..deac0ac7f23 100644 --- a/app/models/miq_websocket_worker/runner.rb +++ b/app/models/miq_remote_console_worker/runner.rb @@ -1,4 +1,4 @@ -class MiqWebsocketWorker::Runner < MiqWorker::Runner +class MiqRemoteConsoleWorker::Runner < MiqWorker::Runner include MiqWebServerRunnerMixin def heartbeat(*args) @@ -9,7 +9,7 @@ def heartbeat(*args) def check_internal_thread unless worker.rails_application.healthy? - do_exit("MiqWebsocketWorker internal thread crashed, exiting!", 1) + do_exit("MiqRemoteConsoleWorker internal thread crashed, exiting!", 1) end end end diff --git a/app/models/miq_server/role_management.rb b/app/models/miq_server/role_management.rb index 66f98f94f67..f2557fb7303 100644 --- a/app/models/miq_server/role_management.rb +++ b/app/models/miq_server/role_management.rb @@ -1,7 +1,7 @@ module MiqServer::RoleManagement extend ActiveSupport::Concern - ROLES_NEEDING_APACHE = %w(user_interface web_services websocket embedded_ansible cockpit_ws).freeze + ROLES_NEEDING_APACHE = %w(user_interface web_services remote_console embedded_ansible cockpit_ws).freeze included do has_many :assigned_server_roles, :dependent => :destroy @@ -49,10 +49,10 @@ def apache_needed? end def set_active_role_flags - self.has_active_userinterface = self.has_active_role?("user_interface") - self.has_active_websocket = self.has_active_role?("websocket") - self.has_active_webservices = self.has_active_role?("web_services") - self.has_active_cockpit_ws = self.has_active_role?("cockpit_ws") + self.has_active_userinterface = self.has_active_role?("user_interface") + self.has_active_remote_console = self.has_active_role?("remote_console") + self.has_active_webservices = self.has_active_role?("web_services") + self.has_active_cockpit_ws = self.has_active_role?("cockpit_ws") save end diff --git a/config/routes.rb b/config/routes.rb index ec9f57201e6..aa397ec9b88 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,7 @@ Vmdb::Application.routes.draw do if Rails.env.development? && defined?(Rails::Server) logger = Logger.new(STDOUT) - logger.level = Logger.const_get(::Settings.log.level_websocket.upcase) + logger.level = Logger.const_get(::Settings.log.level_remote_console.upcase) mount WebsocketServer.new(:logger => logger) => '/ws/console' end end diff --git a/config/settings.yml b/config/settings.yml index 6cd91fe7899..d77dadcef3c 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -926,7 +926,7 @@ :level_scvmm: info :level_vcloud: info :level_vim: warn - :level_websocket: info + :level_remote_console: info :notifications: :history: :purge_window_size: 1000 @@ -1026,7 +1026,7 @@ :prefetch_stale_threshold: 30.seconds :rails_server: puma :remote_console_type: VMRC - :role: database_operations,event,reporting,scheduler,smartstate,ems_operations,ems_inventory,user_interface,websocket,web_services,automate + :role: database_operations,event,reporting,scheduler,smartstate,ems_operations,ems_inventory,user_interface,remote_console,web_services,automate :server_dequeue_frequency: 5.seconds :server_log_frequency: 5.minutes :server_log_timings_threshold: 1.second @@ -1288,7 +1288,7 @@ :connection_pool_size: 8 :memory_threshold: 1.gigabytes :nice_delta: 1 - :websocket_worker: + :remote_console_worker: :connection_pool_size: 14 :memory_threshold: 1.gigabytes :nice_delta: 1 diff --git a/db/fixtures/server_roles.csv b/db/fixtures/server_roles.csv index 4de37e1836a..7aa9c83ba07 100644 --- a/db/fixtures/server_roles.csv +++ b/db/fixtures/server_roles.csv @@ -17,5 +17,5 @@ scheduler,Scheduler,1,false,region smartproxy,SmartProxy,0,false,zone smartstate,SmartState Analysis,0,false,zone user_interface,User Interface,0,false,region -websocket,Websocket,0,false,region +remote_console,Remote Consoles,0,false,region web_services,Web Services,0,false,region diff --git a/lib/vmdb/loggers.rb b/lib/vmdb/loggers.rb index e3c027d71ba..e41c9464ecb 100644 --- a/lib/vmdb/loggers.rb +++ b/lib/vmdb/loggers.rb @@ -18,53 +18,53 @@ def self.init end def self.apply_config(config) - apply_config_value(config, $log, :level) - apply_config_value(config, $rails_log, :level_rails) - apply_config_value(config, $ansible_tower_log, :level_ansible_tower) - apply_config_value(config, $api_log, :level_api) - apply_config_value(config, $miq_ae_logger, :level_automation) - apply_config_value(config, $aws_log, :level_aws) - apply_config_value(config, $azure_log, :level_azure) - apply_config_value(config, $cn_monitoring_log, :level_cn_monitoring) - apply_config_value(config, $datawarehouse_log, :level_datawarehouse) - apply_config_value(config, $fog_log, :level_fog) - apply_config_value(config, $kube_log, :level_kube) - apply_config_value(config, $lenovo_log, :level_lenovo) - apply_config_value(config, $nuage_log, :level_nuage) - apply_config_value(config, $policy_log, :level_policy) - apply_config_value(config, $redfish_log, :level_redfish) - apply_config_value(config, $rhevm_log, :level_rhevm) - apply_config_value(config, $scvmm_log, :level_scvmm) - apply_config_value(config, $vcloud_log, :level_vcloud) - apply_config_value(config, $vim_log, :level_vim) - apply_config_value(config, $websocket_log, :level_websocket) + apply_config_value(config, $log, :level) + apply_config_value(config, $rails_log, :level_rails) + apply_config_value(config, $ansible_tower_log, :level_ansible_tower) + apply_config_value(config, $api_log, :level_api) + apply_config_value(config, $miq_ae_logger, :level_automation) + apply_config_value(config, $aws_log, :level_aws) + apply_config_value(config, $azure_log, :level_azure) + apply_config_value(config, $cn_monitoring_log, :level_cn_monitoring) + apply_config_value(config, $datawarehouse_log, :level_datawarehouse) + apply_config_value(config, $fog_log, :level_fog) + apply_config_value(config, $kube_log, :level_kube) + apply_config_value(config, $lenovo_log, :level_lenovo) + apply_config_value(config, $nuage_log, :level_nuage) + apply_config_value(config, $policy_log, :level_policy) + apply_config_value(config, $redfish_log, :level_redfish) + apply_config_value(config, $rhevm_log, :level_rhevm) + apply_config_value(config, $scvmm_log, :level_scvmm) + apply_config_value(config, $vcloud_log, :level_vcloud) + apply_config_value(config, $vim_log, :level_vim) + apply_config_value(config, $remote_console_log, :level_remote_console) end def self.create_loggers path_dir = ManageIQ.root.join("log") - $audit_log = AuditLogger.new(path_dir.join("audit.log")) - $container_log = ContainerLogger.new - $log = create_multicast_logger(path_dir.join("evm.log")) - $rails_log = create_multicast_logger(path_dir.join("#{Rails.env}.log")) - $api_log = create_multicast_logger(path_dir.join("api.log")) - $ansible_tower_log = create_multicast_logger(path_dir.join("ansible_tower.log")) - $miq_ae_logger = create_multicast_logger(path_dir.join("automation.log")) - $aws_log = create_multicast_logger(path_dir.join("aws.log")) - $azure_log = create_multicast_logger(path_dir.join("azure.log"), AzureLogger) - $cn_monitoring_log = create_multicast_logger(path_dir.join("container_monitoring.log")) - $datawarehouse_log = create_multicast_logger(path_dir.join("datawarehouse.log")) - $fog_log = create_multicast_logger(path_dir.join("fog.log"), FogLogger) - $kube_log = create_multicast_logger(path_dir.join("kubernetes.log")) - $lenovo_log = create_multicast_logger(path_dir.join("lenovo.log")) - $nuage_log = create_multicast_logger(path_dir.join("nuage.log")) - $policy_log = create_multicast_logger(path_dir.join("policy.log")) - $redfish_log = create_multicast_logger(path_dir.join("redfish.log")) - $rhevm_log = create_multicast_logger(path_dir.join("rhevm.log")) - $scvmm_log = create_multicast_logger(path_dir.join("scvmm.log")) - $vcloud_log = create_multicast_logger(path_dir.join("vcloud.log")) - $vim_log = create_multicast_logger(path_dir.join("vim.log")) - $websocket_log = create_multicast_logger(path_dir.join("websocket.log")) + $audit_log = AuditLogger.new(path_dir.join("audit.log")) + $container_log = ContainerLogger.new + $log = create_multicast_logger(path_dir.join("evm.log")) + $rails_log = create_multicast_logger(path_dir.join("#{Rails.env}.log")) + $api_log = create_multicast_logger(path_dir.join("api.log")) + $ansible_tower_log = create_multicast_logger(path_dir.join("ansible_tower.log")) + $miq_ae_logger = create_multicast_logger(path_dir.join("automation.log")) + $aws_log = create_multicast_logger(path_dir.join("aws.log")) + $azure_log = create_multicast_logger(path_dir.join("azure.log"), AzureLogger) + $cn_monitoring_log = create_multicast_logger(path_dir.join("container_monitoring.log")) + $datawarehouse_log = create_multicast_logger(path_dir.join("datawarehouse.log")) + $fog_log = create_multicast_logger(path_dir.join("fog.log"), FogLogger) + $kube_log = create_multicast_logger(path_dir.join("kubernetes.log")) + $lenovo_log = create_multicast_logger(path_dir.join("lenovo.log")) + $nuage_log = create_multicast_logger(path_dir.join("nuage.log")) + $policy_log = create_multicast_logger(path_dir.join("policy.log")) + $redfish_log = create_multicast_logger(path_dir.join("redfish.log")) + $rhevm_log = create_multicast_logger(path_dir.join("rhevm.log")) + $scvmm_log = create_multicast_logger(path_dir.join("scvmm.log")) + $vcloud_log = create_multicast_logger(path_dir.join("vcloud.log")) + $vim_log = create_multicast_logger(path_dir.join("vim.log")) + $remote_console_log = create_multicast_logger(path_dir.join("remote_console.log")) configure_external_loggers end diff --git a/lib/websocket_server.rb b/lib/websocket_server.rb index 646c8478ac2..22960ec1243 100644 --- a/lib/websocket_server.rb +++ b/lib/websocket_server.rb @@ -27,7 +27,7 @@ class WebsocketServer RACK_YAY = [-1, {}, []].freeze def initialize(options = {}) - @logger = options.fetch(:logger, $websocket_log) + @logger = options.fetch(:logger, $remote_console_log) @logger.info('Initializing websocket server!') @proxy = SurroGate.new(logger) @adapters = {} diff --git a/lib/workers/miq_worker_types.rb b/lib/workers/miq_worker_types.rb index a2534e07ba9..51cdf9d64a4 100644 --- a/lib/workers/miq_worker_types.rb +++ b/lib/workers/miq_worker_types.rb @@ -72,7 +72,7 @@ "MiqUiWorker" => %i(manageiq_default ui_dependencies), "MiqVimBrokerWorker" => %i(manageiq_default), "MiqWebServiceWorker" => %i(manageiq_default), - "MiqWebsocketWorker" => %i(manageiq_default), + "MiqRemoteConsoleWorker" => %i(manageiq_default), }.freeze MIQ_WORKER_TYPES_IN_KILL_ORDER = %w( @@ -151,6 +151,6 @@ ManageIQ::Providers::Openshift::MonitoringManager::EventCatcher ManageIQ::Providers::Lenovo::PhysicalInfraManager::EventCatcher MiqUiWorker - MiqWebsocketWorker + MiqRemoteConsoleWorker MiqCockpitWsWorker ).freeze diff --git a/spec/factories/miq_worker.rb b/spec/factories/miq_worker.rb index 0d72fbaeb48..b4e93931d88 100644 --- a/spec/factories/miq_worker.rb +++ b/spec/factories/miq_worker.rb @@ -7,7 +7,7 @@ factory :miq_generic_worker, :class => "MiqGenericWorker", :parent => :miq_worker factory :miq_ui_worker, :class => "MiqUiWorker", :parent => :miq_worker factory :miq_schedule_worker, :parent => :miq_worker, :class => "MiqScheduleWorker" - factory :miq_websocket_worker, :class => "MiqWebsocketWorker", :parent => :miq_worker + factory :miq_remote_console_worker, :class => "MiqRemoteConsoleWorker", :parent => :miq_worker factory :miq_ems_metrics_processor_worker, :class => "MiqEmsMetricsProcessorWorker", :parent => :miq_worker diff --git a/spec/lib/vmdb/loggers_spec.rb b/spec/lib/vmdb/loggers_spec.rb index bf62a29d84c..a63f640eb11 100644 --- a/spec/lib/vmdb/loggers_spec.rb +++ b/spec/lib/vmdb/loggers_spec.rb @@ -131,7 +131,7 @@ def in_container_env(example) $log, $rails_log, $api_log, $miq_ae_logger, $aws_log, $azure_log, $cn_monitoring_log, $datawarehouse_log, $fog_log, $kube_log, $lenovo_log, $nuage_log, $policy_log, $rhevm_log, $scvmm_log, $vcloud_log, $vim_log, - $websocket_log + $remote_console_log ].each do |logger| context "for the #{File.basename(logger.filename)}" do include_examples "has basic logging functionality", logger.dup diff --git a/spec/models/miq_websocket_worker/runner_spec.rb b/spec/models/miq_remote_console_worker/runner_spec.rb similarity index 83% rename from spec/models/miq_websocket_worker/runner_spec.rb rename to spec/models/miq_remote_console_worker/runner_spec.rb index 10d992df402..a42d634b064 100644 --- a/spec/models/miq_websocket_worker/runner_spec.rb +++ b/spec/models/miq_remote_console_worker/runner_spec.rb @@ -1,9 +1,9 @@ -describe MiqWebsocketWorker::Runner do +describe MiqRemoteConsoleWorker::Runner do describe '#check_internal_thread' do subject do w = described_class.allocate allow(w).to receive(:worker_initialization) - w.send(:initialize, :guid => MiqWebsocketWorker.create_worker_record.guid) + w.send(:initialize, :guid => MiqRemoteConsoleWorker.create_worker_record.guid) w end diff --git a/spec/models/miq_server/role_management_spec.rb b/spec/models/miq_server/role_management_spec.rb index 3b313aca51e..4c8488c882e 100644 --- a/spec/models/miq_server/role_management_spec.rb +++ b/spec/models/miq_server/role_management_spec.rb @@ -18,7 +18,7 @@ smartproxy,SmartProxy,0,false,zone smartstate,SmartState Analysis,0,false,zone user_interface,User Interface,0,false,region - websocket,Websocket,0,false,region + remote_console,Remote Consoles,0,false,region web_services,Web Services,0,false,region cockpit_ws,Cockpit,1,false,region CSV diff --git a/spec/models/miq_server/server_monitor_spec.rb b/spec/models/miq_server/server_monitor_spec.rb index 80e92dafe18..941b25d5889 100644 --- a/spec/models/miq_server/server_monitor_spec.rb +++ b/spec/models/miq_server/server_monitor_spec.rb @@ -18,7 +18,7 @@ smartproxy,SmartProxy,0,false,zone smartstate,SmartState Analysis,0,false,zone user_interface,User Interface,0,false,region - websocket,Websocket,0,false,region + remote_console,Remote Consoles,0,false,region web_services,Web Services,0,false,region CSV allow(ServerRole).to receive(:seed_data).and_return(@csv) diff --git a/spec/models/mixins/miq_web_server_worker_mixin_spec.rb b/spec/models/mixins/miq_web_server_worker_mixin_spec.rb index da547e008a4..7f32a6fc2d3 100644 --- a/spec/models/mixins/miq_web_server_worker_mixin_spec.rb +++ b/spec/models/mixins/miq_web_server_worker_mixin_spec.rb @@ -72,11 +72,11 @@ def self.binding_address end describe '#rails_application' do - let(:websocket_worker) { FactoryBot.create(:miq_websocket_worker, :uri => 'http://127.0.0.1:3000') } + let(:remote_console_worker) { FactoryBot.create(:miq_remote_console_worker, :uri => 'http://127.0.0.1:3000') } let(:ui_worker) { FactoryBot.create(:miq_ui_worker, :uri => 'http://127.0.0.1:3000') } it 'provides access to the Rack/Rails application' do - expect(websocket_worker.rails_application).to be_a_kind_of(WebsocketServer) + expect(remote_console_worker.rails_application).to be_a_kind_of(WebsocketServer) expect(ui_worker.rails_application).to be_a_kind_of(Vmdb::Application) end end diff --git a/spec/models/server_role_spec.rb b/spec/models/server_role_spec.rb index 935c09b5ec0..6c68c3d812f 100644 --- a/spec/models/server_role_spec.rb +++ b/spec/models/server_role_spec.rb @@ -45,7 +45,7 @@ smartproxy,SmartProxy,0,false,zone smartstate,SmartState Analysis,0,false,zone user_interface,User Interface,0,false,region - websocket,Websocket,0,false,region + remote_console,Remote Consoles,0,false,region web_services,Web Services,0,false,region CSV