##// END OF EJS Templates
docs: suggest creating a new virtual environment for major upgrades...
Thomas De Schampheleire -
r7501:de92f48c default
parent child Browse files
Show More
@@ -1,233 +1,246 b''
1 .. _upgrade:
1 .. _upgrade:
2
2
3 ===================
3 ===================
4 Upgrading Kallithea
4 Upgrading Kallithea
5 ===================
5 ===================
6
6
7 This describes the process for upgrading Kallithea, independently of the
7 This describes the process for upgrading Kallithea, independently of the
8 Kallithea installation method.
8 Kallithea installation method.
9
9
10 .. note::
10 .. note::
11 If you are upgrading from a RhodeCode installation, you must first
11 If you are upgrading from a RhodeCode installation, you must first
12 install Kallithea 0.3.2 and follow the instructions in the 0.3.2
12 install Kallithea 0.3.2 and follow the instructions in the 0.3.2
13 README to perform a one-time conversion of the database from
13 README to perform a one-time conversion of the database from
14 RhodeCode to Kallithea, before upgrading to the latest version
14 RhodeCode to Kallithea, before upgrading to the latest version
15 of Kallithea.
15 of Kallithea.
16
16
17
17
18 1. Stop the Kallithea web application
18 1. Stop the Kallithea web application
19 -------------------------------------
19 -------------------------------------
20
20
21 This step depends entirely on the web server software used to serve
21 This step depends entirely on the web server software used to serve
22 Kallithea, but in any case, Kallithea should not be running during
22 Kallithea, but in any case, Kallithea should not be running during
23 the upgrade.
23 the upgrade.
24
24
25 .. note::
25 .. note::
26 If you're using Celery, make sure you stop all instances during the
26 If you're using Celery, make sure you stop all instances during the
27 upgrade.
27 upgrade.
28
28
29
29
30 2. Create a backup of both database and configuration
30 2. Create a backup of both database and configuration
31 -----------------------------------------------------
31 -----------------------------------------------------
32
32
33 You are of course strongly recommended to make backups regularly, but it
33 You are of course strongly recommended to make backups regularly, but it
34 is *especially* important to make a full database and configuration
34 is *especially* important to make a full database and configuration
35 backup before performing a Kallithea upgrade.
35 backup before performing a Kallithea upgrade.
36
36
37 Back up your configuration
37 Back up your configuration
38 ^^^^^^^^^^^^^^^^^^^^^^^^^^
38 ^^^^^^^^^^^^^^^^^^^^^^^^^^
39
39
40 Make a copy of your Kallithea configuration (``.ini``) file.
40 Make a copy of your Kallithea configuration (``.ini``) file.
41
41
42 If you are using :ref:`rcextensions <customization>`, you should also
42 If you are using :ref:`rcextensions <customization>`, you should also
43 make a copy of the entire ``rcextensions`` directory.
43 make a copy of the entire ``rcextensions`` directory.
44
44
45 Back up your database
45 Back up your database
46 ^^^^^^^^^^^^^^^^^^^^^
46 ^^^^^^^^^^^^^^^^^^^^^
47
47
48 If using SQLite, simply make a copy of the Kallithea database (``.db``)
48 If using SQLite, simply make a copy of the Kallithea database (``.db``)
49 file.
49 file.
50
50
51 If using PostgreSQL, please consult the documentation for the ``pg_dump``
51 If using PostgreSQL, please consult the documentation for the ``pg_dump``
52 utility.
52 utility.
53
53
54 If using MySQL, please consult the documentation for the ``mysqldump``
54 If using MySQL, please consult the documentation for the ``mysqldump``
55 utility.
55 utility.
56
56
57 Look for ``sqlalchemy.url`` in your configuration file to determine
57 Look for ``sqlalchemy.url`` in your configuration file to determine
58 database type, settings, location, etc. If you were running Kallithea 0.3.x or
58 database type, settings, location, etc. If you were running Kallithea 0.3.x or
59 older, this was ``sqlalchemy.db1.url``.
59 older, this was ``sqlalchemy.db1.url``.
60
60
61
61
62 3. Activate the Kallithea virtual environment (if any)
62 3. Activate or recreate the Kallithea virtual environment (if any)
63 ------------------------------------------------------
63 ------------------------------------------------------------------
64
65 .. note::
66 If you did not install Kallithea in a virtual environment, skip this step.
64
67
65 Verify that you are using the Python environment that you originally
68 For major upgrades, e.g. from 0.3.x to 0.4.x, it is recommended to create a new
66 installed Kallithea in by running::
69 virtual environment, rather than reusing the old. For minor upgrades, e.g.
70 within the 0.4.x range, this is not really necessary (but equally fine).
71
72 To create a new virtual environment, please refer to the appropriate
73 installation page for details. After creating and activating the new virtual
74 environment, proceed with the rest of the upgrade process starting from the next
75 section.
76
77 To reuse the same virtual environment, first activate it, then verify that you
78 are using the correct environment by running::
67
79
68 pip freeze
80 pip freeze
69
81
70 This will list all packages installed in the current environment. If
82 This will list all packages installed in the current environment. If
71 Kallithea isn't listed, activate the correct virtual environment.
83 Kallithea isn't listed, deactivate the environment and then activate the correct
72 See the appropriate installation page for details.
84 one, or recreate a new environment. See the appropriate installation page for
85 details.
73
86
74
87
75 4. Install new version of Kallithea
88 4. Install new version of Kallithea
76 -----------------------------------
89 -----------------------------------
77
90
78 Please refer to the instructions for the installation method you
91 Please refer to the instructions for the installation method you
79 originally used to install Kallithea.
92 originally used to install Kallithea.
80
93
81 If you originally installed using pip, it is as simple as::
94 If you originally installed using pip, it is as simple as::
82
95
83 pip install --upgrade kallithea
96 pip install --upgrade kallithea
84
97
85 If you originally installed from version control, assuming you did not make
98 If you originally installed from version control, assuming you did not make
86 private changes (in which case you should adapt the instructions accordingly)::
99 private changes (in which case you should adapt the instructions accordingly)::
87
100
88 cd my-kallithea-clone
101 cd my-kallithea-clone
89 hg parent # make a note of the original revision
102 hg parent # make a note of the original revision
90 hg pull
103 hg pull
91 hg update
104 hg update
92 hg parent # make a note of the new revision
105 hg parent # make a note of the new revision
93 pip install --upgrade -e .
106 pip install --upgrade -e .
94
107
95 .. _upgrade_config:
108 .. _upgrade_config:
96
109
97
110
98 5. Upgrade your configuration
111 5. Upgrade your configuration
99 -----------------------------
112 -----------------------------
100
113
101 Run the following command to create a new configuration (``.ini``) file::
114 Run the following command to create a new configuration (``.ini``) file::
102
115
103 kallithea-cli config-create new.ini
116 kallithea-cli config-create new.ini
104
117
105 Then compare it with your old config file and copy over the required
118 Then compare it with your old config file and copy over the required
106 configuration values from the old to the new file.
119 configuration values from the old to the new file.
107
120
108 .. note::
121 .. note::
109 Please always make sure your ``.ini`` files are up to date. Errors
122 Please always make sure your ``.ini`` files are up to date. Errors
110 can often be caused by missing parameters added in new versions.
123 can often be caused by missing parameters added in new versions.
111
124
112 .. _upgrade_db:
125 .. _upgrade_db:
113
126
114
127
115 6. Upgrade your database
128 6. Upgrade your database
116 ------------------------
129 ------------------------
117
130
118 .. note::
131 .. note::
119 If you are *downgrading* Kallithea, you should perform the database
132 If you are *downgrading* Kallithea, you should perform the database
120 migration step *before* installing the older version. (That is,
133 migration step *before* installing the older version. (That is,
121 always perform migrations using the most recent of the two versions
134 always perform migrations using the most recent of the two versions
122 you're migrating between.)
135 you're migrating between.)
123
136
124 First, run the following command to see your current database version::
137 First, run the following command to see your current database version::
125
138
126 alembic -c new.ini current
139 alembic -c new.ini current
127
140
128 Typical output will be something like "9358dc3d6828 (head)", which is
141 Typical output will be something like "9358dc3d6828 (head)", which is
129 the current Alembic database "revision ID". Write down the entire output
142 the current Alembic database "revision ID". Write down the entire output
130 for troubleshooting purposes.
143 for troubleshooting purposes.
131
144
132 The output will be empty if you're upgrading from Kallithea 0.3.x or
145 The output will be empty if you're upgrading from Kallithea 0.3.x or
133 older. That's expected. If you get an error that the config file was not
146 older. That's expected. If you get an error that the config file was not
134 found or has no ``[alembic]`` section, see the next section.
147 found or has no ``[alembic]`` section, see the next section.
135
148
136 Next, if you are performing an *upgrade*: Run the following command to
149 Next, if you are performing an *upgrade*: Run the following command to
137 upgrade your database to the current Kallithea version::
150 upgrade your database to the current Kallithea version::
138
151
139 alembic -c new.ini upgrade head
152 alembic -c new.ini upgrade head
140
153
141 If you are performing a *downgrade*: Run the following command to
154 If you are performing a *downgrade*: Run the following command to
142 downgrade your database to the given version::
155 downgrade your database to the given version::
143
156
144 alembic -c new.ini downgrade 0.4
157 alembic -c new.ini downgrade 0.4
145
158
146 Alembic will show the necessary migrations (if any) as it executes them.
159 Alembic will show the necessary migrations (if any) as it executes them.
147 If no "ERROR" is displayed, the command was successful.
160 If no "ERROR" is displayed, the command was successful.
148
161
149 Should an error occur, the database may be "stranded" half-way
162 Should an error occur, the database may be "stranded" half-way
150 through the migration, and you should restore it from backup.
163 through the migration, and you should restore it from backup.
151
164
152 Enabling old Kallithea config files for Alembic use
165 Enabling old Kallithea config files for Alembic use
153 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
166 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154
167
155 Kallithea configuration files created before the introduction of Alembic
168 Kallithea configuration files created before the introduction of Alembic
156 (i.e. predating Kallithea 0.4) need to be updated for use with Alembic.
169 (i.e. predating Kallithea 0.4) need to be updated for use with Alembic.
157 Without this, Alembic will fail with an error like this::
170 Without this, Alembic will fail with an error like this::
158
171
159 FAILED: No config file 'my.ini' found, or file has no '[alembic]' section
172 FAILED: No config file 'my.ini' found, or file has no '[alembic]' section
160
173
161 .. note::
174 .. note::
162 If you followed this upgrade guide correctly, you will have created a
175 If you followed this upgrade guide correctly, you will have created a
163 new configuration file in section :ref:`Upgrading your configuration
176 new configuration file in section :ref:`Upgrading your configuration
164 <upgrade_config>`. When calling Alembic, make
177 <upgrade_config>`. When calling Alembic, make
165 sure to use this new config file. In this case, you should not get any
178 sure to use this new config file. In this case, you should not get any
166 errors and the below manual steps should not be needed.
179 errors and the below manual steps should not be needed.
167
180
168 If Alembic complains specifically about a missing ``alembic.ini``, it is
181 If Alembic complains specifically about a missing ``alembic.ini``, it is
169 likely because you did not specify a config file using the ``-c`` option.
182 likely because you did not specify a config file using the ``-c`` option.
170 On the other hand, if the mentioned config file actually exists, you
183 On the other hand, if the mentioned config file actually exists, you
171 need to append the following lines to it::
184 need to append the following lines to it::
172
185
173 [alembic]
186 [alembic]
174 script_location = kallithea:alembic
187 script_location = kallithea:alembic
175
188
176 Your config file should now work with Alembic.
189 Your config file should now work with Alembic.
177
190
178
191
179 7. Prepare the front-end
192 7. Prepare the front-end
180 ------------------------
193 ------------------------
181
194
182 Starting with Kallithea 0.4, external front-end dependencies are no longer
195 Starting with Kallithea 0.4, external front-end dependencies are no longer
183 shipped but need to be downloaded and/or generated at installation time. Run the
196 shipped but need to be downloaded and/or generated at installation time. Run the
184 following command::
197 following command::
185
198
186 kallithea-cli front-end-build
199 kallithea-cli front-end-build
187
200
188
201
189 8. Rebuild the Whoosh full-text index
202 8. Rebuild the Whoosh full-text index
190 -------------------------------------
203 -------------------------------------
191
204
192 It is recommended that you rebuild the Whoosh index after upgrading since
205 It is recommended that you rebuild the Whoosh index after upgrading since
193 new Whoosh versions can introduce incompatible index changes.
206 new Whoosh versions can introduce incompatible index changes.
194
207
195
208
196 9. Start the Kallithea web application
209 9. Start the Kallithea web application
197 --------------------------------------
210 --------------------------------------
198
211
199 This step once again depends entirely on the web server software used to
212 This step once again depends entirely on the web server software used to
200 serve Kallithea.
213 serve Kallithea.
201
214
202 If you were running Kallithea 0.3.x or older and were using ``paster serve
215 If you were running Kallithea 0.3.x or older and were using ``paster serve
203 my.ini`` before, then the corresponding command in Kallithea 0.4 and later is::
216 my.ini`` before, then the corresponding command in Kallithea 0.4 and later is::
204
217
205 gearbox serve -c new.ini
218 gearbox serve -c new.ini
206
219
207 Before starting the new version of Kallithea, you may find it helpful to
220 Before starting the new version of Kallithea, you may find it helpful to
208 clear out your log file so that new errors are readily apparent.
221 clear out your log file so that new errors are readily apparent.
209
222
210 .. note::
223 .. note::
211 If you're using Celery, make sure you restart all instances of it after
224 If you're using Celery, make sure you restart all instances of it after
212 upgrade.
225 upgrade.
213
226
214
227
215 10. Update Git repository hooks
228 10. Update Git repository hooks
216 -------------------------------
229 -------------------------------
217
230
218 It is possible that an upgrade involves changes to the Git hooks installed by
231 It is possible that an upgrade involves changes to the Git hooks installed by
219 Kallithea. As these hooks are created inside the repositories on the server
232 Kallithea. As these hooks are created inside the repositories on the server
220 filesystem, they are not updated automatically when upgrading Kallithea itself.
233 filesystem, they are not updated automatically when upgrading Kallithea itself.
221
234
222 To update the hooks of your Git repositories:
235 To update the hooks of your Git repositories:
223
236
224 * Go to *Admin > Settings > Remap and Rescan*
237 * Go to *Admin > Settings > Remap and Rescan*
225 * Select the checkbox *Install Git hooks*
238 * Select the checkbox *Install Git hooks*
226 * Click the button *Rescan repositories*
239 * Click the button *Rescan repositories*
227
240
228 .. note::
241 .. note::
229 Kallithea does not use hooks on Mercurial repositories. This step is thus
242 Kallithea does not use hooks on Mercurial repositories. This step is thus
230 not necessary if you only have Mercurial repositories.
243 not necessary if you only have Mercurial repositories.
231
244
232
245
233 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
246 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
General Comments 0
You need to be logged in to leave comments. Login now