Skip to content

Commit

Permalink
[#617] Tweak source install upgrade docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hammond committed Apr 19, 2013
1 parent 26b7d7e commit d3eaf3f
Showing 1 changed file with 33 additions and 46 deletions.
79 changes: 33 additions & 46 deletions doc/install-from-source.rst
Expand Up @@ -247,105 +247,92 @@ sysadmin account and deploying CKAN with Apache.
Upgrade a source install
~~~~~~~~~~~~~~~~~~~~~~~~

Before upgrading your version of CKAN you should check that any custom
templates or extensions you're using work with the new version of CKAN. For
example, you could install the new version of CKAN in a new virtual environment
and use that to test your templates and extensions.
.. note::

You should also read the `CKAN Changelog <https://github.com/okfn/ckan/blob/master/CHANGELOG.txt>`_
to see if there are any extra notes to be aware of when upgrading to the new
version.
Before upgrading your version of CKAN you should check that any custom
templates or extensions you're using work with the new version of CKAN. For
example, you could install the new version of CKAN in a new virtual
environment and use that to test your templates and extensions.

.. note::

If you installed CKAN from source, you will need to activate the
virtualenv and switch to the ckan source directory, e.g.::
You should also read the `CKAN Changelog
<https://github.com/okfn/ckan/blob/master/CHANGELOG.txt>`_ to see if there
are any extra notes to be aware of when upgrading to the new version.

. ~/pyenv/bin/activate
cd ~/pyenv/src/ckan

In this case, you don't need to specifiy the `--plugin` or `--config`
parameters when executing the paster commands, e.g.::
1. Activate your virtualenv and switch to the ckan source directory, e.g.::

(pyenv):~/pyenv/src/ckan$ paster user list
. ~/pyenv/bin/activate
cd ~/pyenv/src/ckan

1. Backup your CKAN database using the ``ckan db dump`` command, for
2. Backup your CKAN database using the ``ckan db dump`` command, for
example::

paster --plugin=ckan db dump --config=/path/to/your/ckan.ini
my_ckan_database.pg_dump
paster --plugin=ckan db dump --config=/path/to/your/ckan.ini my_ckan_database.pg_dump

This will create a file called ``my_ckan_database.pg_dump``, if something
goes wrong with the CKAN upgrade you can use this file to restore the
database to its pre-upgrade state. See :ref:`dumping and loading` for
details of the `ckan db dump` and `ckan db load` commands.

2. Checkout the new CKAN version from git, for example::
3. Checkout the new CKAN version from git, for example::

cd pyenv/src/ckan
git fetch
git checkout release-v2.0

If you have any CKAN extensions installed from source, you may need to
checkout newer versions of the extensions at this point as well. Refer to
the documentation for each extension.

3. Update CKAN's dependencies. Make sure that your CKAN virtual environment
is active, then run this command::
4. Update CKAN's dependencies::

pip install --upgrade -r /path/to/your/pyenv/ckan/ckan/pip-requirements.txt
pip install --upgrade -r pip-requirements.txt

4. If CKAN's Solr schema version has changed between the CKAN versions you're
upgrading from and to, then you need to update your solr schema symlink
(Check the CHANGELOG to see if it necessary to update the schema,
otherwise you can skip this step. This will be required from CKAN 1.8 to
2.0.).
5. If you are upgrading to a new major version of CKAN (for example if you are
upgrading to CKAN 2.0, 2.1 etc.), then you need to update your Solr schema
symlink.

When :ref:`setting up solr` you created a symlink
``/etc/solr/conf/schema.xml`` linking to a CKAN Solr schema file such as
``/path/to/your/pyenv/ckan/ckan/config/solr/schema-1.4.xml``. This symlink
should be updated to point to the latest schema file in
``/path/to/your/pyenv/ckan/ckan/config/solr/``, if it doesn't already.
``~/pyenv/ckan/ckan/config/solr/``, if it doesn't already.

For example, to update the symlink::

sudo mv /etc/solr/conf/schema.xml /etc/solr/conf/schema.xml.bak
sudo ln -s ~/pyenv/src/ckan/ckan/config/solr/schema-2.0.xml /etc/solr/conf/schema.xml
sudo mv /etc/solr/conf/schema.xml /etc/solr/conf/schema.xml.bak
sudo ln -s ~/pyenv/src/ckan/ckan/config/solr/schema-2.0.xml /etc/solr/conf/schema.xml

5. If you are upgrading to a new major version of CKAN (for example if you
are upgrading to CKAN 2.0, etc.), update your CKAN database's schema
6. If you are upgrading to a new major version of CKAN (for example if you
are upgrading to CKAN 2.0, 2.1 etc.), update your CKAN database's schema
using the ``ckan db upgrade`` command.

.. warning ::
.. warning ::
To avoid problems during the database upgrade, comment out any
plugins that you have enabled on your ini file. You can uncomment
them back when the upgrade finishes.
To avoid problems during the database upgrade, comment out any plugins
that you have enabled in your ini file. You can uncomment them again when
the upgrade finishes.
For example::

paster --plugin=ckan db upgrade --config=/path/to/your/ckan.ini

If you are just upgrading to a minor version of CKAN (for example
upgrading from version 2.0 to 2.0.1) then it should not be necessary to
upgrade your database.

See :ref:`upgrade migration` for details of the ``ckan db upgrade``
command.

6. After updating the symlink (and/or the database), you must rebuild your
search index by running the ``ckan search-index rebuild`` command, for
example::
7. Rebuild your search index by running the ``ckan search-index rebuild``
command::

paster --plugin=ckan search-index rebuild -r --config=/path/to/your/ckan.ini

See :ref:`rebuild search index` for details of the
``ckan search-index rebuild`` command.

7. Finally, restart your web server. For example if you have deployed CKAN
8. Finally, restart your web server. For example if you have deployed CKAN
using the Apache web server on Ubuntu linux, run this command::

sudo service apache2 restart

8. You're done! You should now be able to visit your CKAN website in your web
browser and see that it's now running the new version of CKAN.
9. You're done! You should now be able to visit your CKAN website in your web
browser and see that it's running the new version of CKAN.

0 comments on commit d3eaf3f

Please sign in to comment.