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