Difference between revisions of "Upgrading WeBWorK with Github"

From WeBWorK_wiki
Jump to navigation Jump to search
(Fix typo)
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== Quick instructions for updating one of your branches ===
 
  +
=== Updating to the Latest Version of WeBWorK ===
   
* To update one of the standard webwork branches
 
  +
If you are updating to the current release of WeBWorK, check the [[:Category:Release Notes|Release Notes]] for the current version.
   
cd /opt/webwork/webwork2
 
  +
=== Using Other Versions of WeBWorK ===
git branch
 
* master
 
release/2.7
 
git pull
 
This updates the current branch "master" to agree with any changes that have been made on the openwebwork repo. If you wish to update the release/2.7 which is tracking release/2.7 on the openwebwork repo then follow the same procedure but first switch to the release/2.7 branch using the command
 
git checkout release/2.7
 
   
* Those who need to switch from using svn to using git and github consult '''[[Github]]'''.
 
  +
You should always use matching versions of WeBWorK and PG. In most cases different versions will not be compatible with one another.
* Those wishing to update from other sources than github.com/openwebwork should read the WeBWorK developer instructions for using the advanced features of git at '''[[Github Overview]]'''.
 
   
=== News ===
 
  +
The [https://github.com/openwebwork/webwork2 webwork2] and [https://github.com/openwebwork/pg pg] repositories typically contain three branches:
* 6/17/2013: we have just merged the release/2.7 branch into the stable master branch at[https://github.com/openwebwork/webwork2/tags tag WeBWorK-2.7] and for PG at[https://github.com/openwebwork/pg/tags tag PG-2.7].
 
  +
* <code>main</code>: The current stable release.
* 7/1/2013 The release/2.8 branches of webwork2 and pg are now "on deck" undergoing final testing and bug squashing. (See preliminary release notes at [[Release_notes_for_WeBWorK_2.8]] ).
 
  +
* <code>WeBWorK-2.xx</code> and <code>PG-2.xx</code>: If these branches are present, then they represent the release candidate for the next version of WeBWorK. This indicates that this version is ready for testing and early adoption.
* 12/20/2013 Release/2.8 merged with the master branch. [[Release_notes_for_WeBWorK_2.8]]
 
  +
* <code>develop</code>>: This branch has the latest code for the software. This branch is intended to always compile, but some features may not be fully tested or stable.
* 6/20/2014 Release/2.9 was merged with the master branch and is the current release of webwork. [[Release_notes_for_WeBWorK_2.9]].
 
   
=== Quick instructions for using other branches of webwork ===
 
  +
WeBWorK also maintains a tag for each previous release of WeBWorK. It is not recommended to install old versions of WeBWorK unless absolutely necessary.
 
You may want to use the current '''stable candidate release''' branch of WeBWorK instead of using the "master" branch. You might want to do this because the upcoming release branch has a new feature that you want to use right away, or you might like to help out with the final testing of the new branch. These instructions tell you how to
 
download the new branch, how to switch to it, and how to easily revert back to the original "master" branch if there are difficulties or when you are done testing.
 
   
 
* These instructions tell you how to obtain recent branches of the webwork2 repository. The analogous procedures on the pg directory will obtain the various branches of the pg repository.
 
* These instructions tell you how to obtain recent branches of the webwork2 repository. The analogous procedures on the pg directory will obtain the various branches of the pg repository.
 
* You can view the [https://github.com/openwebwork WeBWorK repository] online to see what is available.
 
* You can view the [https://github.com/openwebwork WeBWorK repository] online to see what is available.
* First use git to download the information about the branches of WeBWorK in addition to the master branch.
+
* First use git to download the information about the branches of WeBWorK in addition to the main branch.
   
 
cd /opt/webwork/webwork2
 
cd /opt/webwork/webwork2
Line 36: Line 25:
 
git fetch origin
 
git fetch origin
 
git branch -a
 
git branch -a
* master
+
* main
remotes/origin/HEAD -> origin/master
+
remotes/origin/HEAD -> origin/main
  +
remotes/origin/WeBWorK-2.20
 
remotes/origin/develop
 
remotes/origin/develop
remotes/origin/master
+
remotes/origin/main
remotes/origin/release/2.8
+
git branch -t WeBWorK-2.20 origin/WeBWorK-2.20
git branch -t release/2.8 origin/release/2.8
+
Branch WeBWorK-2.20 set up to track remote branch WeBWorK-2.20 from origin.
Branch release/2.8 set up to track remote branch release/2.8 from origin.
 
 
git branch
 
git branch
* master
+
* main
release/2.8
+
WeBWorK-2.20
 
* This sequence of commands does the following
 
* This sequence of commands does the following
 
** Obtain information about all of the branches at the "origin" repository.
 
** Obtain information about all of the branches at the "origin" repository.
** List all of the branches available. The * indicates that we are currently using the "master" branch.
+
** List all of the branches available. The * indicates that we are currently using the "main" branch.
** The "git branch -t..." sets up a local branch which tracks (syncs with) the current release candidate (which is "release/2.8" in this case)
+
** The "git branch -t..." sets up a local branch which tracks (syncs with) the current release candidate (which is "WeBWorK-2.20" in this case)
** The final check "git branch" shows that you now have access to two versions on the software, downloaded to your machine. The * indicates that you are currently using the master version.
+
** The final check "git branch" shows that you now have access to two versions on the software, downloaded to your machine. The * indicates that you are currently using the main version.
* Update pg (for some version changes it is necessary to update both pg and webwork2 but often they can be updated independently. The pg and webwork2 version numbers do not always match since pg is updated more frequently.)
+
* Update pg
 
cd /opt/webwork/pg
 
cd /opt/webwork/pg
 
git remote -v
 
git remote -v
Line 57: Line 46:
 
git fetch origin
 
git fetch origin
 
git branch -a
 
git branch -a
* master
+
* main
remotes/origin/HEAD -> origin/master
+
remotes/origin/HEAD -> origin/main
  +
remotes/origin/PG-2.20
 
remotes/origin/develop
 
remotes/origin/develop
remotes/origin/master
+
remotes/origin/main
remotes/origin/release/2.8
+
git branch -t PG-2.20 origin/PG-2.20
git branch -t release/2.8 origin/release/2.8
+
Branch PG-2.20 set up to track remote branch PG-2.20 from origin.
Branch release/2.7x set up to track remote branch release/2.8 from origin.
 
 
 
* Switch over the webwork2 release candidate release/2.8 and to pg version release/2.8
 
  +
* You now have the WeBWorK-2.20 and PG-2.20 release candidates available on your server. You can switch over them using:
 
cd /opt/webwork/webwork2
 
cd /opt/webwork/webwork2
 
git branch
 
git branch
* master
+
* main
release/2.8
+
WeBWorK-2.20
git checkout release/2.8
+
git checkout WeBWorK-2.20
 
cd /opt/webwork/pg
 
cd /opt/webwork/pg
git checkout release/2.8
+
git checkout PG-2.20
* Run /opt/webwork/webwork2/bin check_modules.pl to make sure that you have the required CPAN modules installed.
 
* Now '''restart''' your apache server (the command for this might be "sudo apachectl graceful")
 
* Go to the webwork admin page <nowiki>http://your.server.edu/webwork2/admin</nowiki> and upgrade the relevant course databases.
 
 
* Update webwork-open-problem-library in the same way
 
* Run /opt/webwork/webwork2/bin/OPL-update to update the library database.
 
   
'''Notice:''' Configuration updates to webwork2 become relatively painless once you start using the new configuration files.
 
  +
Any time you change branches you should do the following
* In most cases you will no longer have to update any configuration files.
 
  +
* Run <code>/opt/webwork/webwork2/bin/check_modules.pl</code> to make sure that you have the required perl modules installed.
* Default configurations for new features will be automatically provided in the defaults.config.dist file.
 
  +
** If any modules are missing, you can install them either by following the relevant [[Installation Guides|Installation Guide]] or directly from CPAN.
* Your local directory configuration structures remain unchanged in sites.conf as do your local overrides in localOverrides.conf.
 
  +
* Update the web dependencies for both WeBWorK and PG:
* Always customize configurations in default.config.dist by using localOverrides.conf.
 
  +
cd /opt/webwork/webwork2/htdocs
* You should seldom, if ever, modify default.config.dist. If you do, you become responsible for managing and merging changes to that file.
 
  +
npm ci
* For releases which add new fields to the database to support new question features it will be necessary for the site administrator to run "Upgrade courses" from the "admin course". This will add the extra fields to the database.
 
  +
cd /opt/webwork/pg/htdocs
  +
npm ci
  +
* Check the <code>site.conf.dist</code> file to see if there are any new settings that need to be added to your <code>site.conf</code> file.
  +
* '''Restart''' the service(s) (as of WeBWorK 2.18 you will probably need to run the commands <code>sudo systemctl restart webwork2</code> and <code>sudo systemctl restart webwork2-job-queue</code>).
  +
* Go to the WeBWorK admin page <nowiki>http://your.server.edu/webwork2/admin</nowiki> (note that as of WeBWorK 2.19 the location of the admin page is customizable in <code>site.conf</code>) and click on "Upgrade Courses" on the left.
   
If you switch back to an earlier version of WeBWorK after upgrading then on the upgrade courses page you will see warnings about "extra" fields in the course database tables which are not in the schema. These extra fields are simply ignored and do not interfere with the normal behavior of WeBWorK.
+
If you switch back to an earlier version of WeBWorK after upgrading then on the upgrade courses page you will see warnings about "extra" fields in the course database tables which are not in the schema. You will be given the option to delete these columns. If you do, then you will lose any data relating to features from the later version of WeBWorK which are not in the earlier version.
   
 
It is also easy to back out to a previous release.
 
It is also easy to back out to a previous release.
Line 87: Line 80:
 
* To switch back
 
* To switch back
 
git branch
 
git branch
master
+
main
* release/2.8
+
* WeBWorK-2.20
git checkout master
+
git checkout main
and '''restart''' your apache server.
+
and follow the same steps listed above.
 
==== What could possibly go wrong ====
 
==== What could possibly go wrong ====
 
* You get what look like database errors of some kind -- missing fields in tables, etc. when looking at a course.
 
* You get what look like database errors of some kind -- missing fields in tables, etc. when looking at a course.
 
** Most likely you didn't upgrade the course databases from the web using the WeBWorK admin page
 
** Most likely you didn't upgrade the course databases from the web using the WeBWorK admin page
 
* You get a long message about "not finding HTML::Scrubber" looking in ..... various directories
 
* You get a long message about "not finding HTML::Scrubber" looking in ..... various directories
** The message looks scary but simply indicates that some required CPAN module has not been installed on your site. Perhaps you forgot to run check_modules.pl or perhaps the maintainers neglected to include a required module in the new version of check_modules.pl. (If this is the case please report the bug.) They are easily installed using the cpan command or by importing them from your distributions packages.
+
** The message looks scary but simply indicates that some required perl module has not been installed on your site. Perhaps you forgot to run check_modules.pl or perhaps the maintainers neglected to include a required module in the new version of check_modules.pl. (If this is the case please report the bug.) They are easily installed using the <code>cpanm</code> command or by importing them from your distributions packages (see the [[Installation Guides|Installation Guide]] for the version you are installing).
   
  +
=== Updating the Open Problem Library ===
  +
The WeBWorK Open Problem Library only maintains a current release. You can obtain the latest release by running <code>/opt/webwork/webwork2/bin/OPL-update</code>.
   
   
 
[[Category:Administrators]]
 
[[Category:Administrators]]
 
[[Category:Github]]
 
[[Category:Github]]
  +
[[Category:Needs_Work]]

Latest revision as of 14:48, 20 June 2025

Updating to the Latest Version of WeBWorK

If you are updating to the current release of WeBWorK, check the Release Notes for the current version.

Using Other Versions of WeBWorK

You should always use matching versions of WeBWorK and PG. In most cases different versions will not be compatible with one another.

The webwork2 and pg repositories typically contain three branches:

  • main: The current stable release.
  • WeBWorK-2.xx and PG-2.xx: If these branches are present, then they represent the release candidate for the next version of WeBWorK. This indicates that this version is ready for testing and early adoption.
  • develop>: This branch has the latest code for the software. This branch is intended to always compile, but some features may not be fully tested or stable.

WeBWorK also maintains a tag for each previous release of WeBWorK. It is not recommended to install old versions of WeBWorK unless absolutely necessary.

  • These instructions tell you how to obtain recent branches of the webwork2 repository. The analogous procedures on the pg directory will obtain the various branches of the pg repository.
  • You can view the WeBWorK repository online to see what is available.
  • First use git to download the information about the branches of WeBWorK in addition to the main branch.
 cd /opt/webwork/webwork2
 git remote -v
      origin	https://github.com/openwebwork/webwork2 (fetch)
      origin	https://github.com/openwebwork/webwork2 (push)

This is the default setup. The reply to the remote command says that "origin" is connected to the standard repo at github.com.

 git fetch origin
 git branch -a
   * main
    remotes/origin/HEAD -> origin/main
    remotes/origin/WeBWorK-2.20
    remotes/origin/develop
    remotes/origin/main
 git branch -t WeBWorK-2.20 origin/WeBWorK-2.20
    Branch WeBWorK-2.20 set up to track remote branch WeBWorK-2.20 from origin.
 git branch
    * main
    WeBWorK-2.20
  • This sequence of commands does the following
    • Obtain information about all of the branches at the "origin" repository.
    • List all of the branches available. The * indicates that we are currently using the "main" branch.
    • The "git branch -t..." sets up a local branch which tracks (syncs with) the current release candidate (which is "WeBWorK-2.20" in this case)
    • The final check "git branch" shows that you now have access to two versions on the software, downloaded to your machine. The * indicates that you are currently using the main version.
  • Update pg
 cd /opt/webwork/pg
 git remote -v
      origin	https://github.com/openwebwork/pg (fetch)
      origin	https://github.com/openwebwork/pg (push)
 git fetch origin
 git branch -a
   * main
    remotes/origin/HEAD -> origin/main
    remotes/origin/PG-2.20
    remotes/origin/develop
    remotes/origin/main
 git branch -t PG-2.20 origin/PG-2.20
   Branch PG-2.20 set up to track remote branch PG-2.20 from origin.
  
  • You now have the WeBWorK-2.20 and PG-2.20 release candidates available on your server. You can switch over them using:
  cd /opt/webwork/webwork2
  git branch
    * main
    WeBWorK-2.20
  git checkout WeBWorK-2.20
  cd /opt/webwork/pg
  git checkout PG-2.20

Any time you change branches you should do the following

  • Run /opt/webwork/webwork2/bin/check_modules.pl to make sure that you have the required perl modules installed.
    • If any modules are missing, you can install them either by following the relevant Installation Guide or directly from CPAN.
  • Update the web dependencies for both WeBWorK and PG:
 cd /opt/webwork/webwork2/htdocs
 npm ci
 cd /opt/webwork/pg/htdocs
 npm ci
  • Check the site.conf.dist file to see if there are any new settings that need to be added to your site.conf file.
  • Restart the service(s) (as of WeBWorK 2.18 you will probably need to run the commands sudo systemctl restart webwork2 and sudo systemctl restart webwork2-job-queue).
  • Go to the WeBWorK admin page http://your.server.edu/webwork2/admin (note that as of WeBWorK 2.19 the location of the admin page is customizable in site.conf) and click on "Upgrade Courses" on the left.

If you switch back to an earlier version of WeBWorK after upgrading then on the upgrade courses page you will see warnings about "extra" fields in the course database tables which are not in the schema. You will be given the option to delete these columns. If you do, then you will lose any data relating to features from the later version of WeBWorK which are not in the earlier version.

It is also easy to back out to a previous release.

  • To switch back
  git branch
    main
    * WeBWorK-2.20
  git checkout main

and follow the same steps listed above.

What could possibly go wrong

  • You get what look like database errors of some kind -- missing fields in tables, etc. when looking at a course.
    • Most likely you didn't upgrade the course databases from the web using the WeBWorK admin page
  • You get a long message about "not finding HTML::Scrubber" looking in ..... various directories
    • The message looks scary but simply indicates that some required perl module has not been installed on your site. Perhaps you forgot to run check_modules.pl or perhaps the maintainers neglected to include a required module in the new version of check_modules.pl. (If this is the case please report the bug.) They are easily installed using the cpanm command or by importing them from your distributions packages (see the Installation Guide for the version you are installing).

Updating the Open Problem Library

The WeBWorK Open Problem Library only maintains a current release. You can obtain the latest release by running /opt/webwork/webwork2/bin/OPL-update.