manageiq-appliance_console 7.1.1 → 7.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/appliance_console +0 -2
- data/lib/manageiq/appliance_console/database_replication.rb +43 -14
- data/lib/manageiq/appliance_console/database_replication_standby.rb +2 -3
- data/lib/manageiq/appliance_console/message_configuration.rb +7 -11
- data/lib/manageiq/appliance_console/message_configuration_server.rb +5 -0
- data/lib/manageiq/appliance_console/postgres_admin.rb +8 -3
- data/lib/manageiq/appliance_console/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81ef1030034c190aa4fc241853afd0f5e40395b4fd8d94b9c0782253462c8d71
|
4
|
+
data.tar.gz: 28d2102f5ff3b9248db6856b2da027b8562f0481292f7d28ddbae3ce91fb4f21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e563cc050899e2b62e8bc3546664d3c28c3abbb0979328fa0125c4e38ef9910553f938a317d144238205c2c76e98dc3de7ef963e3ac8e80f7f8761cc117fe0c
|
7
|
+
data.tar.gz: 524948a3576e46b19de0fb94f1248d16805e4d4dec94b5e29730e72065dd266edad5f76db73b94165c33b7de289208421e8d153a0cf24a013c1064452e9b834c
|
data/bin/appliance_console
CHANGED
@@ -431,7 +431,6 @@ Static Network Configuration
|
|
431
431
|
raise MiqSignalError
|
432
432
|
elsif message_server.ask_questions && message_server.configure
|
433
433
|
say("\nMessage Server configured successfully.\n")
|
434
|
-
press_any_key
|
435
434
|
else
|
436
435
|
say("\nMessage Server configuration failed!\n")
|
437
436
|
press_any_key
|
@@ -448,7 +447,6 @@ Static Network Configuration
|
|
448
447
|
raise MiqSignalError
|
449
448
|
elsif message_client.ask_questions && message_client.configure
|
450
449
|
say("\nMessage Client configured successfully.\n")
|
451
|
-
press_any_key
|
452
450
|
else
|
453
451
|
say("\nMessage Client configuration failed!\n")
|
454
452
|
press_any_key
|
@@ -7,11 +7,20 @@ 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
|
12
10
|
PGPASS_FILE = '/var/lib/pgsql/.pgpass'.freeze
|
13
11
|
NETWORK_INTERFACE = 'eth0'.freeze
|
14
12
|
|
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
|
+
|
15
24
|
attr_accessor :node_number, :database_name, :database_user,
|
16
25
|
:database_password, :primary_host
|
17
26
|
|
@@ -37,33 +46,53 @@ Replication Server Configuration
|
|
37
46
|
EOL
|
38
47
|
end
|
39
48
|
|
40
|
-
def
|
41
|
-
|
49
|
+
def self.repmgr_config
|
50
|
+
repmgr_file_locations["config"]
|
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]
|
42
59
|
end
|
43
60
|
|
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
|
+
|
44
71
|
def confirm_reconfiguration
|
45
|
-
say("Warning: File #{
|
46
|
-
logger.warn("Warning: File #{
|
72
|
+
say("Warning: File #{repmgr_config} exists. Replication is already configured")
|
73
|
+
logger.warn("Warning: File #{repmgr_config} exists. Replication is already configured")
|
47
74
|
agree("Continue with configuration? (Y/N): ")
|
48
75
|
end
|
49
76
|
|
50
77
|
def create_config_file(host)
|
51
|
-
File.write(
|
78
|
+
File.write(repmgr_config, config_file_contents(host))
|
52
79
|
true
|
53
80
|
end
|
54
81
|
|
55
82
|
def config_file_contents(host)
|
56
83
|
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
|
57
86
|
<<-EOS.strip_heredoc
|
58
|
-
node_id
|
59
|
-
node_name
|
87
|
+
node_id='#{node_number}'
|
88
|
+
node_name='#{host}'
|
60
89
|
conninfo='host=#{host} user=#{database_user} dbname=#{database_name}'
|
61
|
-
use_replication_slots=1
|
90
|
+
use_replication_slots='1'
|
62
91
|
pg_basebackup_options='--wal-method=stream'
|
63
|
-
failover=automatic
|
64
|
-
promote_command='repmgr standby promote -f #{
|
65
|
-
follow_command='repmgr standby follow -f #{
|
66
|
-
log_file
|
92
|
+
failover='automatic'
|
93
|
+
promote_command='repmgr standby promote -f #{repmgr_config} --log-to-file'
|
94
|
+
follow_command='repmgr standby follow -f #{repmgr_config} --log-to-file --upstream-node-id=%n'
|
95
|
+
log_file='#{repmgr_log}'
|
67
96
|
service_start_command='sudo systemctl start #{service_name}'
|
68
97
|
service_stop_command='sudo systemctl stop #{service_name}'
|
69
98
|
service_restart_command='sudo systemctl restart #{service_name}'
|
@@ -8,7 +8,6 @@ module ApplianceConsole
|
|
8
8
|
include ManageIQ::ApplianceConsole::Logging
|
9
9
|
|
10
10
|
REGISTER_CMD = 'repmgr standby register'.freeze
|
11
|
-
REPMGRD_SERVICE = 'repmgr10'.freeze
|
12
11
|
|
13
12
|
attr_accessor :disk, :standby_host, :run_repmgrd_configuration, :resync_data, :force_register
|
14
13
|
|
@@ -111,7 +110,7 @@ module ApplianceConsole
|
|
111
110
|
end
|
112
111
|
|
113
112
|
def start_repmgrd
|
114
|
-
LinuxAdmin::Service.new(
|
113
|
+
LinuxAdmin::Service.new(repmgr_service_name).enable.start
|
115
114
|
true
|
116
115
|
rescue AwesomeSpawn::CommandResultError => e
|
117
116
|
message = "Failed to start repmgrd: #{e.message}"
|
@@ -121,7 +120,7 @@ module ApplianceConsole
|
|
121
120
|
end
|
122
121
|
|
123
122
|
def stop_repmgrd
|
124
|
-
LinuxAdmin::Service.new(
|
123
|
+
LinuxAdmin::Service.new(repmgr_service_name).stop
|
125
124
|
true
|
126
125
|
end
|
127
126
|
|
@@ -108,20 +108,16 @@ module ManageIQ
|
|
108
108
|
|
109
109
|
messaging_yaml = YAML.load_file(messaging_yaml_sample_path)
|
110
110
|
|
111
|
-
messaging_yaml["production"]
|
112
|
-
messaging_yaml["production"]
|
113
|
-
|
114
|
-
messaging_yaml["production"]["
|
115
|
-
messaging_yaml["production"]["port"] = message_server_port
|
116
|
-
messaging_yaml["production"]["sasl.mechanism"] = "PLAIN"
|
117
|
-
messaging_yaml["production"]["sasl.username"] = message_keystore_username
|
118
|
-
messaging_yaml["production"]["sasl.password"] = ManageIQ::Password.try_encrypt(message_keystore_password)
|
111
|
+
messaging_yaml["production"]["host"] = message_server_host
|
112
|
+
messaging_yaml["production"]["port"] = message_server_port
|
113
|
+
messaging_yaml["production"]["username"] = message_keystore_username
|
114
|
+
messaging_yaml["production"]["password"] = ManageIQ::Password.try_encrypt(message_keystore_password)
|
119
115
|
|
120
116
|
if secure?
|
121
|
-
messaging_yaml["production"]["
|
122
|
-
messaging_yaml["production"]["
|
117
|
+
messaging_yaml["production"]["ssl"] = true
|
118
|
+
messaging_yaml["production"]["ca_file"] = ca_cert_path.to_path
|
123
119
|
else
|
124
|
-
messaging_yaml["production"]["
|
120
|
+
messaging_yaml["production"]["ssl"] = false
|
125
121
|
end
|
126
122
|
|
127
123
|
File.open(messaging_yaml_path, "w") do |f|
|
@@ -72,6 +72,11 @@ module ManageIQ
|
|
72
72
|
say("\nMessage Server Parameters:\n\n")
|
73
73
|
|
74
74
|
@message_server_host = ask_for_string("Message Server Hostname or IP address", message_server_host)
|
75
|
+
|
76
|
+
# SSL Validation for Kafka does not work for hostnames containing "localhost"
|
77
|
+
# Therefore we replace with the equivalent IP "127.0.0.1" if a /localhost*/ hostname was entered
|
78
|
+
@message_server_host = "127.0.0.1" if @message_server_host.include?("localhost")
|
79
|
+
|
75
80
|
@message_keystore_username = ask_for_string("Message Keystore Username", message_keystore_username)
|
76
81
|
@message_keystore_password = ask_for_password("Message Keystore Password")
|
77
82
|
@message_persistent_disk = ask_for_persistent_disk
|
@@ -62,13 +62,18 @@ module ApplianceConsole
|
|
62
62
|
LinuxAdmin::Service.new(service_name).running?
|
63
63
|
end
|
64
64
|
|
65
|
-
def self.
|
66
|
-
|
65
|
+
def self.local_server_received_standby_signal?
|
66
|
+
# Beginning with PostgreSQL 12, replication configuration has been integrated into the main PostgreSQL configuraton system and the conventional recovery.conf file is no longer valid.
|
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?
|
67
72
|
end
|
68
73
|
|
69
74
|
def self.local_server_status
|
70
75
|
if service_running?
|
71
|
-
"running (#{
|
76
|
+
"running (#{local_server_received_standby_signal? ? "standby" : "primary"})"
|
72
77
|
elsif initialized?
|
73
78
|
"initialized and stopped"
|
74
79
|
else
|
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: 7.
|
4
|
+
version: 7.2.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: 2022-
|
11
|
+
date: 2022-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -410,7 +410,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
410
410
|
- !ruby/object:Gem::Version
|
411
411
|
version: '0'
|
412
412
|
requirements: []
|
413
|
-
rubygems_version: 3.3.
|
413
|
+
rubygems_version: 3.3.15
|
414
414
|
signing_key:
|
415
415
|
specification_version: 4
|
416
416
|
summary: ManageIQ Appliance Console
|