manageiq-appliance_console 7.2.1 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/Gemfile +1 -0
- data/bin/appliance_console +43 -27
- data/lib/manageiq/appliance_console/cli.rb +3 -5
- data/lib/manageiq/appliance_console/database_admin.rb +1 -1
- data/lib/manageiq/appliance_console/database_configuration.rb +2 -14
- data/lib/manageiq/appliance_console/database_replication.rb +14 -43
- data/lib/manageiq/appliance_console/database_replication_standby.rb +3 -2
- data/lib/manageiq/appliance_console/evm_server.rb +66 -0
- data/lib/manageiq/appliance_console/external_database_configuration.rb +0 -4
- data/lib/manageiq/appliance_console/internal_database_configuration.rb +4 -9
- data/lib/manageiq/appliance_console/logfile_configuration.rb +3 -3
- data/lib/manageiq/appliance_console/message_configuration.rb +4 -14
- data/lib/manageiq/appliance_console/message_configuration_client.rb +4 -2
- data/lib/manageiq/appliance_console/message_configuration_server.rb +0 -3
- data/lib/manageiq/appliance_console/postgres_admin.rb +3 -8
- data/lib/manageiq/appliance_console/principal.rb +1 -1
- data/lib/manageiq/appliance_console/version.rb +1 -1
- data/lib/manageiq-appliance_console.rb +1 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ad20683e3cdb9f2f4dfb894e34ba2dedd81aeb6e511db18caae12b92499d5c0
|
4
|
+
data.tar.gz: 4eee448a7715b15f61e325a066c500d7fd40af1b01683d74d74659d215e364cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f1d185402221742019cea8006f5cae97322c3a0fa01eb90cb5f1be821424e4ca3f2e5d2091cc9726b398e6485bc34bbf0c584f124af881607bb2ed470e23757
|
7
|
+
data.tar.gz: 440c7adb764a120a9690851f6046e4206be2d8c5bbc2ea998944646de5144de20031c4feeb98a49392f35743a1833ec529dd6f52ab77b43ce9404540e018e6fc
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Change Log
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
|
+
|
5
|
+
## [Unreleased]
|
6
|
+
|
7
|
+
## [8.0.0] - 2022-10-18
|
8
|
+
### Fixed
|
9
|
+
- Don't require pressing any key twice for message configuration (#193)
|
10
|
+
|
11
|
+
### Added
|
12
|
+
- Report messaging configuration on summary info page (#190)
|
13
|
+
|
14
|
+
### Changed
|
15
|
+
- Refactor EvmServer operations (#194)
|
16
|
+
- Only start evmserverd after all application configuration is done (#195)
|
17
|
+
- **BREAKING** Don't start evmserverd until messaging is configured (#196)
|
18
|
+
- Simplify messaging options by saving in yml files (#197)
|
19
|
+
|
20
|
+
[Unreleased]: https://github.com/ManageIQ/manageiq-appliance_console/compare/v8.0.0...HEAD
|
21
|
+
[8.0.0]: https://github.com/ManageIQ/manageiq-appliance_console/compare/v7.1.1..v8.0.0
|
data/Gemfile
CHANGED
data/bin/appliance_console
CHANGED
@@ -92,18 +92,26 @@ module ApplianceConsole
|
|
92
92
|
eth0.reload
|
93
93
|
eth0.parse_conf if eth0.respond_to?(:parse_conf)
|
94
94
|
|
95
|
-
host
|
96
|
-
ip
|
97
|
-
mac
|
98
|
-
mask
|
99
|
-
gw
|
100
|
-
dns1, dns2
|
101
|
-
order
|
102
|
-
timezone
|
103
|
-
version
|
104
|
-
dbhost
|
105
|
-
database
|
106
|
-
|
95
|
+
host = LinuxAdmin::Hosts.new.hostname
|
96
|
+
ip = eth0.address
|
97
|
+
mac = eth0.mac_address
|
98
|
+
mask = eth0.netmask
|
99
|
+
gw = eth0.gateway
|
100
|
+
dns1, dns2 = dns.nameservers
|
101
|
+
order = dns.search_order.join(' ')
|
102
|
+
timezone = LinuxAdmin::TimeDate.system_timezone
|
103
|
+
version = File.read(VERSION_FILE).chomp if File.exist?(VERSION_FILE)
|
104
|
+
dbhost = ManageIQ::ApplianceConsole::DatabaseConfiguration.database_host
|
105
|
+
database = ManageIQ::ApplianceConsole::DatabaseConfiguration.database_name
|
106
|
+
messaging = ManageIQ::ApplianceConsole::MessageConfiguration.configured?
|
107
|
+
messaging_broker = ManageIQ::ApplianceConsole::MessageServerConfiguration.configured?
|
108
|
+
evm_status = if ManageIQ::ApplianceConsole::EvmServer.running?
|
109
|
+
"running"
|
110
|
+
elsif ManageIQ::ApplianceConsole::EvmServer.runnable?
|
111
|
+
"not running"
|
112
|
+
else
|
113
|
+
"not configured"
|
114
|
+
end
|
107
115
|
|
108
116
|
summary_attributes = [
|
109
117
|
summary_entry("Hostname", host),
|
@@ -117,9 +125,11 @@ module ApplianceConsole
|
|
117
125
|
summary_entry("MAC Address", mac),
|
118
126
|
summary_entry("Timezone", timezone),
|
119
127
|
summary_entry("Local Database Server", PostgresAdmin.local_server_status),
|
120
|
-
summary_entry("#{I18n.t("product.name")} Server",
|
128
|
+
summary_entry("#{I18n.t("product.name")} Server", evm_status),
|
121
129
|
summary_entry("#{I18n.t("product.name")} Database", dbhost || "not configured"),
|
122
130
|
summary_entry("Database/Region", database ? "#{database} / #{region.to_i}" : "not configured"),
|
131
|
+
summary_entry("Messaging", messaging ? "configured" : "not configured"),
|
132
|
+
summary_entry("Local Messaging Broker", messaging_broker ? "configured" : "not configured"),
|
123
133
|
summary_entry("External Auth", ExternalHttpdAuthentication.config_status),
|
124
134
|
summary_entry("#{I18n.t("product.name")} Version", version),
|
125
135
|
]
|
@@ -322,12 +332,11 @@ Static Network Configuration
|
|
322
332
|
|
323
333
|
when I18n.t("advanced_settings.evmstop")
|
324
334
|
say("#{selection}\n\n")
|
325
|
-
|
326
|
-
if service.running?
|
335
|
+
if ManageIQ::ApplianceConsole::EvmServer.running?
|
327
336
|
if ask_yn? "\nNote: It may take up to a few minutes for all #{I18n.t("product.name")} server processes to exit gracefully. Stop #{I18n.t("product.name")}"
|
328
337
|
say("\nStopping #{I18n.t("product.name")} Server...")
|
329
338
|
logger.info("EVM server stop initiated by appliance console.")
|
330
|
-
|
339
|
+
ManageIQ::ApplianceConsole::EvmServer.stop
|
331
340
|
end
|
332
341
|
else
|
333
342
|
say("\n#{I18n.t("product.name")} Server is not running...")
|
@@ -339,13 +348,7 @@ Static Network Configuration
|
|
339
348
|
if ask_yn?("\nStart #{I18n.t("product.name")}")
|
340
349
|
say("\nStarting #{I18n.t("product.name")} Server...")
|
341
350
|
logger.info("EVM server start initiated by appliance console.")
|
342
|
-
|
343
|
-
LinuxAdmin::Service.new("evmserverd").start
|
344
|
-
rescue AwesomeSpawn::CommandResultError => e
|
345
|
-
say e.result.output
|
346
|
-
say e.result.error
|
347
|
-
say ""
|
348
|
-
end
|
351
|
+
ManageIQ::ApplianceConsole::EvmServer.start
|
349
352
|
press_any_key
|
350
353
|
end
|
351
354
|
|
@@ -396,6 +399,14 @@ Static Network Configuration
|
|
396
399
|
|
397
400
|
messaging_action = ask_with_menu("Configure Messaging", messaging_options)
|
398
401
|
|
402
|
+
changes_requested = database_action != "no_changes" || messaging_action != "no_changes"
|
403
|
+
|
404
|
+
# Stop evmserver while we make changes to the database and/or messaging configuration
|
405
|
+
if changes_requested
|
406
|
+
say("\nStopping #{I18n.t("product.name")} Server...")
|
407
|
+
ManageIQ::ApplianceConsole::EvmServer.stop
|
408
|
+
end
|
409
|
+
|
399
410
|
database_configuration =
|
400
411
|
case database_action
|
401
412
|
when "create_internal"
|
@@ -436,7 +447,6 @@ Static Network Configuration
|
|
436
447
|
press_any_key
|
437
448
|
raise MiqSignalError
|
438
449
|
end
|
439
|
-
|
440
450
|
when "message_client"
|
441
451
|
say("#{selection}\n\n")
|
442
452
|
|
@@ -454,6 +464,12 @@ Static Network Configuration
|
|
454
464
|
end
|
455
465
|
end
|
456
466
|
|
467
|
+
# Start evmserverd if database and/or messaging were set up and we are supposed to run as an evmserver
|
468
|
+
if changes_requested && database_configuration.run_as_evm_server
|
469
|
+
say("\nStarting #{I18n.t("product.name")} Server...")
|
470
|
+
ManageIQ::ApplianceConsole::EvmServer.start
|
471
|
+
end
|
472
|
+
|
457
473
|
press_any_key
|
458
474
|
|
459
475
|
when I18n.t("advanced_settings.db_replication")
|
@@ -551,13 +567,13 @@ Static Network Configuration
|
|
551
567
|
when RE_RESTART
|
552
568
|
if are_you_sure?("restart the appliance now")
|
553
569
|
logger.info("Appliance restart initiated by appliance console.")
|
554
|
-
|
570
|
+
ManageIQ::ApplianceConsole::EvmServer.stop
|
555
571
|
LinuxAdmin::System.reboot!
|
556
572
|
end
|
557
573
|
when RE_DELLOGS
|
558
574
|
if are_you_sure?("restart the appliance now")
|
559
575
|
logger.info("Appliance restart with clean logs initiated by appliance console.")
|
560
|
-
|
576
|
+
ManageIQ::ApplianceConsole::EvmServer.stop
|
561
577
|
LinuxAdmin::Service.new("miqtop").stop
|
562
578
|
LinuxAdmin::Service.new("miqvmstat").stop
|
563
579
|
LinuxAdmin::Service.new("httpd").stop
|
@@ -573,7 +589,7 @@ Static Network Configuration
|
|
573
589
|
if are_you_sure?("shut down the appliance now")
|
574
590
|
say("\nShutting down appliance... This process may take a few minutes.\n\n")
|
575
591
|
logger.info("Appliance shutdown initiated by appliance console")
|
576
|
-
|
592
|
+
ManageIQ::ApplianceConsole::EvmServer.stop
|
577
593
|
LinuxAdmin::System.shutdown!
|
578
594
|
end
|
579
595
|
|
@@ -529,15 +529,13 @@ module ApplianceConsole
|
|
529
529
|
end
|
530
530
|
|
531
531
|
def set_server_state
|
532
|
-
service = LinuxAdmin::Service.new("evmserverd")
|
533
|
-
service_running = service.running?
|
534
532
|
case options[:server]
|
535
533
|
when "start"
|
536
|
-
|
534
|
+
EvmServer.start unless EvmServer.running?
|
537
535
|
when "stop"
|
538
|
-
|
536
|
+
EvmServer.stop if EvmServer.running?
|
539
537
|
when "restart"
|
540
|
-
|
538
|
+
EvmServer.restart
|
541
539
|
else
|
542
540
|
raise "Invalid server action"
|
543
541
|
end
|
@@ -38,7 +38,7 @@ module ManageIQ
|
|
38
38
|
|
39
39
|
def ask_questions
|
40
40
|
setting_header
|
41
|
-
if action == :restore &&
|
41
|
+
if action == :restore && EvmServer.running?
|
42
42
|
say("\nDatabase restore failed. Please execute the \“Stop EVM Server Processes\” command and try again.")
|
43
43
|
press_any_key
|
44
44
|
raise MiqSignalError
|
@@ -12,7 +12,7 @@ module ApplianceConsole
|
|
12
12
|
class DatabaseConfiguration
|
13
13
|
include ManageIQ::ApplianceConsole::ManageiqUserMixin
|
14
14
|
|
15
|
-
attr_accessor :adapter, :host, :username, :database, :port, :region
|
15
|
+
attr_accessor :adapter, :host, :username, :database, :port, :region, :run_as_evm_server
|
16
16
|
attr_reader :password
|
17
17
|
|
18
18
|
class ModelWithNoBackingTable < ActiveRecord::Base
|
@@ -38,6 +38,7 @@ module ApplianceConsole
|
|
38
38
|
@adapter ||= "postgresql"
|
39
39
|
# introduced by Logging
|
40
40
|
self.interactive = true unless hash.key?(:interactive)
|
41
|
+
self.run_as_evm_server = true unless hash.key?(:run_as_evm_server)
|
41
42
|
end
|
42
43
|
|
43
44
|
def run_interactive
|
@@ -48,7 +49,6 @@ module ApplianceConsole
|
|
48
49
|
|
49
50
|
raise MiqSignalError unless activate
|
50
51
|
|
51
|
-
post_activation
|
52
52
|
say("\nConfiguration activated successfully.\n")
|
53
53
|
rescue RuntimeError => e
|
54
54
|
puts "Configuration failed#{": " + e.message unless e.class == MiqSignalError}"
|
@@ -236,18 +236,6 @@ FRIENDLY
|
|
236
236
|
end
|
237
237
|
end
|
238
238
|
|
239
|
-
def start_evm
|
240
|
-
pid = fork do
|
241
|
-
begin
|
242
|
-
LinuxAdmin::Service.new("evmserverd").start(true)
|
243
|
-
rescue => e
|
244
|
-
logger.error("Failed to enable and start evmserverd service: #{e.message}")
|
245
|
-
logger.error(e.backtrace.join("\n"))
|
246
|
-
end
|
247
|
-
end
|
248
|
-
Process.detach(pid)
|
249
|
-
end
|
250
|
-
|
251
239
|
private
|
252
240
|
|
253
241
|
def self.rails_env
|
@@ -7,20 +7,11 @@ module ApplianceConsole
|
|
7
7
|
class DatabaseReplication
|
8
8
|
include ManageIQ::ApplianceConsole::Logging
|
9
9
|
|
10
|
+
REPMGR_CONFIG = '/etc/repmgr/10/repmgr.conf'.freeze
|
11
|
+
REPMGR_LOG = '/var/log/repmgr/repmgrd.log'.freeze
|
10
12
|
PGPASS_FILE = '/var/lib/pgsql/.pgpass'.freeze
|
11
13
|
NETWORK_INTERFACE = 'eth0'.freeze
|
12
14
|
|
13
|
-
REPGMR_FILE_LOCATIONS = {
|
14
|
-
"repmgr10" => {
|
15
|
-
"config" => "/etc/repmgr/10/repmgr.conf",
|
16
|
-
"log" => "/var/log/repmgr/repmgrd.log"
|
17
|
-
},
|
18
|
-
"repmgr13" => {
|
19
|
-
"config" => "/etc/repmgr/13/repmgr.conf",
|
20
|
-
"log" => "/var/log/repmgr/repmgrd-13.log"
|
21
|
-
}
|
22
|
-
}.freeze
|
23
|
-
|
24
15
|
attr_accessor :node_number, :database_name, :database_user,
|
25
16
|
:database_password, :primary_host
|
26
17
|
|
@@ -46,53 +37,33 @@ Replication Server Configuration
|
|
46
37
|
EOL
|
47
38
|
end
|
48
39
|
|
49
|
-
def
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
def self.repmgr_configured?
|
54
|
-
File.exist?(repmgr_config)
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.repmgr_file_locations
|
58
|
-
REPGMR_FILE_LOCATIONS[repmgr_service_name]
|
40
|
+
def repmgr_configured?
|
41
|
+
File.exist?(REPMGR_CONFIG)
|
59
42
|
end
|
60
43
|
|
61
|
-
def self.repmgr_log
|
62
|
-
repmgr_file_locations["log"]
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.repmgr_service_name
|
66
|
-
@repmgr_service_name ||= File.exist?(REPGMR_FILE_LOCATIONS["repmgr13"]["config"]) ? "repmgr13" : "repmgr10"
|
67
|
-
end
|
68
|
-
|
69
|
-
delegate :repmgr_config, :repmgr_configured?, :repmgr_file_locations, :repmgr_log, :repmgr_service_name, :to => self
|
70
|
-
|
71
44
|
def confirm_reconfiguration
|
72
|
-
say("Warning: File #{
|
73
|
-
logger.warn("Warning: File #{
|
45
|
+
say("Warning: File #{REPMGR_CONFIG} exists. Replication is already configured")
|
46
|
+
logger.warn("Warning: File #{REPMGR_CONFIG} exists. Replication is already configured")
|
74
47
|
agree("Continue with configuration? (Y/N): ")
|
75
48
|
end
|
76
49
|
|
77
50
|
def create_config_file(host)
|
78
|
-
File.write(
|
51
|
+
File.write(REPMGR_CONFIG, config_file_contents(host))
|
79
52
|
true
|
80
53
|
end
|
81
54
|
|
82
55
|
def config_file_contents(host)
|
83
56
|
service_name = PostgresAdmin.service_name
|
84
|
-
# FYI, 5.0 made quoting strings strict. Always use single quoted strings.
|
85
|
-
# https://repmgr.org/docs/current/release-5.0.html
|
86
57
|
<<-EOS.strip_heredoc
|
87
|
-
node_id
|
88
|
-
node_name
|
58
|
+
node_id=#{node_number}
|
59
|
+
node_name=#{host}
|
89
60
|
conninfo='host=#{host} user=#{database_user} dbname=#{database_name}'
|
90
|
-
use_replication_slots=
|
61
|
+
use_replication_slots=1
|
91
62
|
pg_basebackup_options='--wal-method=stream'
|
92
|
-
failover=
|
93
|
-
promote_command='repmgr standby promote -f #{
|
94
|
-
follow_command='repmgr standby follow -f #{
|
95
|
-
log_file
|
63
|
+
failover=automatic
|
64
|
+
promote_command='repmgr standby promote -f #{REPMGR_CONFIG} --log-to-file'
|
65
|
+
follow_command='repmgr standby follow -f #{REPMGR_CONFIG} --log-to-file --upstream-node-id=%n'
|
66
|
+
log_file=#{REPMGR_LOG}
|
96
67
|
service_start_command='sudo systemctl start #{service_name}'
|
97
68
|
service_stop_command='sudo systemctl stop #{service_name}'
|
98
69
|
service_restart_command='sudo systemctl restart #{service_name}'
|
@@ -8,6 +8,7 @@ module ApplianceConsole
|
|
8
8
|
include ManageIQ::ApplianceConsole::Logging
|
9
9
|
|
10
10
|
REGISTER_CMD = 'repmgr standby register'.freeze
|
11
|
+
REPMGRD_SERVICE = 'repmgr10'.freeze
|
11
12
|
|
12
13
|
attr_accessor :disk, :standby_host, :run_repmgrd_configuration, :resync_data, :force_register
|
13
14
|
|
@@ -110,7 +111,7 @@ module ApplianceConsole
|
|
110
111
|
end
|
111
112
|
|
112
113
|
def start_repmgrd
|
113
|
-
LinuxAdmin::Service.new(
|
114
|
+
LinuxAdmin::Service.new(REPMGRD_SERVICE).enable.start
|
114
115
|
true
|
115
116
|
rescue AwesomeSpawn::CommandResultError => e
|
116
117
|
message = "Failed to start repmgrd: #{e.message}"
|
@@ -120,7 +121,7 @@ module ApplianceConsole
|
|
120
121
|
end
|
121
122
|
|
122
123
|
def stop_repmgrd
|
123
|
-
LinuxAdmin::Service.new(
|
124
|
+
LinuxAdmin::Service.new(REPMGRD_SERVICE).stop
|
124
125
|
true
|
125
126
|
end
|
126
127
|
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module ManageIQ
|
2
|
+
module ApplianceConsole
|
3
|
+
class EvmServer
|
4
|
+
class NotRunnableError < RuntimeError; end
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def running?
|
8
|
+
service.running?
|
9
|
+
end
|
10
|
+
|
11
|
+
def start!(enable: false)
|
12
|
+
raise NotRunnableError, "Cannot start #{I18n.t("product.name")}: #{not_runnable_reason}" unless runnable?
|
13
|
+
|
14
|
+
service.start(enable)
|
15
|
+
end
|
16
|
+
|
17
|
+
def start(enable: false)
|
18
|
+
start!(:enable => enable)
|
19
|
+
rescue AwesomeSpawn::CommandResultError => e
|
20
|
+
say(e.result.output)
|
21
|
+
say(e.result.error)
|
22
|
+
say("")
|
23
|
+
false
|
24
|
+
rescue NotRunnableError => e
|
25
|
+
say(e.to_s)
|
26
|
+
say("")
|
27
|
+
false
|
28
|
+
end
|
29
|
+
|
30
|
+
def stop
|
31
|
+
service.stop
|
32
|
+
end
|
33
|
+
|
34
|
+
def restart
|
35
|
+
service.restart
|
36
|
+
end
|
37
|
+
|
38
|
+
def enable
|
39
|
+
service.enable
|
40
|
+
end
|
41
|
+
|
42
|
+
def disable
|
43
|
+
service.disable
|
44
|
+
end
|
45
|
+
|
46
|
+
def runnable?
|
47
|
+
DatabaseConfiguration.database_yml_configured? && MessageConfiguration.configured?
|
48
|
+
end
|
49
|
+
|
50
|
+
def not_runnable_reason
|
51
|
+
if !DatabaseConfiguration.database_yml_configured?
|
52
|
+
"A Database connection has not been configured."
|
53
|
+
elsif !MessageConfiguration.configured?
|
54
|
+
"Messaging has not been configured."
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def service
|
61
|
+
@service ||= LinuxAdmin::Service.new("evmserverd")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -5,7 +5,7 @@ require "linux_admin"
|
|
5
5
|
module ManageIQ
|
6
6
|
module ApplianceConsole
|
7
7
|
class InternalDatabaseConfiguration < DatabaseConfiguration
|
8
|
-
attr_accessor :disk
|
8
|
+
attr_accessor :disk
|
9
9
|
|
10
10
|
DEDICATED_DB_SHARED_BUFFERS = "'1GB'".freeze
|
11
11
|
SHARED_DB_SHARED_BUFFERS = "'128MB'".freeze
|
@@ -24,10 +24,9 @@ module ApplianceConsole
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def set_defaults
|
27
|
-
self.host
|
28
|
-
self.username
|
29
|
-
self.database
|
30
|
-
self.run_as_evm_server = true
|
27
|
+
self.host = 'localhost'
|
28
|
+
self.username = "root"
|
29
|
+
self.database = "vmdb_production"
|
31
30
|
end
|
32
31
|
|
33
32
|
def activate
|
@@ -109,10 +108,6 @@ module ApplianceConsole
|
|
109
108
|
copy_template "pg_ident.conf"
|
110
109
|
end
|
111
110
|
|
112
|
-
def post_activation
|
113
|
-
start_evm if run_as_evm_server
|
114
|
-
end
|
115
|
-
|
116
111
|
private
|
117
112
|
|
118
113
|
def mount_point
|
@@ -20,7 +20,7 @@ module ApplianceConsole
|
|
20
20
|
|
21
21
|
self.size = Utilities.disk_usage(LOGFILE_DIRECTORY)[0][:total_bytes]
|
22
22
|
self.current_logrotate_count = /rotate\s+(\d+)/.match(File.read(MIQ_LOGS_CONF))[1]
|
23
|
-
self.evm_was_running =
|
23
|
+
self.evm_was_running = EvmServer.running?
|
24
24
|
end
|
25
25
|
|
26
26
|
def activate
|
@@ -103,13 +103,13 @@ module ApplianceConsole
|
|
103
103
|
|
104
104
|
def start_evm
|
105
105
|
say 'Starting EVM'
|
106
|
-
|
106
|
+
EvmServer.start(:enable => true)
|
107
107
|
LinuxAdmin::Service.new("httpd").enable.start
|
108
108
|
end
|
109
109
|
|
110
110
|
def stop_evm
|
111
111
|
say 'Stopping EVM'
|
112
|
-
|
112
|
+
EvmServer.stop
|
113
113
|
LinuxAdmin::Service.new("httpd").stop
|
114
114
|
end
|
115
115
|
end
|
@@ -26,6 +26,10 @@ module ManageIQ
|
|
26
26
|
File.exist?("#{BASE_DIR}/bin/kafka-run-class.sh")
|
27
27
|
end
|
28
28
|
|
29
|
+
def self.configured?
|
30
|
+
MessageServerConfiguration.configured? || MessageClientConfiguration.configured?
|
31
|
+
end
|
32
|
+
|
29
33
|
def initialize(options = {})
|
30
34
|
@message_server_port = options[:message_server_port] || 9093
|
31
35
|
@message_keystore_username = options[:message_keystore_username] || "admin"
|
@@ -179,21 +183,7 @@ module ManageIQ
|
|
179
183
|
true
|
180
184
|
end
|
181
185
|
|
182
|
-
def configure_messaging_type(value)
|
183
|
-
say(__method__.to_s.tr("_", " ").titleize)
|
184
|
-
|
185
|
-
ManageIQ::ApplianceConsole::Utilities.rake_run!("evm:settings:set", ["/prototype/messaging_type=#{value}"])
|
186
|
-
end
|
187
|
-
|
188
|
-
def restart_evmserverd
|
189
|
-
say("Restart evmserverd if it is running...")
|
190
|
-
evmserverd_service = LinuxAdmin::Service.new("evmserverd")
|
191
|
-
evmserverd_service.restart if evmserverd_service.running?
|
192
|
-
end
|
193
|
-
|
194
186
|
def unconfigure
|
195
|
-
configure_messaging_type("miq_queue") # Settings.prototype.messaging_type = 'miq_queue'
|
196
|
-
restart_evmserverd
|
197
187
|
remove_installed_files
|
198
188
|
end
|
199
189
|
|
@@ -29,8 +29,6 @@ module ManageIQ
|
|
29
29
|
configure_messaging_yaml # Set up the local message client in case EVM is actually running on this, Message Server
|
30
30
|
create_client_properties # Create the client.properties configuration fle
|
31
31
|
fetch_truststore_from_server # Fetch the Java Keystore from the Kafka Server
|
32
|
-
configure_messaging_type("kafka") # Settings.prototype.messaging_type = 'kafka'
|
33
|
-
restart_evmserverd
|
34
32
|
rescue AwesomeSpawn::CommandResultError => e
|
35
33
|
say(e.result.output)
|
36
34
|
say(e.result.error)
|
@@ -77,6 +75,10 @@ module ManageIQ
|
|
77
75
|
fetch_from_server(message_ca_cert_path_src, ca_cert_path)
|
78
76
|
end
|
79
77
|
|
78
|
+
def self.configured?
|
79
|
+
MessageClientConfiguration.new.installed_files.all? { |f| File.exist?(f) }
|
80
|
+
end
|
81
|
+
|
80
82
|
private
|
81
83
|
|
82
84
|
def fetch_from_server(src_file, dst_file)
|
@@ -43,7 +43,6 @@ module ManageIQ
|
|
43
43
|
configure_keystore # Populate the Java Keystore
|
44
44
|
create_server_properties # Update the /opt/message/config/server.properties
|
45
45
|
configure_messaging_yaml # Set up the local message client in case EVM is actually running on this, Message Server
|
46
|
-
configure_messaging_type("kafka") # Settings.prototype.messaging_type = 'kafka'
|
47
46
|
restart_services
|
48
47
|
rescue AwesomeSpawn::CommandResultError => e
|
49
48
|
say(e.result.output)
|
@@ -64,8 +63,6 @@ module ManageIQ
|
|
64
63
|
|
65
64
|
say("Starting kafka and configure it to start on reboots ...")
|
66
65
|
LinuxAdmin::Service.new("kafka").start.enable
|
67
|
-
|
68
|
-
restart_evmserverd
|
69
66
|
end
|
70
67
|
|
71
68
|
def ask_for_parameters
|
@@ -62,18 +62,13 @@ module ApplianceConsole
|
|
62
62
|
LinuxAdmin::Service.new(service_name).running?
|
63
63
|
end
|
64
64
|
|
65
|
-
def self.
|
66
|
-
|
67
|
-
# see: https://repmgr.org/docs/current/release-5.0.html
|
68
|
-
# https://www.2ndquadrant.com/en/blog/replication-configuration-changes-in-postgresql-12/
|
69
|
-
# "standby.signal" – indicates the server should start up as a hot standby
|
70
|
-
# If a standby is promoted, "standby.signal" is removed entirely (and not renamed as was the case with "recovery.conf", which became "recovery.done").
|
71
|
-
data_directory.join("standby.signal").exist? || data_directory.join("recovery.conf").exist?
|
65
|
+
def self.local_server_in_recovery?
|
66
|
+
data_directory.join("recovery.conf").exist?
|
72
67
|
end
|
73
68
|
|
74
69
|
def self.local_server_status
|
75
70
|
if service_running?
|
76
|
-
"running (#{
|
71
|
+
"running (#{local_server_in_recovery? ? "standby" : "primary"})"
|
77
72
|
elsif initialized?
|
78
73
|
"initialized and stopped"
|
79
74
|
else
|
@@ -34,6 +34,7 @@ require 'manageiq/appliance_console/database_replication_standby'
|
|
34
34
|
require 'manageiq/appliance_console/external_auth_options'
|
35
35
|
require 'manageiq/appliance_console/external_database_configuration'
|
36
36
|
require 'manageiq/appliance_console/external_httpd_authentication'
|
37
|
+
require 'manageiq/appliance_console/evm_server'
|
37
38
|
require 'manageiq/appliance_console/internal_database_configuration'
|
38
39
|
require 'manageiq/appliance_console/key_configuration'
|
39
40
|
require 'manageiq/appliance_console/logfile_configuration'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manageiq-appliance_console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ManageIQ Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -346,6 +346,7 @@ files:
|
|
346
346
|
- ".travis.yml"
|
347
347
|
- ".whitesource"
|
348
348
|
- ".yamllint"
|
349
|
+
- CHANGELOG.md
|
349
350
|
- Gemfile
|
350
351
|
- LICENSE.txt
|
351
352
|
- README.md
|
@@ -363,6 +364,7 @@ files:
|
|
363
364
|
- lib/manageiq/appliance_console/database_replication_primary.rb
|
364
365
|
- lib/manageiq/appliance_console/database_replication_standby.rb
|
365
366
|
- lib/manageiq/appliance_console/errors.rb
|
367
|
+
- lib/manageiq/appliance_console/evm_server.rb
|
366
368
|
- lib/manageiq/appliance_console/external_auth_options.rb
|
367
369
|
- lib/manageiq/appliance_console/external_database_configuration.rb
|
368
370
|
- lib/manageiq/appliance_console/external_httpd_authentication.rb
|
@@ -410,7 +412,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
410
412
|
- !ruby/object:Gem::Version
|
411
413
|
version: '0'
|
412
414
|
requirements: []
|
413
|
-
rubygems_version: 3.
|
415
|
+
rubygems_version: 3.3.15
|
414
416
|
signing_key:
|
415
417
|
specification_version: 4
|
416
418
|
summary: ManageIQ Appliance Console
|