Class: ActivePostgres::Components::Core
- Inherits:
-
Base
- Object
- Base
- ActivePostgres::Components::Core
show all
- Defined in:
- lib/active_postgres/components/core.rb
Instance Attribute Summary
Attributes inherited from Base
#config, #secrets, #ssh_executor
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#create_application_users ⇒ Object
Public method to create application users - called after repmgr setup This is done after repmgr to avoid being wiped by cluster recreation
45
46
47
48
49
50
|
# File 'lib/active_postgres/components/core.rb', line 45
def create_application_users
return unless config.app_user && config.app_database
puts "\nš Creating application users and databases..."
create_app_user_and_database(config.primary_host)
end
|
#install ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/active_postgres/components/core.rb', line 4
def install
puts 'Installing PostgreSQL core...'
install_on_host(config.primary_host, is_primary: true)
config.standby_hosts.each do |host|
if config.component_enabled?(:repmgr)
if cluster_exists?(host)
update_configs_on_host(host)
else
install_packages_only(host)
end
else
install_on_host(host, is_primary: false)
end
end
end
|
#install_packages_only(host) ⇒ Object
52
53
54
55
|
# File 'lib/active_postgres/components/core.rb', line 52
def install_packages_only(host)
puts " Installing packages on #{host} (cluster will be created by repmgr)..."
ssh_executor.install_postgres(host, config.version)
end
|
#restart ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/active_postgres/components/core.rb', line 34
def restart
puts 'Restarting PostgreSQL...'
config.all_hosts.each do |host|
ssh_executor.restart_postgres(host, config.version)
end
end
|
#uninstall ⇒ Object
30
31
32
|
# File 'lib/active_postgres/components/core.rb', line 30
def uninstall
puts 'Uninstalling PostgreSQL is not recommended and must be done manually.'
end
|