Compare commits

...

5 Commits

Author SHA1 Message Date
81403b7cb9 Merge pull request 'Fix PostgreSQL replica config with encrypted data directory' (#179) from bugfix/postgres_issues into master 2020-06-10 14:04:58 +00:00
Greg Karékinian
a0db6adaf2 Pass the data_directory to the postgresql_server_conf resource
Previously we were passing it as an additional config, but it is set by
default. The last value was used, the custom one, so the server still
used the correct file
2020-06-10 14:41:07 +02:00
Greg Karékinian
e3e726097f Do not enable the postgresql@12-main service
We want it to run only once the encrypted data directory has been
mounted
2020-06-10 14:41:07 +02:00
Greg Karékinian
dba6629869 Use the attribute from the encfs recipe for the data directory 2020-06-10 14:41:03 +02:00
Greg Karékinian
229e9cfbd2 Add the kosmos_encfs recipe to centaurus 2020-06-10 14:40:01 +02:00
3 changed files with 15 additions and 13 deletions

View File

@ -12,16 +12,18 @@
"hostname": "centaurus",
"ipaddress": "78.46.59.98",
"roles": [
"postgresql_replica",
"gitea"
"gitea",
"postgresql_replica"
],
"recipes": [
"kosmos-base",
"kosmos-base::default",
"kosmos-postgresql::replica",
"kosmos_encfs",
"kosmos_encfs::default",
"kosmos_gitea",
"kosmos_gitea::default",
"kosmos_gitea::backup",
"kosmos-postgresql::replica",
"apt::default",
"timezone_iii::default",
"timezone_iii::debian",
@ -35,8 +37,6 @@
"postfix::_attributes",
"postfix::sasl_auth",
"hostname::default",
"firewall::default",
"chef-sugar::default",
"kosmos-nginx::default",
"nginx::default",
"nginx::package",
@ -46,10 +46,12 @@
"nginx::commons_dir",
"nginx::commons_script",
"nginx::commons_conf",
"firewall::default",
"chef-sugar::default",
"backup::default",
"logrotate::default",
"build-essential::default",
"kosmos-base::letsencrypt"
"kosmos-base::letsencrypt",
"build-essential::default"
],
"platform": "ubuntu",
"platform_version": "18.04",
@ -67,7 +69,8 @@
},
"run_list": [
"recipe[kosmos-base]",
"role[postgresql_replica]",
"role[gitea]"
"recipe[kosmos_encfs]",
"role[gitea]",
"role[postgresql_replica]"
]
}

View File

@ -33,7 +33,6 @@ end
service postgresql_service do
supports restart: true, status: true, reload: true
action [:enable]
end
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
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']
execute "set up replication" do

View File

@ -64,8 +64,7 @@ action :create do
unix_socket_directories: "/var/run/postgresql",
dynamic_shared_memory_type: "posix",
timezone: "UTC", # default is GMT
listen_addresses: "0.0.0.0",
data_directory: postgresql_data_dir
listen_addresses: "0.0.0.0"
}
if new_resource.role == "replica"
@ -101,6 +100,7 @@ action :create do
postgresql_server_conf "main" do
version postgresql_version
data_directory postgresql_data_dir
additional_config additional_config
notifies :reload, "service[#{postgresql_service}]", :delayed
end