Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(SERVER-2500) Use DNF modules to install postgres on RHEL 8 #337

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Magisus
Copy link

@Magisus Magisus commented Oct 5, 2021

The postgresql module added support for DNF modules to install postgres
at specific versions on RHEL 8. However in order to install a
non-default version, like we need to test Puppet Platform 6, which
only supports Postgres 9.6, manage_dnf_module must be set to true for
the puppetlabs-postgresql module. This commit ensures that mode is set
when isntalling on RHEL 8.

Note that when the default version is being installed (postgres 10 on
RHEL8), the code path that this flag opts into is already being used.

@Magisus Magisus requested a review from a team as a code owner October 5, 2021 01:10
@puppet-community-rangefinder
Copy link

puppetdb::database::postgresql is a class

that may have no external impact to Forge modules.

puppetdb::params is a class

that may have no external impact to Forge modules.

This module is declared in 33 of 578 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

@Magisus
Copy link
Author

Magisus commented Oct 5, 2021

For the postgresql module change, see puppetlabs/puppetlabs-postgresql#1239.

This resolves the following issue seen when trying to enable install PDB with this module on RHEL 8 in our acceptance tests:

Error: Execution of '/usr/bin/dnf -d 0 -e 1 -y install postgresql96-server' returned 1: Error: Unable to find a match

This is because the package string is invalid for dnf version selection, we need to be using the top branch in this conditional. When using the module with this change, after install PDB, I am able to see

=> postgres --version
postgres (PostgreSQL) 9.6.22

@Magisus
Copy link
Author

Magisus commented Oct 5, 2021

I wasn't sure if this should be exposed to users or not.

@Magisus Magisus force-pushed the postgres-install-el8 branch from c84fe30 to fb6133d Compare October 5, 2021 16:50
@Magisus
Copy link
Author

Magisus commented Oct 5, 2021

I tested this on 7.x and was surprised to see us still trying to install postgres 9.6 there... then I realized this module hasn't been released in a while, so we were not getting 3ea57a5. I think this is necessary even after that goes in, though, since we're still using a non-default version (11 instead of 10).

The postgresql module added support for DNF modules to install postgres
at specific versions on RHEL 8. However in order to install a
non-default version, like we need to test Puppet Platform 6, which
only supports Postgres 9.6, `manage_dnf_module` must be set to true for
the `puppetlabs-postgresql` module. This commit ensures that mode is set
when isntalling on RHEL 8.

Note that when the default version is being installed (postgres 10 on
RHEL8), the code path that this flag opts into is already being used.
@Magisus Magisus force-pushed the postgres-install-el8 branch from fb6133d to ff5eb97 Compare October 5, 2021 23:07
@Magisus
Copy link
Author

Magisus commented Oct 5, 2021

On further investigation, I think this may not be what we want. DNF modules can't be used to install Postgres 11, which means with this change we are even more broken in Puppet 7 land.

It seems what we really want is something that follows these instructions:

# Install the repository RPM:
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# Disable the built-in PostgreSQL module:
sudo dnf -qy module disable postgresql

# Install PostgreSQL:
sudo dnf install -y postgresql11-server

Not sure yet if there's a way to force the postgresql module to do that.

@bschonec
Copy link

I'm returning to the world of Puppet after a four year break. Is there any reason this project is tied to Postgresql 9.6 and 11? I've installed PSQL 10, 11 and 12 and (so far) haven't had any issues.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@jhoblitt
Copy link

psql 11 is EOL and 12 is the oldest version that we need to worry about supporting.

@@ -25,6 +25,12 @@
$manage_pg_repo = false
}

if $::osfamily =~ /RedHat/ and $facts['os']['release']['major'] == '8' {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed to check for either any version >= 8 or match EL8 & EL9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants