Skip to content

Commit

Permalink
Issue #975: Web-based application upgrader
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Mark Wilkie authored and ginatrapani committed Mar 26, 2012
1 parent 88be132 commit 0e5e507
Show file tree
Hide file tree
Showing 52 changed files with 1,309 additions and 223 deletions.
6 changes: 3 additions & 3 deletions .gitignore
@@ -1,7 +1,8 @@
webapp/config.inc.php
webapp/config.inc.bak.php
webapp/data/
data/
!tests/data
!webapp/data/README.md
tests/config.tests.inc.php
.*
extras/cron/config
Expand All @@ -11,6 +12,5 @@ extras/scripts/lic_header.py
extras/scripts/test-pull-postback-conf
webapp/test_installer/*
webapp/plugins/twitterrealtime/streaming/*.pid
build/*
docs/build/*
build/
extras/dev/ramdisk/osx_make_ramdisk_db.conf
29 changes: 0 additions & 29 deletions docs/source/changelog.rst

This file was deleted.

29 changes: 29 additions & 0 deletions docs/source/changelog/index.rst
@@ -0,0 +1,29 @@
Changelog
=========

Check out what's new, fixed, and updated in each version release of ThinkUp.

.. toctree::
:maxdepth: 1

1.0.3
1.0.2
1.0.1
1.0
0.17
0.16
0.15
0.14
0.13
0.12
0.11
0.10
0.09
0.08
0.07
0.06
0.05
0.04
0.03
0.02
0.01
2 changes: 1 addition & 1 deletion docs/source/index.rst
Expand Up @@ -28,4 +28,4 @@ engine.
contact
contribute/index
core
changelog
changelog/index
2 changes: 1 addition & 1 deletion docs/source/install/index.rst
Expand Up @@ -11,6 +11,6 @@ everything you need to know to get ThinkUp up and running on your web server.
install
advancedconfig
upgrade
permsintro
backup
perms
security
6 changes: 3 additions & 3 deletions docs/source/install/perms.rst
@@ -1,5 +1,5 @@
Understanding ThinkUp's Folder Permissions
==========================================
Minimum Required File Permissions
=================================

In order to run, ThinkUp must be able to write files to a specific data directory defined in the
``config.inc.php`` file as ``$THINKUP_CFG['datadir_path']``. By default the data directory is located in the root of
Expand Down Expand Up @@ -28,4 +28,4 @@ For security-related or other reasons, you may not want ThinkUp's data directory
To change the location ThinkUp's data directory, open the ``config.inc.php`` in any text editor and set your
desired location in the ``$THINKUP_CFG['datadir_path']`` value. Note that ThinkUp's data directory must be writable
by the web server and MySQL user for ThinkUp to function. Grant ThinkUp those access permissions using the
instructions above.
instructions above.
11 changes: 11 additions & 0 deletions docs/source/install/permsintro.rst
@@ -0,0 +1,11 @@
Understanding ThinkUp's Folder Permissions
==========================================

ThinkUp requires minimum folder permissions in order to run. Its optional web-based upgrader also requires certain
file permissions in order to complete successfully.

.. toctree::
:maxdepth: 1

perms
permsupgrade
19 changes: 19 additions & 0 deletions docs/source/install/permsupgrade.rst
@@ -0,0 +1,19 @@
Web-based Upgrader File Permissions
===================================

In order to use its web-based upgrader, ThinkUp must have the permssion able to write new application files.

The recommended and most secure way to enable the ThinkUp web-based upgrader is to change the owner of all of ThinkUp's
files and folders. The command to do this using sudo is:

``sudo chown -R apache your_thinkup_path``

Where your_thinkup_path is your installation's directory and apache is the name of the web server user.
(Note that this username could vary depending on your server.)

If you are unable to change owner (chown) the folder, a less secure but just as effective method is to make the folder
writable. To do that, you can run this command:

``chmod -R a+rw your_thinkup_path``

If possible, change the folder's owner to the web server user or group instead of setting its permissions to writable.
71 changes: 51 additions & 20 deletions docs/source/install/upgrade.rst
@@ -1,16 +1,46 @@
Upgrade ThinkUp
===============

To upgrade ThinkUp to its latest version, there are two steps. First, upgrade your installation's application code.
Then, upgrade its database structure.

.. Tip:: Before you begin, :doc:`back up your current ThinkUp installation's
data </install/backup>` in case anything goes wrong during the upgrade process.

Upgrade ThinkUp's Application Code
----------------------------------

To upgrade your existing installation to the latest version of ThinkUp, simply replace your current ThinkUp folder with
the most recent release while preserving your existing configuration file.

.. Tip:: First things first: back up ThinkUp's data. Before you begin, :doc:`back up your current ThinkUp installation's
data </install/backup>` in case anything goes wrong during the upgrade process.
Web-Based Upgrade (Greater Than Version 1.0.4)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

All versions of ThinkUp greater than 1.0.4 come with a web-based application upgrader built in. When there's a new
version of ThinkUp available to install, in ThinkUp's status bar, click on the "Upgrade ThinkUp" button.

**Prerequisites:**

In order for the web-based upgrade to complete successfully:

* All ThinkUp's application files and directories must be writable by the web server user. Find out more about
:doc:`the web-based upgrader's required folder permissions </install/permsupgrade>`.
* Your server must have at least 100 megabytes of free disk space available.

If your installation is able to upgrade itself and there's a new version available, click on the "Upgrade ThinkUp"
button to replace your installation's application files with the latest version.

**To recover from catastrophic failure**:

Before it replaces your application files, ThinkUp's web-based upgrader makes a backup copy of the original
installation files in your data directory in two parts: a zip file with all the application files except your config
file, and the config file. To recover from a catastrophic failure during the upgrade, manually replace
your installation files with the backup copy located in your data directory.

To upgrade ThinkUp, you'll need to update your installation's application code and its database structure.
Manual Upgrade
^^^^^^^^^^^^^^

Update ThinkUp's Application Code
---------------------------------
If you're unable to run the web-based upgrader, upgrade ThinkUp manually.

First, `download ThinkUp's latest release <http://thinkupapp.com/download/>`_ and extract the zip archive on your
computer. Then, log into your ThinkUp installation as an administrator.
Expand All @@ -21,32 +51,32 @@ server.

Finally, copy your existing configuration file--i.e., ``thinkup.old/config.inc.php``--into the new ThinkUp folder.

Reload ThinkUp in your web browser. Follow the on-screen instructions on how to set :doc:`ThinkUp's required folder
permissions </install/perms>` in your updated installation.
Reload ThinkUp in your web browser. Follow the on-screen instructions on how to set :doc:`ThinkUp's minimum required
folder permissions </install/perms>` in your updated installation.

Update ThinkUp's Database Structure
-----------------------------------
Upgrade ThinkUp's Database Structure
------------------------------------

Now that your installation has the most up-to-date code, that code may have to update your database structure to match
Now that your installation has the most up-to-date code, that code may have to upgrade your database structure to match
it. Relaod ThinkUp in your web browser. When you see the message "ThinkUp's database needs an update" click on the
"Update Now" link.

If the message reads "ThinkUp is currently in the process of upgrading. Please try back again in a little while", here's
:doc:`how to continue the upgrade process </troubleshoot/messages/upgrading>`.

Small Databases: Web-Based Upgrade
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Web-Based Upgrade (Small Databases)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The Upgrade page will let you know how many database migrations have to run to get up-to-date.

If your ThinkUp installation only has 1 or 2 moderately active social media accounts set up in it, and none of your
database tables have more than half a million rows, then you should use the easy web-based upgrader. ThinkUp will let
you know if any of your tables are this large when you begin the upgrade process.

Click on the "Update now" button to update ThinkUp's database structure.
Click on the "Upgrade Database" button to update ThinkUp's database structure.

Large Databases: Command Line Upgrade
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Command Line Upgrade (Large Databases)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If your ThinkUp installation has more than 2 very active social media accounts set up, chances are your database tables
are large. (We consider a ThinkUp database with any table over half a million rows large.)
Expand All @@ -64,16 +94,17 @@ This command will upgrade your database structure (and give you the option to ba

Your ThinkUp application code and database is now up-to-date. Great!

Developers Running Nightly Code
-------------------------------
Running Beta Versions or Code from GitHub
------------------------------------------

If you're a developer :doc:`running nightly code from ThinkUp's git repository </contribute/developers/devfromsource>`,
after you update ThinkUp's files from git, you'll need to catch up on any necessary database migrations.
If you're a developer :doc:`running nightly code from ThinkUp's git repository </contribute/developers/devfromsource>`
or a beta tester, after you upgrade ThinkUp's application code, you'll need to catch up on any necessary database
migrations.

As of beta 16 (v0.16), developers can use the CLI upgrade tool to run any new database migrations using the argument
"--with-new-sql":

``$ php upgrade.php --with-new-sql``
``$ cd install/cli/; php upgrade.php --with-new-sql``

The CLI tool will keep track of any migrations that have been applied and only run new migrations. Developers can just
run the tool with the "--with-new-sql" option to get their install up to date. This also applies to migration files
Expand Down
50 changes: 28 additions & 22 deletions docs/source/userguide/settings/application.rst
Expand Up @@ -3,13 +3,30 @@ Application (Administrators only)

Administrators can change application-level settings in ThinkUp.

Open registration
-----------------
Default service user
--------------------

Choose the public service user which will appear by default when a non-logged in user visits the ThinkUp dashboard.
By default, this is set to the last updated service user, that is, the service user which was last crawled
successfully.

If you set this to a public service user which becomes private, this setting will fall back to its default, the last
updated service user.

Open registration to new ThinkUp users
--------------------------------------

Allow new users to register for accounts on your ThinkUp installation. When this box is checked, ThinkUp's register link
will present a registration form. Otherwise, ThinkUp displays a message that registration is closed. The default value
is registration closed (unchecked).

Enable Developer Log
--------------------

Check this box if you want to see the :doc:`verbose, unformatted developer
log </troubleshoot/common/advanced/crawlerlog>` on the "Update Now" screen, instead of the quieter, formatted user log.
Once you change this setting, go back to the Dashboard and click on "Update Now" to see the change in action.

Enable reCAPTCHA
----------------

Expand All @@ -22,39 +39,28 @@ check the Enable ReCAPTCHA box and enter the keys.
If you do not have the `GD <http://php.net/manual/en/book.image.php>`_ library installed on your server,
reCAPTCHA is a good alternative CAPTCHA solution.

Enable beta upgrades
--------------------

Get notified when there is a new ThinkUp beta version available, and have the option to upgrade to it using the
web-based upgrader. **Proceed at your own risk!** ThinkUp betas are unstable versions for testers only. Some may
include database migrations that you must run manually (using ``$ cd install/cli/; php upgrade.php --with-new-sql``).

Disable the JSON API
--------------------

Check this box if you don't want to allow users or third-party applications access to public data via the
:doc:`ThinkUp API </userguide/api/index>`. When this box is checked, every API request will get
an :doc:`APIDisabledException </userguide/api/errors/apidisabled>`.

Disable Thread Embeds
Disable thread embeds
---------------------

Check this box if you don't want to allow users to
:doc:`embed ThinkUp threads on third-party web sites </userguide/listings/all/post_listings>` using a JavaScript
embed code. When this box is checked, the code will not be available for use.

Default service user
--------------------

Choose the public service user which will appear by default when a non-logged in user visits the ThinkUp dashboard.
By default, this is set to the last updated service user, that is, the service user which was last crawled
successfully.

If you set this to a public service user which becomes private, this setting will fall back to its default, the last
updated service user.

Developer Log
-------------

Check this box if you want to see the :doc:`verbose, unformatted developer
log </troubleshoot/common/advanced/crawlerlog>` on the "Update Now" screen, instead of the quieter, formatted user log.
Once you change this setting, go back to the Dashboard and click on "Update Now" to see the change in action.


Disable Usage Reporting
Disable usage reporting
-----------------------

ThinkUp sends usage information to `thinkupapp.com <http://thinkupapp.com>`_ when it checks if there's
Expand Down
4 changes: 2 additions & 2 deletions extras/scripts/generate-distribution
Expand Up @@ -24,7 +24,7 @@ rm -rf build/thinkup/_lib/extlib/simpletest/
rm -rf build/thinkup/test_installer/
rm -rf build/thinkup/data/*
cp -R webapp/data/README.md build/thinkup/data/.
rm build/thinkup/config.inc.php
rm -rf build/thinkup/config.inc.php

# Clean out dev/alpha plugins which shouldn't go to users
rm -rf build/thinkup/plugins/hellothinkup/
Expand All @@ -34,4 +34,4 @@ rm -rf build/thinkup/plugins/twitterrealtime/
cd build/
zip -r thinkup.zip thinkup
zip -d thinkup.zip __MACOSX* *.DS_Store *.ecoder_permissions_check.txt
rm -rf thinkup
rm -rf thinkup
6 changes: 3 additions & 3 deletions tests/TestOfBackupController.php
Expand Up @@ -105,14 +105,14 @@ public function testLoadBackupViewCLIWarn() {
$this->assertNull($v_mgr->getTemplateDataItem('high_table_row_count') ) ;

// table row counts are bad
$old_count = UpgradeController::$WARN_TABLE_ROW_COUNT;
UpgradeController::$WARN_TABLE_ROW_COUNT = 2;
$old_count = UpgradeDatabaseController::$WARN_TABLE_ROW_COUNT;
UpgradeDatabaseController::$WARN_TABLE_ROW_COUNT = 2;
$results = $controller->control();
$this->assertPattern('/we recommend that you use the/', $results);
$table_counts = $v_mgr->getTemplateDataItem('high_table_row_count');
$this->assertNotNull($table_counts);
$this->assertNotNull(3, $table_counts['count']); // tu_plugins, defaults to three
UpgradeController::$WARN_TABLE_ROW_COUNT = $old_count;
UpgradeDatabaseController::$WARN_TABLE_ROW_COUNT = $old_count;
}

public function XtestBackupCrawlerHasMutex() {
Expand Down

0 comments on commit 0e5e507

Please sign in to comment.