Upgrading from 3.6 to 3.7 using Git

Upgrading from 3.6 to 3.7 using Git

by John Conner -
Number of replies: 6

Hello,

I have been tasked with coming up with a plan to keep two Moodle installs we have up-to-date. 

I Googled, "Managing updates on Moodle" and landed on: https://docs.moodle.org/37/en/Git_for_Administrators

I went to the linux box and used the following commands because I had used Git to install it (apparently using the 3.6 branch):

$ cd /path/to/your/moodle/ 

$ git pull

I am now on 3.6.5 - But when I login, after updating the database, it tells me 3.7.1 is out. How do I change to the 3.7...branch? I am new to Git. Do I just follow the "Obtaining the code from Git" on that Git for admins article? 

Average of ratings: -
In reply to John Conner

Re: Upgrading from 3.6 to 3.7 using Git

by Ken Task -
Picture of Particularly helpful Moodlers

Before upgrading to 3.7.1, strongly suggest going to Site Admin menu -> Server -> Environment.   Update the component.   Then use the drop down list set to 3.7 to check server environment to see if server is ready for 3.7.

Check plugins installed to see if they have a compatible upgrade to them for 3.7.

Themes are plugins ... themes have changed (again) in 3.7 and an incompatible theme can stop upgrade in it's tracks.  Suggest before upgrading, set your 3.6.x theme to one that was 'stock' for that version.  boost,more,clean

Can do that via entry in config.php:

$CFG->theme='boost';

3.7 stock themes are boost and classic.  That setting (boost) in the 3.6 should make it 'smoother sailing'.

Also strongly suggest, before you do upgrade, have a full site backup ... code + DB dump + minimal moodledata/filedir/.

After above, to upgrade to 3.7.1, change into code directory and issue:

git branch -a (should see a * at top and Moodle 36.

git branch --track MOODLE_37_STABLE origin/MOODLE_37_STABLE
git checkout MOODLE_37_STABLE

You could finish the upgrade via command line as long as you are there:

php admin/cli/upgrade.php --non-interactive

The non-interactive just skips the 'splash' screen.

'SoS', Ken

In reply to Ken Task

Re: Upgrading from 3.6 to 3.7 using Git

by John Conner -
Thanks Ken, I will give this a try!
In reply to John Conner

Re: Upgrading from 3.6 to 3.7 using Git

by Ray Hinton -
You will also want to have a plan for how you manage/upgrade your plugins, if you ever decide to install something beyond the core features. If you have not already, you will want to read the regular Upgrading page, which gives a good overview of how to manually manage all of the directories during an upgrade: https://docs.moodle.org/37/en/Upgrading

I am also a Git newbie, and managing plugins has always made me shy away from going the Git route (we use a few plugins from the moodle.org repository, and a few from private developers). I do not doubt for a moment that it is a useful tool, but I trust myself to manually push around directories, better than I trust myself to use Git.
In reply to Ray Hinton

Re: Upgrading from 3.6 to 3.7 using Git

by Ken Task -
Picture of Particularly helpful Moodlers

"few from private developers" perhaps the stopper for you. :|  Do your developers maintain a stable version of their work in git hub?

Managing plugins from Moodle.org can be made easier using moosh.

cat checkaddons - is an executable

#!/bin/bash
#
echo 'Add-on listing: ';
cat ./addons.txt;
echo '---------------------';
for i in `cat ./addons.txt`
do
   echo "Addon in que: $i";
moosh -n plugin-list |grep $i
done

cat addons.txt
atto_morefontcolors
auth_saml2
mod_hotpot

execution shows:

atto_morefontcolors,2.7,2.8,2.9,3.0,3.1,3.2,3.3,3.4,3.5,3.6,3.7,https://moodle.org/plugins/download.php/17254/atto_morefontcolors_moodle37_2018050202.zip
Addon in que: auth_saml2
auth_saml2,2.7,2.8,2.9,3.0,3.1,3.2,3.3,3.4,3.5,https://moodle.org/plugins/download.php/19164/auth_saml2_moodle35_2019022100.zip
auth_saml2sso,3.0,3.1,3.2,3.3,3.4,3.5,3.6,https://moodle.org/plugins/download.php/18917/auth_saml2sso_moodle36_2018121500.zip
Addon in que: mod_hotpot
mod_hotpot,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.2,3.3,3.4,3.5,3.6,3.7,https://moodle.org/plugins/download.php/19673/mod_hotpot_moodle37_2019053038.zip

Can use the zip url via command line 'wget' in appropriate directory to acquire updated plugin.

Move the current directory to hidden - hotpot example

[root@server mod]# mv hotpot .hotpot

Unzip mod_hotpot_moodle37_2019053038.zip in mod

change ownerships/permissions on resulting mod/hotpot directory.

Then finish upgrading the DB via

php admin/cli/upgrade.php

All the above could be scripted into a fairly automated thing.

But why do that?  If it takes no 'expertise' to admin a moodle, no need for you, is there?   So keep making the 'big bucks' and tell no one how you do it! smile

'SoS', Ken

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

Re: Upgrading from 3.6 to 3.7 using Git

by Ray Hinton -
You're always a font of wisdom, Ken! smile

Thanks for the reminder about Moosh, that might be the next optimization of my process. I'll step back and let others sing the praises of other tools!
In reply to Ray Hinton

Re: Upgrading from 3.6 to 3.7 using Git

by Ken Task -
Picture of Particularly helpful Moodlers

Think I'll take that as a compliment!  Thanks!

'wisdom' could be defined as 'experience' gained through failures thus learning what not to do.  And if one has a high failure quotient, eventually one gets there. smile

'spirit of sharing', Ken