PostgreSQL installation

Hi,
I have installed Foreman 2.5 with Katello 4.1 install and I noticed that the postgresql is 12.
I wish to downsize the postgresql to 10.
Is there a way to do that and also is there any test after the downsizing so to make sure that it works.

Iā€™d strongly discourage you to do this. While it may technically work, nobody tests this combination.

On a technical level it means you need to make sure make the postgresql-evr extension available.

For EL7 we build an RPM for the rh-postgresql12 SCL but no other. Youā€™ll also need to change the installer answer for katello::params::postgresql_evr_package to the new package name if you donā€™t want that to pull in rh-postgresql12.

You may have more luck on EL8 where I think the same package can be used by both module version 10 and 12.

Again, nobody tests this and I may have forgotten things. If you take this route, expect it to cost you time in maintenance and really understand both packaging and the installer because you become the maintainer. Every upgrade becomes more complicated. For example, in the future we may upgrade to PostgreSQL version 13 and break your workarounds. Know what youā€™re starting with if you take this route.

1 Like

Hi ekohl

Where do i change the katello::params::postgresql_evr_package to the new package name

I was able to change the parameters under /usr/share/foreman-installer and started the command

foreman-installer --scenario katello

[root@foreman foreman-installer]# grep -iR postgresql10 ./*
./config/foreman.hiera/family/RedHat-7.yaml:postgresql::globals::client_package_name: rh-postgresql10-postgresql-syspaths
./config/foreman.hiera/family/RedHat-7.yaml:postgresql::globals::server_package_name: rh-postgresql10-postgresql-server-syspaths
./config/foreman.hiera/family/RedHat-7.yaml:postgresql::globals::contrib_package_name: rh-postgresql10-postgresql-contrib-syspaths
./config/foreman.hiera/family/RedHat-7.yaml:postgresql::globals::datadir: /var/opt/rh/rh-postgresql10/lib/pgsql/data
./config/foreman.hiera/family/RedHat-7.yaml:postgresql::globals::confdir: /var/opt/rh/rh-postgresql10/lib/pgsql/data
./hooks/boot/01-kafo-hook-extensions.rb: !File.exist?(ā€™/var/opt/rh/rh-postgresql10/lib/pgsql/dataā€™) && File.exist?(ā€™/var/lib/pgsql/dataā€™)
./hooks/pre/30-el7_upgrade_postgresql.rb: server_packages = [ā€˜rh-postgresql10-postgresql-serverā€™]
./hooks/pre/30-el7_upgrade_postgresql.rb: server_packages << ā€˜rh-postgresql10-postgresql-contribā€™
./hooks/pre/30-el7_upgrade_postgresql.rb: server_packages << ā€˜rh-postgresql10-postgresql-docsā€™
./hooks/pre/30-el7_upgrade_postgresql.rb: execute!(%(scl enable rh-postgresql10 ā€œPGSETUP_INITDB_OPTIONS=ā€™ā€“lc-collate=#{collate} --lc-ctype=#{ctype} --locale=#{collate}ā€™ postgresql-setup --upgradeā€))
./hooks/pre/30-el7_upgrade_postgresql.rb: ensure_packages([ā€˜rh-postgresql10-syspathsā€™], ā€˜installedā€™)
./hooks/pre/32-install_selinux_packages.rb: packages << ā€˜rh-postgresql10-postgresql-serverā€™ if local_postgresql?
./hooks/pre_validations/10-postgresql_checkpoint_segments.rb:SCL_POSTGRESQL_CONF = ā€˜/var/opt/rh/rh-postgresql10/lib/pgsql/data/postgresql.confā€™.freeze
./hooks/pre_validations/30-el7_upgrade_postgresql.rb: new_postgres_dir = ā€˜/var/opt/rh/rh-postgresql10/lib/pgsqlā€™
./katello-certs/hooks/boot/01-kafo-hook-extensions.rb: !File.exist?(ā€™/var/opt/rh/rh-postgresql10/lib/pgsql/dataā€™) && File.exist?(ā€™/var/lib/pgsql/dataā€™)
./modules/katello/manifests/globals.pp: $postgresql_evr_package = ā€˜rh-postgresql10-postgresql-evrā€™
[root@foreman foreman-installer]#

After making the above changes I ran the foreman-installer --scenario katello command and get the below error messages

cat /var/log/foreman-installer/katello.log |grep ERROR
2021-07-05 12:45:47 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
2021-07-05 12:51:06 [ERROR ] [configure] Execution of ā€˜/bin/yum -d 0 -e 0 -y install rh-postgresql10-postgresql-evrā€™ returned 1: Error: Nothing to do
2021-07-05 12:51:06 [ERROR ] [configure] /Stage[main]/Katello::Application/Package[rh-postgresql10-postgresql-evr]/ensure: change from ā€˜purgedā€™ to ā€˜presentā€™ failed: Execution of ā€˜/bin/yum -d 0 -e 0 -y install rh-postgresql10-postgresql-evrā€™ returned 1: Error: Nothing to do
2021-07-05 12:52:45 [INFO ] [configure] +log4j.logger.org.hibernate.internal.SessionImpl=ERROR
2021-07-05 12:56:36 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: PG::UndefinedFile: ERROR: could not open extension control file ā€œ/opt/rh/rh-postgresql10/root/usr/share/pgsql/extension/evr.controlā€: No such file or directory
2021-07-05 12:56:36 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: ActiveRecord::StatementInvalid: PG::UndefinedFile: ERROR: could not open extension control file ā€œ/opt/rh/rh-postgresql10/root/usr/share/pgsql/extension/evr.controlā€: No such file or directory
2021-07-05 12:56:36 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: PG::UndefinedFile: ERROR: could not open extension control file ā€œ/opt/rh/rh-postgresql10/root/usr/share/pgsql/extension/evr.controlā€: No such file or directory
2021-07-05 12:56:36 [ERROR ] [configure] ā€˜/usr/sbin/foreman-rake db:migrateā€™ returned 1 instead of one of [0]
2021-07-05 12:56:36 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: change from ā€˜notrunā€™ to [ā€˜0ā€™] failed: ā€˜/usr/sbin/foreman-rake db:migrateā€™ returned 1 instead of one of [0]
2021-07-05 12:58:16 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: PG::UndefinedFile: ERROR: could not open extension control file ā€œ/opt/rh/rh-postgresql10/root/usr/share/pgsql/extension/evr.controlā€: No such file or directory
2021-07-05 12:58:16 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: ActiveRecord::StatementInvalid: PG::UndefinedFile: ERROR: could not open extension control file ā€œ/opt/rh/rh-postgresql10/root/usr/share/pgsql/extension/evr.controlā€: No such file or directory
2021-07-05 12:58:16 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: PG::UndefinedFile: ERROR: could not open extension control file ā€œ/opt/rh/rh-postgresql10/root/usr/share/pgsql/extension/evr.controlā€: No such file or directory
2021-07-05 12:58:16 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: Failed to call refresh: ā€˜/usr/sbin/foreman-rake db:migrateā€™ returned 1 instead of one of [0]
2021-07-05 12:58:16 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: ā€˜/usr/sbin/foreman-rake db:migrateā€™ returned 1 instead of one of [0]
2021-07-05 12:59:27 [INFO ] [configure] # WARN, DEBUG, ERROR, FATAL, INFO, UNKNOWN

any suggestions

As @ekhol already wrote, this is unsupported. If you want to continue with this you should know enough about this to fix the issues yourself. Look at the error messages you get and fix them. You need the evr extension. If you donā€™t know how to handle this, I think you are way over your head and maybe you should just go with the defaults.

Again: the database installed on the foreman server should be used by foreman only. Your ā€œdevelopersā€ should have not concern nor say in what version is installed there. Install postgresql 12 or be ready to handle all issues down the road yourself.

2 Likes

thanks gvde for the response.
So can i install postgres10 in parallel on the same serverT

Sorry, I donā€™t think you can. You seem to have problems with the most basic things here and I really wouldnā€™t recommend to try this. Technically, itā€™s possible but considering the amount of problems and questions you have you really should not even consider this. Install the database with foreman. Leave it to foreman. Donā€™t interfere with it. Youā€™ll most likely just break it.

Otherwise, I think you are really on your own.

Again: why do you insist on installing postgresql 10 on that server? Consider the server an appliance. Itā€™s a foreman appliance. You are not supposed to mess with the internals.

2 Likes