Upgrade foreman from 3.7.1 to 3.8

hi all,

we want to upgrade Foreman 3.7 to 3.8 (then to 3.9,3.10, and then 3.11) but we have postgresql 10 and 12 on the server! both was from foreman! I dont install any of them manually!

When I restart the server Foreman automatically select the postgresql 10 and I manually stop that and start postgresql 12 and all my data are on the version 12!

How can I deactivate/disable foreman to not select postgresql 10 ?

Foreman and Proxy versions: foreman 3.7 , foreman-proxy 3.7
Distribution and version: Ubuntu 20.04.4 LTS

thanks in advance
Neeloj

even if I want to disable the postgresql 10, I I cannot, the vendor preset is still enabled:

srv01:/usr/sbin# systemctl status postgresql@10-main
● postgresql@10-main.service - PostgreSQL Cluster 10-main
Loaded: loaded (/lib/systemd/system/postgresql@.service; enabled-runtime; vendor preset: enabled)
Active: inactive (dead) since Wed 2024-07-03 11:25:26 CEST; 30min ago
Main PID: 1457 (code=exited, status=0/SUCCESS)

Jul 03 11:24:32 srv01 systemd[1]: Starting PostgreSQL Cluster 10-main…
Jul 03 11:24:39 srv01 systemd[1]: Started PostgreSQL Cluster 10-main.
Jul 03 11:25:26 srv01 systemd[1]: Stopping PostgreSQL Cluster 10-main…
Jul 03 11:25:26 srv01 systemd[1]: postgresql@10-main.service: Succeeded.
Jul 03 11:25:26 srv01 systemd[1]: Stopped PostgreSQL Cluster 10-main.

srv01:/usr/sbin# systemctl disable --now postgresql@10-main

srv01:/usr/sbin# systemctl status postgresql@10-main
● postgresql@10-main.service - PostgreSQL Cluster 10-main
Loaded: loaded (/lib/systemd/system/postgresql@.service; enabled-runtime; vendor preset: enabled)
Active: inactive (dead) since Wed 2024-07-03 11:25:26 CEST; 30min ago
Main PID: 1457 (code=exited, status=0/SUCCESS)

Jul 03 11:24:32 srv01 systemd[1]: Starting PostgreSQL Cluster 10-main…
Jul 03 11:24:39 srv01 systemd[1]: Started PostgreSQL Cluster 10-main.
Jul 03 11:25:26 srv01 systemd[1]: Stopping PostgreSQL Cluster 10-main…
Jul 03 11:25:26 srv01 systemd[1]: postgresql@10-main.service: Succeeded.
Jul 03 11:25:26 srv01 systemd[1]: Stopped PostgreSQL Cluster 10-main.

Im afraid if I want tup upgrade and the below commands will select postgresql version 10! this is not good… so how can I disable or should i remove postgresql version 10 ?

foreman-rake db:migrate
foreman-rake db:seed

You should clear the cache and the existing sessions:

foreman-rake tmp:cache:clear
foreman-rake db:sessions:clear

When I check the status of postgresql 12 it looks like it should be.

systemctl status  postgresql@12-main.service

 postgresql@12-main.service - PostgreSQL Cluster 12-main
     Loaded: loaded (/lib/systemd/system/postgresql@.service; enabled-runtime; vendor preset: enabled)
     Active: active (running) since Wed 2024-07-03 12:16:10 CEST; 16s ago
    Process: 47100 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 12-main start (code=exited, status=0/SUCCESS)
   Main PID: 47105 (postgres)
      Tasks: 56 (limit: 19070)
     Memory: 230.7M
     CGroup: /system.slice/system-postgresql.slice/postgresql@12-main.service
             ├─47105 /usr/lib/postgresql/12/bin/postgres -D /var/lib/postgresql/12/main -c config_file=/etc/postgresql/12/main/postgresql.conf
             ├─47107 postgres: 12/main: checkpointer
             ├─47108 postgres: 12/main: background writer
             ├─47109 postgres: 12/main: walwriter
             ├─47110 postgres: 12/main: autovacuum launcher
             ├─47111 postgres: 12/main: stats collector
             ├─47112 postgres: 12/main: logical replication launcher
             ├─47183 postgres: 12/main: foreman foreman [local] idle

when I run

foreman-maintain service stop

and then

foreman-maintain service start

It start the postgresql version 10 why ?

srv01:~# systemctl status postgresql@10-main.service
● postgresql@10-main.service - PostgreSQL Cluster 10-main
Loaded: loaded (/lib/systemd/system/postgresql@.service; enabled-runtime; vendor preset: enabled)
Active: active (running) since Wed 2024-07-03 12:15:49 CEST; 791ms ago
Process: 46757 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 10-main start (code=exited, status=0/SUCCESS)
Main PID: 46768 (postgres)
Tasks: 7 (limit: 19070)
Memory: 54.2M
CGroup: /system.slice/system-postgresql.slice/postgresql@10-main.service
├─46768 /usr/lib/postgresql/10/bin/postgres -D /var/lib/postgresql/10/main -c config_file=/etc/postgresql/10/main/postgresql.conf
├─46771 postgres: 10/main: checkpointer process
├─46772 postgres: 10/main: writer process
├─46773 postgres: 10/main: wal writer process
├─46774 postgres: 10/main: autovacuum launcher process
├─46775 postgres: 10/main: stats collector process
└─46776 postgres: 10/main: bgworker: logical replication launcher

Jul 03 12:15:46 srv01 systemd[1]: Starting PostgreSQL Cluster 10-main…
Jul 03 12:15:49 srv01 systemd[1]: Started PostgreSQL Cluster 10-main.

srv01:~# systemctl status postgresql@12-main.service
● postgresql@12-main.service - PostgreSQL Cluster 12-main
Loaded: loaded (/lib/systemd/system/postgresql@.service; enabled-runtime; vendor preset: enabled)
Active: failed (Result: protocol) since Wed 2024-07-03 12:15:46 CEST; 5s ago
Process: 46758 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 12-main start (code=exited, status=1/FAILURE)

Jul 03 12:15:46 srv01 postgresql@12-main[46758]: 2024-07-03 12:15:46 CEST LOG: could not