Major upgrade - guidance

Major upgrade - guidance

by Mark Lamb -
Number of replies: 5
Hi all,

I really need a bit of advice, and to sense check my current situation.

I have recently inherited the following environment:

- AWS Elastic Beanstalk - Amazon Linux 2
- PHP 7.4
- Moodle 3.9
- Postgres

I need to do a full upgrade, and want to bring everything up to as later version as I can, but there are some sizeable issues here.  To make it worse, the previous developers have not really documented anything - there's a suprise.

I can't recreate the EBS environment, as AWS now provide no access to PHP7.4 at all.  The oldest version I can get is PHP8.0.  Ideally I need to recreate the environment in dev, but thats easier said than done.  To make it even more troublesome, it has deep SSO links into a KeystoneJS web environment, which is also many versions behind.

What would you recommend as the best approach to get this done.  I don't have much Moodle experience in house, and so any guidance would be gratefully received.


Average of ratings: Useful (1)
In reply to Mark Lamb

Re: Major upgrade - guidance

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
It wasn't nice from your predecessors. ;)

On top of that you speak a different language; AWS, EBS, KeystoneJS are unknown to me. And you don't mention the PostgeSQL version.

Luckily 3.9 LTS is not too ancient. Last release 3.9.25 was in December 2023. If you can activate PHP 8.0 Moodle 3.11 will work, if 3.11.8 or later. So your could upgrade the current 3.9 LST to 3.9.25 and then proceed to 3.11.18 for example.

Then take a long break. The transition 3.x to 4.x is a generation change. You need to experiment on a copy of that 3.11.18.

WARNING: Get a Site backup before you proceed. There's no downgrade to recover a broken upgrade.

Second caution: Your current 3.9 LTS doesn't run, because you can't provide PHP 7.4, right? A tricky situation!

https://moodledev.io/general/releases/
http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases
https://docs.moodle.org/39/en/Upgrading
https://docs.moodle.org/311/en/Upgrading
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Major upgrade - guidance

by Mark Lamb -
Hi,
Thanks for the reply - much appreciated.
The PG version is 14.10.

The current live site is running ok, but the issue has been in creating a dev version of it. I'll have to manually create it all, outside of the current AWS framework and do the upgrade, and then drop it back in when I have it working with PHP8, at which point it will be supportable again.

Like you say, the predecessors were not kind smile

So, migrate the existing 3.9.10 to 3.9.25 then on php7.4, and then upgrade php to 8, and to moodle 3.11.18.
Average of ratings: Useful (1)
In reply to Mark Lamb

Re: Major upgrade - guidance

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
I don't understand why you *have to* do the upgrade outside. Your current environment (AWS) PHP 7.4 supports Moodle 3.9. So why can't you go from 3.9.10 to 3.9.25 there? BTW, this is a precautionary step. Straight 3.9.10 > 3.11.18 might work too. You can jump straight to 4.1 LTS on the same PHP 7.4, if you want that. Study the chart I linked in my previous mail carefully.
Average of ratings: Useful (1)
In reply to Mark Lamb

Re: Major upgrade - guidance

by Ken Task -
Picture of Particularly helpful Moodlers
This goes a little deeper ..
https://blog.mondoo.com/amazon-linux-2023-features-and-vulnerabilities

While Amazon Linux 2 was based on Red Hat Enterprise Linux (RHEL) 7, each major release of Amazon Linux 2023 will use a combination of Fedora Linux and CentOS Stream. Amazon will then replace specific packages from other upstream sources as needed.

New upstream definitions

Amazon Linux 2023 has shifted to a new upstream source. While Amazon Linux 2 was based on Red Hat Enterprise Linux (RHEL) 7, each major release of Amazon Linux 2023 will use a combination of Fedora Linux and CentOS Stream. Amazon will then replace specific packages from other upstream sources as needed. The initial release of Amazon Linux 2023 incorporates parts of Fedora 34, 35, 36, and CentOS 9 Stream. Amazon sources kernels directly from kernel.org's LTS releases, independent of the Fedora release they're based on.


By far the best way to install/maintain/update/upgrade a moodle is to use git versioning.
Your predecessor's might have used it to customize.
Find out - I assume you have ssh into server ...

To find out what OS:
uname -an

Then
locate the moodle code and inspect the directory for hidden .git and .github directories.
cd /path/to/moodle/code/
ls -ld .git

If present, another issue ... moodle is moving the git repo from master to main.

Please issue:
git branch -a
That doesn't change anything just sees what branches your server knows about.

Git tracks everything in a moodle directory ... unfortunately there is no 'dry run' using
git to acquire moodle core code, but the fist git pull will alert if there is any
core code that has changed and halt the update.

There's your list of things your predecessors changed of core code.

Also, in config.php file of the moodle code there are lines for DB.
DB server is localhost? or does that line point to a remote DB server (IP address)?

I have never hosted on Amazon so pardon the dumb question ...
Can you use 3rd party repositories?
A CentOS 7 flavored OS could use the Remi repo for PHP versions.

There are quite a few hosting providers whose customers are in similar situation when
it comes to CentOS 7 EOL and decision to move to either AlmaLinux or Rocky.  I, myself, have migrated off CentOS 7 to Rocky 9 by standing up  a new server with minimal install of OS first.   Was able to get my moodles to 4.1.highest prior to that, however - as Rocky 9 and AlmaLinux 9 come with PHP 8 and MySQL 8.

What you might end up doing is standing up another server using Rocky with Remi repo for PHP versions lower than 8.   Xfer your moodle site backup to that stood up box, and restoring the site there ... at first getting your 3.9.x to run, then sideload/upload git versioning for 3.9 first - + Remi repo for PHP version.  From what I've heard about postgres, its dump doesn't import well into MySQL or MariaDB so think I'd stick with postgres.

With git you could march the moodle upwards ... 3.9.highest -> 3.10.highest -> 3.11.highest.
When you get there, major change coming in 4.0 ... Now I know folks will say one can hyperjump LTS -> LTS but those seem to miss little undocumented things.   Marching gets those little things.

There is some more ... themes and addon plugins.
You need to set the theme to boost via config.php for the duration of you march upwards via config.php file.   An incompatible theme can halt an upgrade.   Just like an in compatible plugin .. so get a list of addons and check moodle.org plugins site for compatibility issues.
Matter of fact, the old 'assignment (2.2) mod should be removed from the system prior to upgrading to 4.3 ... if present, that will halt upgrade until it is removed.

Ok, my 2 cents.
Not a fun thing to do! sad

'SoS', Ken

Average of ratings: Useful (2)
In reply to Ken Task

Re: Major upgrade - guidance

by Mark Lamb -
Thanks for your details reply - it is very much appreciated.

Basically, what I inherited was an Elastic Beanstalk environment in AWS. All I have source wise, is two tar files and they have no repo history. So, so much of the history is not available.

I think, so I can understand it fully, I'll build a new environment manually and drop the code I have in, and see if I can stand it up that way. I just need to get top the point were I have a dev environment that works the same as production so I can test everything.

Thanks again.
Average of ratings: Useful (1)