Add a web-based upgrader for ThinkUp's source code #975

Closed
ginatrapani opened this Issue Sep 15, 2011 · 2 comments

Projects

None yet

2 participants

@ginatrapani
Member

Right now when a new release of ThinkUp comes out, users have to manually download, unzip, mv, upload, and run database migrations to upgrade their installation. It's too much work.

We want to add a web-based application code upgrader mechanism to ThinkUp, similar to WordPress'. Roughly, the upgrader will:

  • Notify logged-in TU admins when there's a new release of ThinkUp available that's newer than the currently running version [this part is already done]
  • When the admin clicks "Update now", the updater will download the new release, verify its checksum, unzip it, and compare its filetree to the current installation, making note of all the changed, new, and deleted files
  • The updater will then update the installation's current source code with the new release source.
  • Then, the updater will run any necessary database migrations.

We'll need to offer thorough documentation around the required file permissions to enable the auto-updater, and also add some sort of auto-recovery of the old version if the update fails midway.

There's plenty of prior art here so no ThinkUp dev should spend time starting from scratch and reinventing the wheel. Before writing any code, we will research WordPress, Drupal, and maybe Joomla and Piwik's autoupdater mechanisms and security protections and make good use of all the thinking those communities have put into it.

Initial ask:
http://smarterware.org/thinkup/post/?t=109306237656629248&n=twitter

@ginatrapani
Member

WordPress autoupdater process as per http://core.trac.wordpress.org/ticket/5560#comment:60

Steps performed during upgrade.

Send version and locale to http://api.wordpress.org/core/version-check/1.2/ to see if there is an update available. Get a link to the WP package if so. The package for the requested locale is used if available, otherwise the English package is used. Only locales that have setup an international site on wp.org will have packages available. Reference http://api.wordpress.org/core/version-check/1.2/
Download the package from wordpress.org to the system temp directory
Create working dir, usually wp-content/upgrade/core
Unzip the package into our working dir
Copy wp-admin/includes/update-core.php from the new version unzipped in the working dir into the current WP install
Include the new update-core.php
Call update_core(), which is defined in update-core.php
update_core() takes over and does the following:

Sanity check the new version of WP sitting in the working dir
Create a .maintenance file in the WP root dir. wp-settings.php checks this and prevents WP from fully loading if it exists. We don't want WP loading while files are being upgraded.
Overwrite old WP files with the new ones
Remove files that are no longer part of the WP distro
Send a request to ugrade.php to perform a DB upgrade. We do this as a separate request instead of calling the upgrade function directly because we need a fresh request that has all of the new stuff loaded.
Delete the working dir
Delete .maintenance
Done

@mwilkie mwilkie was assigned Mar 15, 2012
@ginatrapani ginatrapani added a commit that referenced this issue Mar 16, 2012
@ginatrapani Mark Wilkie + ginatrapani Issue #975: Web-based application upgrader
* Upgrade ThinkUp via the web
* Added beta channel option in Application Settings
732660e
@ginatrapani
Member

TODO:

  • Proof documentation and add disaster recovery steps
  • Change JSON source and zip download location to GitHub
  • Merge Anil's pull request
@ginatrapani ginatrapani added a commit that referenced this issue Mar 24, 2012
@ginatrapani Mark Wilkie + ginatrapani Issue #975: Web-based application upgrader
* Upgrade ThinkUp via the web
* Added beta channel option in Application Settings
* Update upgrader screen to comply with 1.0 CSS design and installer design.
af1c919
@ginatrapani ginatrapani added a commit that referenced this issue Mar 26, 2012
@ginatrapani Mark Wilkie + ginatrapani Issue #975: Web-based application upgrader
* Upgrade ThinkUp via the web
* Added beta channel option in Application Settings
* Update upgrader screen to comply with 1.0 CSS design and installer design
* Documentation
0e5e507
@mwilkie mwilkie was unassigned by ginatrapani Apr 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment