Skip to content

Fixes #31834: Ensure PostgreSQL 12 is enabled on EL8#646

Closed
ehelms wants to merge 1 commit into
theforeman:developfrom
ehelms:fixes-31834
Closed

Fixes #31834: Ensure PostgreSQL 12 is enabled on EL8#646
ehelms wants to merge 1 commit into
theforeman:developfrom
ehelms:fixes-31834

Conversation

@ehelms

@ehelms ehelms commented Feb 8, 2021

Copy link
Copy Markdown
Member

I was not sure if I should try to code up the steps to upgrade Foreman EL8 existing databases or leave that to the docs. The steps are effectively:

# ensure enough disk space on /var/lib/pgsql for twice the size of /var/lib/pgsql/data

systemctl stop postgresql foreman dynflow\*
mv /var/lib/pgsql/data /var/lib/pgsql/data-old
sed -i "s/\/var\/lib\/pgsql\/data/\/var\/lib\/pgsql\/data-old/g" data-old/postgresql.conf

dnf -y module remove postgresql-server
dnf -y module reset postgresql
dnf -y module enable postgresql:12
dnf -y install postgresql-server postgresql-upgrade

sudo -u postgres pg_upgrade --old-bindir /usr/lib64/pgsql/postgresql-10/bin --new-bindir /bin --old-datadir /var/lib/pgsql/data-old/ --new-datadir /var/lib/pgsql/data

Comment thread hooks/pre/40-el8_modules.rb Outdated
if local_postgresql? && el8?
postgres_version, success = execute_command('postgres --version', false, true)

if success && !postgres_version.include?('12.')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

PG 13 is also out and I wouldn't be surprised if someone used it at some point. They may be annoyed that it forces them to downgrade.

Another thing to consider is users who use packages from postgresql.org. https://www.postgresql.org/download/linux/redhat/ suggests it installs as postgresql$VERSION-server (so postgesql12-server). Not sure if they'll show up and if so, how but we have seen community users who use them.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hrmm, sounds like you are saying I should just limit this to Katello and leave Foreman alone since it can be in a wide variety of states.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I recall that user of postgresql.org was running Katello and ran into problems because of the evr package.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Externally or local?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That was quite a bit ago. And I feel like Katello has traditionally supported PG that comes with the OS to reduce support burden and matrix. We did this on EL7 through the use of the SCL as well. I have simplified this PR to just do this for the Katello scenario.

@ekohl ekohl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I really doubt that this will work.

Comment thread hooks/pre/40-el8_modules.rb Outdated
@ehelms

ehelms commented Feb 15, 2021

Copy link
Copy Markdown
Member Author

This now uses the dnfprovider for the package type through Puppet which is available as of 6.15.0 and 5.5.20 per https://tickets.puppetlabs.com/browse/PUP-10235

Comment thread hooks/pre/40-el8_modules.rb Outdated
ensure_dnf_module('pki-core', '10.6')

if local_postgresql?
ensure_dnf_module('postgresql', '12')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I can take a look at if we can solve this in puppetlabs-postgresql as a long term solution.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Could be nice there long term, I dont see modules going away.

@@ -0,0 +1,7 @@
if (module_enabled?('katello') || module_enabled?('foreman_proxy_content')) && el8?
ensure_dnf_module('pki-core', 'present')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I started with theforeman/puppet-candlepin#175. We've observed that starting Puppet typically adds a few seconds so I'd prefer to solve it as part of the main loop.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This blocks Katello so we need to get any changes and release ASAP.

@ekohl ekohl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've submitted #650 which I believe is a more correct approach. It doesn't deal with upgrades yet, but IMHO it's the right long term implementation.

@ehelms

ehelms commented Feb 16, 2021

Copy link
Copy Markdown
Member Author

#650 doesnt look like it will work for a release branch which we need this change on, so will we merge this change, cherry pick it and then pick up the long term fixes as they get released?

@ekohl

ekohl commented Feb 16, 2021

Copy link
Copy Markdown
Member

Summarizing an offline discussion:

  • Enable pki-core module on EL8 puppet-candlepin#175 should be turned into a release and included in 2.4
  • PostgreSQL 12 is not a blocker for RC1 but is something we want to fix prior to GA so there are no Katello users on PostgreSQL 10.
  • For PG 10 users (existing Foreman on EL8) we need to look into a strategy. It is likely we will make this an upgrade note that users need to upgrade prior to upgrading to Foreman 2.4 on EL8.

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.

3 participants