summaryrefslogtreecommitdiff
path: root/docs/deployment/upgrading.rst
blob: 3507da4147f5b592a6d5900bd74fec50d3e6060e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Upgrading
=========

This document provides some general tips and tricks that one can use when
upgrading an existing, production installation of Patchwork. If you are
interested in the specific changes between each release, refer to
:doc:`/releases/index` instead. If this is your first time installing
Patchwork, refer to the :doc:`installation` instead.

Before You Start
----------------

Before doing anything, always **backup your data**. This generally means
backing up your database, but it might also be a good idea to backup your
environment in case you encounter issues during the upgrade process.

While Patchwork won't explicitly prevent it, it's generally wise to avoid
upgrades spanning multiple releases in one go. An iterative upgrade approach
will provide an easier, if slower, upgrade process.

Identify Changed Scripts, Requirements, etc.
--------------------------------------------

:doc:`/releases/index` provides a comprehensive listing of all
backwards-incompatible changes that occur between releases of Patchwork.
Examples of such changes include:

* Moved/removed scripts and files

* Changes to the requirements, e.g. supported Django versions

* Changes to API that may affect, for example, third-party tools

It is important that you understand these changes and ensure any scripts you
may have, such as systemd scripts, are modified accordingly.

Understand What Requirements Have Changed
-----------------------------------------

New versions of Patchwork can often require additional or updated version of
dependencies, e.g. newer versions of Django. It is important that you
understand these requirements and can fulfil them. This is particularly true
for users relying on distro-provided packages, who may have to deal with older
versions of a package or may be missing a package altogether (though we try to
avoid this). Such changes are usually listed in the :doc:`/releases/index`, but
you can also diff the `requirements.txt` files in each release for comparison.

Collect Static Files
--------------------

New versions of Patchwork generally contain changes to the additional files
like images, CSS and JavaScript. To do this, run the `collectstatic`
management commands:

.. code-block:: shell

   $ ./manage.py collectstatic

Upgrade Your Database
---------------------

New versions of Patchwork may provide a number of schema and/or data migrations
which must be applied before starting the instance. To do this, run the
*migrate* management command:

.. code-block:: shell

   $ ./manage.py migrate

For more information on migrations, refer to `the Django documentation`__.

__ https://docs.djangoproject.com/en/2.2/topics/migrations/