Upgrading Foreman from 1.7.2 to 1.19

Problem:
Hello, hoping someone here will be able to help me out! Relatively new to puppet & foreman so not got a lot of product knowledge to bring to bear here.
We have an existing production foreman server in our environment built on CentOS 6.7 which we have a requirement to upgrade (versions in title and below). I’ve looked through the manual and official documentation but can’t find anything that seems to work in our context.
Our system is airgapped, so I’m working with an internal repo which is updated regularly.
The recommended upgrade path seems to be backing up the database, updating the foreman-release package and then all ruby* and foreman* packages, which I’ve done. The version of foreman still appears to be 1.7.2 despite completing this however. It also appears the database for a clean build of 1.19 would use a postgresql database, whereas the older build is mysql? The schemas are also drastically different, so I’m concerned about data loss / compatibility. We have a lot of overrides and contexts set for host groups etc that we need to preserve and which it would be impractical to manually redeploy.

Expected outcome:
Clean migration from foreman 1.7.2 to 1.19, preserving context and overridden values. All host groups and configuration still present and correct.

Foreman and Proxy versions:
1.7.2

Foreman and Proxy plugin versions:
N/A

Other relevant data:
As mentioned, I’m quite new to the products involved here - please let me know what other information would be useful RE our deployment to help provide a solution. Pre-emptive thanks for any help tendered!

Hey,

I’d rather read response from the field because as a developer I live my own bubble. There are people with more production expertise than I have.

Having that said, I’d suggest to upgrade to CentOS 7, which is I think is possible but be prepared and have full backups.

Then I suggest to try to migrate from MySQL to PostgreSQL. We have some rake scripts in order to perform this.

And finally then perform full upgrade. But this is a lot of versions skipped, expect issues. There is no documentation available covering this upgrade, I suggest to go one version by one if you fail. You can also try to upgrade and migrate upgraded version if you fail to move from MySQL to Postgres - not every release does have a working MySQL migration.

Fresh installation might also be an option, but note we don’t provide much of migration tools. Our users usually do migration by themselves via CLI/API/Rake or Console.

Foreman is a project, it’s community effort. We do our best to help, but this upgrade is gonna cost you a ton of work. It does not need to be smooth, you want to upgrade across 12 major releases. It’s not a good idea to let the train go for that long in FOSS industry.

On the other hand, there are also several commercial products available which moves at much slower pace, Red Hat Satellite 6 to name one.

Hi lzap,

Thanks for your reply!

The path you suggest definitely sounds like the sensible way forward. Completely agree that it’s going to be an obscene amount of work, unfortunately I’ve inherited this as part of a large legacy estate and it’s a critical piece of their infrastructure.

I think the main thing i need to be able to work out is how to migrate the database to the correct type and version, and then incremental upgrade sounds like the most sensible way forward. I had a vaguely forlorn hope of a magic bullet solution but I’m not surprised with your diagnosis!

Can you advise me on the rake scripts I should be looking to use to solve my database issue? Beyond that, i fear I’ll just have to bunker down and work through incremental updates until we catch up!

Thanks for taking the time to reply to me, it’s much appreciated.

From my point of view you should do a fresh install and try to export/import with hammer-cli and csv-Plugin.

We maintain over 500 machines and are doing this even with upgrades from Foreman 1.17 and Katello 3.6 to 1.19 and 3.8 because of the many changes and issues. Foreman may work with the step-by-step upgrade, but Katello does definately not as easy as it should be.

Regards,
Martin

Martin, we need a blog post about that! Seriously, if you have some notes, please turne them into markdown:

@marionette the best community know how we have is from Timo’s migration of their infrastructure it was performed last year, would be good idea to upgrade to this version (1.15) because it is very likely that if it worked for them it will work for you:

https://theforeman.org/2017/10/migrating-foreman-from-mysql-to-postgresql.html

1 Like

A blog post would be a good idea. I’m trying to spare some time in the next weeks because I’m rather busy atm.

We are currently looking at a similar problem and would like to upgrade a foreman 1.9 (on xenial) to 1.22 (on bionic) and do not really want to upgrade everything step by step.
Are there any news about said blog post?

P.S: Sorry for digging up a dead post :slight_smile:

I was referring to MySQL to PostgreSQL migration. If you mean that, yes we have a new manual section dedicated to that: Foreman :: Dropping support for MySQL

In case you are seeking for info about how to upgrade across multiple Foreman versions there are two options:

  • Install new version and migrate your hosts
  • Perform N upgrades one after another as we don’t test multi-version upgrades at all