Merge pull request 'Fix PostgreSQL replica config with encrypted data directory' (#179) from bugfix/postgres_issues into master
This commit is contained in:
commit
81403b7cb9
@ -12,16 +12,18 @@
|
|||||||
"hostname": "centaurus",
|
"hostname": "centaurus",
|
||||||
"ipaddress": "78.46.59.98",
|
"ipaddress": "78.46.59.98",
|
||||||
"roles": [
|
"roles": [
|
||||||
"postgresql_replica",
|
"gitea",
|
||||||
"gitea"
|
"postgresql_replica"
|
||||||
],
|
],
|
||||||
"recipes": [
|
"recipes": [
|
||||||
"kosmos-base",
|
"kosmos-base",
|
||||||
"kosmos-base::default",
|
"kosmos-base::default",
|
||||||
"kosmos-postgresql::replica",
|
"kosmos_encfs",
|
||||||
|
"kosmos_encfs::default",
|
||||||
"kosmos_gitea",
|
"kosmos_gitea",
|
||||||
"kosmos_gitea::default",
|
"kosmos_gitea::default",
|
||||||
"kosmos_gitea::backup",
|
"kosmos_gitea::backup",
|
||||||
|
"kosmos-postgresql::replica",
|
||||||
"apt::default",
|
"apt::default",
|
||||||
"timezone_iii::default",
|
"timezone_iii::default",
|
||||||
"timezone_iii::debian",
|
"timezone_iii::debian",
|
||||||
@ -35,8 +37,6 @@
|
|||||||
"postfix::_attributes",
|
"postfix::_attributes",
|
||||||
"postfix::sasl_auth",
|
"postfix::sasl_auth",
|
||||||
"hostname::default",
|
"hostname::default",
|
||||||
"firewall::default",
|
|
||||||
"chef-sugar::default",
|
|
||||||
"kosmos-nginx::default",
|
"kosmos-nginx::default",
|
||||||
"nginx::default",
|
"nginx::default",
|
||||||
"nginx::package",
|
"nginx::package",
|
||||||
@ -46,10 +46,12 @@
|
|||||||
"nginx::commons_dir",
|
"nginx::commons_dir",
|
||||||
"nginx::commons_script",
|
"nginx::commons_script",
|
||||||
"nginx::commons_conf",
|
"nginx::commons_conf",
|
||||||
|
"firewall::default",
|
||||||
|
"chef-sugar::default",
|
||||||
"backup::default",
|
"backup::default",
|
||||||
"logrotate::default",
|
"logrotate::default",
|
||||||
"build-essential::default",
|
"kosmos-base::letsencrypt",
|
||||||
"kosmos-base::letsencrypt"
|
"build-essential::default"
|
||||||
],
|
],
|
||||||
"platform": "ubuntu",
|
"platform": "ubuntu",
|
||||||
"platform_version": "18.04",
|
"platform_version": "18.04",
|
||||||
@ -67,7 +69,8 @@
|
|||||||
},
|
},
|
||||||
"run_list": [
|
"run_list": [
|
||||||
"recipe[kosmos-base]",
|
"recipe[kosmos-base]",
|
||||||
"role[postgresql_replica]",
|
"recipe[kosmos_encfs]",
|
||||||
"role[gitea]"
|
"role[gitea]",
|
||||||
|
"role[postgresql_replica]"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -33,7 +33,6 @@ end
|
|||||||
|
|
||||||
service postgresql_service do
|
service postgresql_service do
|
||||||
supports restart: true, status: true, reload: true
|
supports restart: true, status: true, reload: true
|
||||||
action [:enable]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
postgresql_data_bag_item = data_bag_item('credentials', 'postgresql')
|
postgresql_data_bag_item = data_bag_item('credentials', 'postgresql')
|
||||||
@ -41,7 +40,7 @@ postgresql_data_bag_item = data_bag_item('credentials', 'postgresql')
|
|||||||
primary = postgresql_primary
|
primary = postgresql_primary
|
||||||
|
|
||||||
unless primary.nil?
|
unless primary.nil?
|
||||||
postgresql_data_dir = "/var/lib/postgresql/#{postgresql_version}/main"
|
postgresql_data_dir = "#{node["kosmos_encfs"]["data_directory"]}/postgresql/#{postgresql_version}/main"
|
||||||
|
|
||||||
if node['kosmos-postgresql']['ready_to_set_up_replica']
|
if node['kosmos-postgresql']['ready_to_set_up_replica']
|
||||||
execute "set up replication" do
|
execute "set up replication" do
|
||||||
|
@ -64,8 +64,7 @@ action :create do
|
|||||||
unix_socket_directories: "/var/run/postgresql",
|
unix_socket_directories: "/var/run/postgresql",
|
||||||
dynamic_shared_memory_type: "posix",
|
dynamic_shared_memory_type: "posix",
|
||||||
timezone: "UTC", # default is GMT
|
timezone: "UTC", # default is GMT
|
||||||
listen_addresses: "0.0.0.0",
|
listen_addresses: "0.0.0.0"
|
||||||
data_directory: postgresql_data_dir
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if new_resource.role == "replica"
|
if new_resource.role == "replica"
|
||||||
@ -101,6 +100,7 @@ action :create do
|
|||||||
|
|
||||||
postgresql_server_conf "main" do
|
postgresql_server_conf "main" do
|
||||||
version postgresql_version
|
version postgresql_version
|
||||||
|
data_directory postgresql_data_dir
|
||||||
additional_config additional_config
|
additional_config additional_config
|
||||||
notifies :reload, "service[#{postgresql_service}]", :delayed
|
notifies :reload, "service[#{postgresql_service}]", :delayed
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user