Note: You are currently viewing documentation for Moodle 2.4. Up-to-date documentation for the latest stable version of Moodle may be available here: Automatic updates deployment.

Automatic updates deployment: Difference between revisions

From MoodleDocs
m (Available update notifications page moved)
m (added link to spanish translation of document)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{New features}}[[File:plugins overview.png|thumb|left|Plugins overview highlighting available update with install button]]In Moodle 2.4 onwards, an administrator can enable updates deployment in  ''Settings > Site Administration > Server > Update notifications''. Then when updates are available, 'Install this update' buttons are shown on Plugins overview and Plugins check pages.
{{Installing Moodle}}
{{New features}}
==Enabling updates deployment==


This functionality requires that [[Available update notifications]] are enabled at the site.<br clear="all" />
[[File:plugins overview.png|thumb|Plugins overview highlighting available update with install button]]In Moodle 2.4 onwards, an administrator can enable updates deployment in  ''Settings > Site Administration > Server > Update notifications''. Then when updates are available, 'Install this update' buttons are shown on Plugins overview and Plugins check pages.
 
Note: This functionality requires [[Available update notifications]] to be enabled.


== How it works ==
== How it works ==


As a part of the information about available updates for the site, URL of the ZIP package with the new version of an installed plugin is returned. When ''Install this update'' button is pressed and the the deployment is confirmed at the next page, a standalone utility called ''mdeploy.php'' is executed.
# Information about available updates, including URLs of ZIP packages of new versions of installed plugins, are available as a web service at download.moodle.org.  
 
# When a 'Install this update' button is pressed and the the deployment is confirmed on the following page, a standalone utility called ''mdeploy.php'' is executed.
# The mdeploy utility authorizes the request to make sure you are coming ''exactly'' from the confirmation page displayed in the previous step.
# The mdeploy utility authorizes the request to make sure you are coming ''exactly'' from the confirmation page displayed in the previous step.
# The ZIP package with the new version is fetched from the [https://moodle.org/plugins Moodle plugins directory].
# The ZIP package of the new version is fetched from the [https://moodle.org/plugins Moodle plugins directory].
# A simple integrity check is performed to make sure the ZIP was downloaded correctly.
# A simple integrity check is performed to make sure the ZIP was downloaded correctly.
# The current version of the plugin code is archived into a directory at ''moodledata/mdeploy/archive/'' so you have a backup (just in case you had some local tweaks in the code, for example).
# The current version of the plugin code is archived into a folder ''moodledata/mdeploy/archive/'' as a backup (just in case you had some local tweaks in the code, for example).
# The current directory with the plugin is removed and replaced with the content of the downloaded ZIP.
# The current folder containing the plugin is removed and replaced with the contents of the downloaded ZIP.
# Your browser is redirected to the page where the normal upgrade procedure happens.
# Your browser is redirected to the page where the normal upgrade procedure happens.


At this moment, you can deploy another available update (if there is such) or perform the upgrade procedure as if you uploaded the ZIP contents to your site manually.
At this moment, you can deploy another available update (if there is one) or perform the upgrade procedure the same as if you had uploaded the ZIP contents to your site manually.


== Disabling updates deployment ==
== Disabling updates deployment ==
Line 22: Line 26:
  $CFG->disableupdateautodeploy = true;
  $CFG->disableupdateautodeploy = true;


== Missing install button ==
==Possible problems==
 
=== Missing install button ===


If the updates deployment feature is not enabled (or if it was disabled at the config.php file), no button to install the update is displayed. If the feature is enabled, the page displaying the list of available updates performs some pre-checks to make sure the deployment will work. If a pre-check fails, a short information with a help pop-up is displayed.
If the updates deployment feature is not enabled (or if it is disabled in the config.php file), no button to install the update is displayed. When the feature is enabled, the page displaying the list of available updates performs some pre-checks to make sure the deployment will work. If a pre-check fails, information with a help pop-up is displayed.


=== Plugin files not writable ===
=== Plugin files not writable ===


During the deployment, Moodle will replace the whole folder with the plugin code with a new version. The web server process has to have write access to the folder and all its contents. There are several ways how to achieve this, depending on your web server setup and personal preferences. The exact location of the plugin folder depends on the type of the plugin. For a full list of locations see the Moodle path on https://docs.moodle.org/dev/Plugins
During the deployment, Moodle will replace the whole folder with the plugin code with a new version of the code. The web server process has to have write access to the folder and all its contents. There are several ways how to achieve this, depending on your web server setup and personal preferences. The exact location of the plugin folder depends on the type of the plugin. For a full list of locations see the Moodle path in the [[:dev:Plugins|Plugins developer docs]].


Example: Let us assume your web server is an Apache running at a Linux server as the user ''www-data''. Your Moodle is installed at ''/var/www/vhosts/moodle/htdocs''. You want to give it write access to the folder with your Stamp collection activity module:
Example: Let us assume your web server is an Apache running at a Linux server as the user ''www-data''. Your Moodle is installed at ''/var/www/vhosts/moodle/htdocs''. You want to give it write access to the folder with your Stamp collection activity module:
Line 41: Line 47:
=== Can not download the package ===
=== Can not download the package ===


Make sure that the site http://moodle.org/plugins is up and running at the moment. If it is down, your site can't fetch the ZIP packages from it. Wait for the moodle.org site is up again and try to repeat the deployment procedure.
Make sure that http://moodle.org/plugins is up. If the site is down, your Moodle site will not be able to fetch the ZIP packages from it. Wait for http://moodle.org/plugins to be up again and then try to repeat the deployment procedure.


There can also be a problem with the validation of the SSL certificate of the moodle.org site. See [[SSL certificate for moodle.org]] for more info.
There can also be a problem with the validation of the SSL certificate. See [[SSL certificate for moodle.org]] for more info.


== Errors and exceptions ==
== Errors and exceptions ==


[[File:mdeploy-exception.png|thumb|left|Error screen during the plugin deployment]]If anything goes wrong during the deployment, please read the error page carefully and copy the error message together with the debugging information for later reference. Also, check the mdeploy.log file. The mdeploy utility logs all the steps into this file located at ''moodledata/mdeploy/mdeploy.log''. The log file usually contains additional details and debugging information describing the reason of the failure.
[[File:mdeploy-exception.png|thumb|Error screen during the plugin deployment]]If anything goes wrong during the deployment, please read the error page carefully and copy the error message together with the debugging information for later reference. Also, check the mdeploy.log file. The mdeploy utility logs all the steps into this file located at ''moodledata/mdeploy/mdeploy.log''. The log file usually contains additional details and debugging information describing the cause of the failure.


When you navigate back from the error screen, always remember to go back up to the screen with the list of available plugins (where you clicked the ''Install this update'' button originally). Just going back to the previous confirmation screen or even reloading the current page will not work as the request would not be authorized any more. Doing so leads to the ''unauthorized_access_exception'' with the message ''Unable to read the passphrase file.''
When you navigate back from the error screen, always remember to go back up to the screen with the list of available plugins (where you clicked the 'Install this update' button originally). Just going back to the previous confirmation screen or even reloading the current page will not work, as the request would not be authorized any more. Doing so leads to the ''unauthorized_access_exception'' with the message ''Unable to read the passphrase file.''


The following section describes some errors that may raise and how to deal with them.<br clear="all" />
The following section describes some errors that you may encounter and how to deal with them.


=== Unable to download the package (download_file_exception) ===
=== Unable to download the package (download_file_exception) ===
Line 57: Line 63:
Check the bottom of the mdeploy.log file. It will probably contain a line starting with "cURL error" followed by the error number and the cURL error description.
Check the bottom of the mdeploy.log file. It will probably contain a line starting with "cURL error" followed by the error number and the cURL error description.


==== cURL error 7 couldn't connect to host ====
; cURL error 7 couldn't connect to host : Make sure that the site http://download.moodle.org is up and running at the moment. If it is down, your site can't call the web service to fetch the available updates info. Wait for http://download.moodle.org to be up again then re-check.
 
Make sure that the site http://moodle.org/plugins is up and running at the moment. If it is down, your site can't fetch the ZIP packages from it. Wait for the moodle.org site is up again and try to repeat the deployment procedure.


==== cURL error 60 SSL certificate problem ====
; cURL error 60 (SSL certificate problem) : This suggests problems with the validation of the SSL certificate of the remote (moodle.org) site. See [[SSL certificate for moodle.org]] for more info.


This suggests problems with the validation of the SSL certificate of the remote (moodle.org) site when fetching the ZIP package. See [[SSL certificate for moodle.org]] for more info.
[[de:Automatische Aktualisierungen]]
[[es:Implementar actualizaciones automáticas]]

Latest revision as of 16:03, 6 January 2013

New feature
in Moodle 2.4!

Enabling updates deployment

Plugins overview highlighting available update with install button

In Moodle 2.4 onwards, an administrator can enable updates deployment in Settings > Site Administration > Server > Update notifications. Then when updates are available, 'Install this update' buttons are shown on Plugins overview and Plugins check pages.

Note: This functionality requires Available update notifications to be enabled.

How it works

  1. Information about available updates, including URLs of ZIP packages of new versions of installed plugins, are available as a web service at download.moodle.org.
  2. When a 'Install this update' button is pressed and the the deployment is confirmed on the following page, a standalone utility called mdeploy.php is executed.
  3. The mdeploy utility authorizes the request to make sure you are coming exactly from the confirmation page displayed in the previous step.
  4. The ZIP package of the new version is fetched from the Moodle plugins directory.
  5. A simple integrity check is performed to make sure the ZIP was downloaded correctly.
  6. The current version of the plugin code is archived into a folder moodledata/mdeploy/archive/ as a backup (just in case you had some local tweaks in the code, for example).
  7. The current folder containing the plugin is removed and replaced with the contents of the downloaded ZIP.
  8. Your browser is redirected to the page where the normal upgrade procedure happens.

At this moment, you can deploy another available update (if there is one) or perform the upgrade procedure the same as if you had uploaded the ZIP contents to your site manually.

Disabling updates deployment

In a few circumstances (such as completely managed servers, which may have a lot of local modifications, or sites that have their own solution for updates deployment - for example via Git checkouts) it is desirable to not to allow automatic updates deployment. The feature may be disabled completely by adding the following code to the config.php file:

$CFG->disableupdateautodeploy = true;

Possible problems

Missing install button

If the updates deployment feature is not enabled (or if it is disabled in the config.php file), no button to install the update is displayed. When the feature is enabled, the page displaying the list of available updates performs some pre-checks to make sure the deployment will work. If a pre-check fails, information with a help pop-up is displayed.

Plugin files not writable

During the deployment, Moodle will replace the whole folder with the plugin code with a new version of the code. The web server process has to have write access to the folder and all its contents. There are several ways how to achieve this, depending on your web server setup and personal preferences. The exact location of the plugin folder depends on the type of the plugin. For a full list of locations see the Moodle path in the Plugins developer docs.

Example: Let us assume your web server is an Apache running at a Linux server as the user www-data. Your Moodle is installed at /var/www/vhosts/moodle/htdocs. You want to give it write access to the folder with your Stamp collection activity module:

   # cd /var/www/vhosts/moodle/htdocs
   # cd mod
   # chown -R www-data stampcoll
   # chmod -R u+w stampcoll

See also more about Installing plugins.

Can not download the package

Make sure that http://moodle.org/plugins is up. If the site is down, your Moodle site will not be able to fetch the ZIP packages from it. Wait for http://moodle.org/plugins to be up again and then try to repeat the deployment procedure.

There can also be a problem with the validation of the SSL certificate. See SSL certificate for moodle.org for more info.

Errors and exceptions

Error screen during the plugin deployment

If anything goes wrong during the deployment, please read the error page carefully and copy the error message together with the debugging information for later reference. Also, check the mdeploy.log file. The mdeploy utility logs all the steps into this file located at moodledata/mdeploy/mdeploy.log. The log file usually contains additional details and debugging information describing the cause of the failure.

When you navigate back from the error screen, always remember to go back up to the screen with the list of available plugins (where you clicked the 'Install this update' button originally). Just going back to the previous confirmation screen or even reloading the current page will not work, as the request would not be authorized any more. Doing so leads to the unauthorized_access_exception with the message Unable to read the passphrase file.

The following section describes some errors that you may encounter and how to deal with them.

Unable to download the package (download_file_exception)

Check the bottom of the mdeploy.log file. It will probably contain a line starting with "cURL error" followed by the error number and the cURL error description.

cURL error 7 couldn't connect to host
Make sure that the site http://download.moodle.org is up and running at the moment. If it is down, your site can't call the web service to fetch the available updates info. Wait for http://download.moodle.org to be up again then re-check.
cURL error 60 (SSL certificate problem)
This suggests problems with the validation of the SSL certificate of the remote (moodle.org) site. See SSL certificate for moodle.org for more info.