Skip to content

Commit fb22405

Browse files
committed
Update Fedora initdb commands
Signed-off-by: Dan Webb <[email protected]>
1 parent 259bc83 commit fb22405

File tree

19 files changed

+50
-64
lines changed

19 files changed

+50
-64
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ jobs:
2929
- "amazonlinux-2023"
3030
- "debian-11"
3131
- "debian-12"
32-
- "fedora-latest"
3332
- "ubuntu-2204"
3433
- "ubuntu-2404"
3534
suite:

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ This file is used to list changes made in the last 3 major versions of the postg
44

55
## Unreleased
66

7+
- Remove support for Fedora
8+
Fedora is not an officially supported platform by the Sous Chefs community. If you would like to see Fedora support added back please open a PR to add it back.
9+
The installtion methods for Fedora are substantially different than other platforms and require a lot of additional testing and maintenance.
10+
- Add testing for PostgreSQL 16 and 17
11+
- Add libpq package to default packages
12+
- Fix GPG key URLs
13+
- Update Amazon to Amazonlinux 2023
14+
- Remove unspoorted configuration options from the `postgresql_config` resource
15+
`stats_temp_directory`
16+
717
## 11.11.2 - *2024-10-07*
818

919
Standardise files with files in sous-chefs/repo-management
@@ -301,7 +311,7 @@ Standardise files with files in sous-chefs/repo-management
301311

302312
- Allow to install extensions with hyphens, ex: `postgresql_extension '"uuid-ossp"'`
303313
- Update Circle CI config to match sous-chefs defaults #617
304-
- Remove Fedora testing from CI, not an official supported OS by sous-chefs, PR welcome #617
314+
- Remove Fedora testing from CI, not an official supported OS by sous-chefs, PRs welcome #617
305315

306316
## v7.1.4 (2019-03-28)
307317

documentation/postgresql_ident.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ postgresql_access 'local_foo_user' do
6060
database 'all'
6161
user 'foo'
6262
address '127.0.0.1/32'
63-
auth_method 'md5'
63+
auth_method 'scram-sha-256'
6464
end
6565
```
6666

kitchen.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ platforms:
2323
- name: amazonlinux-2023
2424
- name: debian-11
2525
- name: debian-12
26-
- name: fedora-latest
2726
- name: ubuntu-22.04
2827
- name: ubuntu-24.04
2928

libraries/helpers.rb

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def installed_postgresql_package_source
6767

6868
def data_dir(version: installed_postgresql_major_version, source: installed_postgresql_package_source)
6969
case node['platform_family']
70-
when 'rhel', 'fedora', 'amazon'
70+
when 'rhel', 'amazon'
7171
source.eql?(:repo) ? "/var/lib/pgsql/#{version}/data" : '/var/lib/pgsql/data'
7272
when 'debian'
7373
"/var/lib/postgresql/#{version}/main"
@@ -76,7 +76,7 @@ def data_dir(version: installed_postgresql_major_version, source: installed_post
7676

7777
def conf_dir(version: installed_postgresql_major_version, source: installed_postgresql_package_source)
7878
case node['platform_family']
79-
when 'rhel', 'fedora', 'amazon'
79+
when 'rhel', 'amazon'
8080
source.eql?(:repo) ? "/var/lib/pgsql/#{version}/data" : '/var/lib/pgsql/data'
8181
when 'debian'
8282
"/etc/postgresql/#{version}/main"
@@ -85,7 +85,7 @@ def conf_dir(version: installed_postgresql_major_version, source: installed_post
8585

8686
# determine the platform specific service name
8787
def default_platform_service_name(version: installed_postgresql_major_version, source: installed_postgresql_package_source)
88-
if platform_family?('rhel', 'fedora', 'amazon') && source.eql?(:repo)
88+
if platform_family?('rhel', 'amazon') && source.eql?(:repo)
8989
"postgresql-#{version}"
9090
else
9191
'postgresql'
@@ -110,7 +110,7 @@ def secure_random
110110

111111
def default_server_packages(version: nil, source: :os)
112112
case node['platform_family']
113-
when 'rhel', 'fedora'
113+
when 'rhel'
114114
{
115115
os: %w(libpq postgresql-contrib postgresql-server),
116116
repo: %W(postgresql#{version.delete('.')}-contrib postgresql#{version.delete('.')}-server),
@@ -130,7 +130,7 @@ def default_server_packages(version: nil, source: :os)
130130

131131
def default_client_packages(version: nil, source: :os)
132132
case node['platform_family']
133-
when 'rhel', 'fedora'
133+
when 'rhel'
134134
{
135135
os: %w(postgresql),
136136
repo: %W(postgresql#{version.delete('.')}),
@@ -151,18 +151,16 @@ def default_client_packages(version: nil, source: :os)
151151
def default_yum_gpg_key_uri
152152
if platform_family?('rhel') && node['platform_version'].to_i == 7
153153
'https://download.postgresql.org/pub/repos/yum/keys/PGDG-RPM-GPG-KEY-RHEL7'
154-
elsif platform_family?('fedora')
155-
'https://download.postgresql.org/pub/repos/yum/keys/PGDG-KEY-fedora'
156154
else
157155
'https://download.postgresql.org/pub/repos/yum/keys/PGDG-RPM-GPG-KEY-RHEL'
158156
end
159157
end
160158

161159
def dnf_module_platform?
162-
(platform_family?('rhel') && node['platform_version'].to_i == 8) || platform_family?('fedora')
160+
(platform_family?('rhel') && node['platform_version'].to_i == 8)
163161
end
164162

165-
# determine the appropriate DB init command to run based on RHEL/Fedora/Amazon release
163+
# determine the appropriate DB init command to run based on RHEL/Amazon release
166164
# initdb defaults to the execution environment.
167165
# https://www.postgresql.org/docs/9.5/static/locale.html
168166
def rhel_init_db_command(new_resource)
@@ -175,38 +173,25 @@ def rhel_init_db_command(new_resource)
175173

176174
# Given the base URL build the complete URL string for a yum repo
177175
def yum_repo_url(base_url)
178-
"#{base_url}/#{new_resource.version}/#{yum_repo_platform_family_string}/#{yum_repo_platform_string}"
176+
"#{base_url}/#{new_resource.version}/redhat/#{yum_repo_platform_string}"
179177
end
180178

181179
# Given the base URL build the complete URL string for a yum repo
182180
def yum_common_repo_url
183-
"https://download.postgresql.org/pub/repos/yum/common/#{yum_repo_platform_family_string}/#{yum_repo_platform_string}"
184-
end
185-
186-
# The postgresql yum repos URLs are organized into redhat and fedora directories.s
187-
# route things to the right place based on platform_family
188-
def yum_repo_platform_family_string
189-
platform_family?('fedora') ? 'fedora' : 'redhat'
181+
"https://download.postgresql.org/pub/repos/yum/common/redhat/#{yum_repo_platform_string}"
190182
end
191183

192184
# Build the platform string that makes up the final component of the yum repo URL
193185
def yum_repo_platform_string
194-
platform = platform?('fedora') ? 'fedora' : 'rhel'
195186
release = platform?('amazon') ? '8' : '$releasever'
196-
"#{platform}-#{release}-$basearch"
187+
"rhel-#{release}-$basearch"
197188
end
198189

199190
# On Amazon use the RHEL 8 packages. Otherwise use the releasever yum variable
200191
def yum_releasever
201192
platform?('amazon') ? '8' : '$releasever'
202193
end
203194

204-
# Fedora doesn't seem to know the right symbols for psql
205-
def psql_environment
206-
return {} unless platform?('fedora')
207-
{ LD_LIBRARY_PATH: '/usr/lib64' }
208-
end
209-
210195
# Generate a password if the value is set to generate.
211196
def postgres_password(new_resource)
212197
new_resource.password == 'generate' ? secure_random : new_resource.password

libraries/sql/_connection.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module Connection
2929

3030
def postgresql_devel_pkg_name(version: installed_postgresql_major_version, source: installed_postgresql_package_source)
3131
case node['platform_family']
32-
when 'rhel', 'fedora'
32+
when 'rhel'
3333
source.eql?(:repo) ? "postgresql#{version}-devel" : 'postgresql-devel'
3434
when 'debian'
3535
'libpq-dev'
@@ -40,7 +40,7 @@ def postgresql_devel_pkg_name(version: installed_postgresql_major_version, sourc
4040

4141
def postgresql_devel_path(suffix = nil, version: installed_postgresql_major_version)
4242
path = case node['platform_family']
43-
when 'rhel', 'fedora', 'amazon'
43+
when 'rhel', 'amazon'
4444
"/usr/pgsql-#{version}"
4545
when 'debian'
4646
'/usr/include/postgresql'
@@ -55,7 +55,7 @@ def postgresql_devel_path(suffix = nil, version: installed_postgresql_major_vers
5555

5656
def pg_gem_build_options
5757
case node['platform_family']
58-
when 'rhel', 'fedora', 'amazon'
58+
when 'rhel', 'amazon'
5959
"-- --with-pg-include=#{postgresql_devel_path('include')} --with-pg-lib=#{postgresql_devel_path('lib')}"
6060
when 'debian'
6161
"-- --with-pg-include=#{postgresql_devel_path} --with-pg-lib=#{postgresql_devel_path}"
@@ -75,8 +75,6 @@ def install_pg_gem
7575
end
7676

7777
case node['platform_family']
78-
when 'fedora'
79-
declare_resource(:package, libpq_package_name) { compile_time(true) }
8078
when 'rhel'
8179
case node['platform_version'].to_i
8280
when 7

metadata.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
supports 'amazon'
1717
supports 'centos'
1818
supports 'debian'
19-
supports 'fedora'
2019
supports 'oracle'
2120
supports 'redhat'
2221
supports 'scientific'

resources/install.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ def install_method_repo?
9797

9898
def do_repository_action(repo_action)
9999
case node['platform_family']
100-
when 'rhel', 'fedora', 'amazon'
100+
when 'rhel', 'amazon'
101+
# Disable the PostgreSQL module if we're on RHEL 8
101102
dnf_module 'postgresql' do
102103
action :disable
103104
end if dnf_module_platform?
@@ -268,7 +269,7 @@ def do_server_package_action(package_action)
268269
end
269270

270271
action :init_server do
271-
return if initialized? || !platform_family?('rhel', 'fedora', 'amazon')
272+
return if initialized? || !platform_family?('rhel', 'amazon')
272273

273274
converge_by('Init PostgreSQL') do
274275
execute 'init_db' do

templates/default/createcluster.conf.erb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ ssl = on
3333
# Show cluster name in process title
3434
cluster_name = '%v/%c'
3535

36-
# Put stats_temp_directory on tmpfs
37-
stats_temp_directory = '/var/run/postgresql/%v-%c.pg_stat_tmp'
38-
3936
# Add prefix to log lines
4037
log_line_prefix = '%%m [%%p] %%q%%u@%%d '
4138

test/cookbooks/test/recipes/access.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
database 'all'
1010
user 'postgres'
1111
address '127.0.0.1/32'
12-
auth_method 'md5'
12+
auth_method 'scram-sha-256'
1313
end
1414

1515
postgresql_service 'postgresql' do
@@ -45,7 +45,7 @@
4545
type 'host'
4646
database 'all'
4747
user 'sous_chef'
48-
auth_method 'md5'
48+
auth_method 'scram-sha-256'
4949
address '127.0.0.1/32'
5050
position 5
5151

@@ -74,7 +74,7 @@
7474
type 'host'
7575
database 'all'
7676
user 'hostname_user'
77-
auth_method 'md5'
77+
auth_method 'scram-sha-256'
7878
address 'host.domain'
7979

8080
notifies :restart, 'postgresql_service[postgresql]', :delayed
@@ -84,7 +84,7 @@
8484
type 'host'
8585
database 'all'
8686
user 'hostname.user'
87-
auth_method 'md5'
87+
auth_method 'scram-sha-256'
8888
address 'host.domain'
8989

9090
notifies :restart, 'postgresql_service[postgresql]', :delayed
@@ -94,7 +94,7 @@
9494
type 'host'
9595
database 'my_database'
9696
user 'hostname.user'
97-
auth_method 'md5'
97+
auth_method 'scram-sha-256'
9898
address 'host.domain'
9999

100100
notifies :restart, 'postgresql_service[postgresql]', :delayed
@@ -104,7 +104,7 @@
104104
type 'host'
105105
database 'my_database'
106106
user 'hostname.user'
107-
auth_method 'md5'
107+
auth_method 'scram-sha-256'
108108
address 'a.very.long.host.domain.that.exceeds.the.max.of.24.characters'
109109

110110
notifies :restart, 'postgresql_service[postgresql]', :delayed
@@ -135,5 +135,5 @@
135135
database 'foo,bar'
136136
user 'john,doe'
137137
address '127.0.0.1/32'
138-
auth_method 'md5'
138+
auth_method 'scram-sha-256'
139139
end

0 commit comments

Comments
 (0)