##// END OF EJS Templates
docs: upgrade: misc. clarification on upgrade from 0.3.x to 0.4
Thomas De Schampheleire -
r7414:874ed3e5 default
parent child Browse files
Show More
@@ -1,226 +1,233 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.
58 database type, settings, location, etc. If you were running Kallithea 0.3.x or
59 older, this was ``sqlalchemy.db1.url``.
59
60
60
61
61 3. Activate the Kallithea virtual environment (if any)
62 3. Activate the Kallithea virtual environment (if any)
62 ------------------------------------------------------
63 ------------------------------------------------------
63
64
64 Verify that you are using the Python environment that you originally
65 Verify that you are using the Python environment that you originally
65 installed Kallithea in by running::
66 installed Kallithea in by running::
66
67
67 pip freeze
68 pip freeze
68
69
69 This will list all packages installed in the current environment. If
70 This will list all packages installed in the current environment. If
70 Kallithea isn't listed, activate the correct virtual environment.
71 Kallithea isn't listed, activate the correct virtual environment.
71 See the appropriate installation page for details.
72 See the appropriate installation page for details.
72
73
73
74
74 4. Install new version of Kallithea
75 4. Install new version of Kallithea
75 -----------------------------------
76 -----------------------------------
76
77
77 Please refer to the instructions for the installation method you
78 Please refer to the instructions for the installation method you
78 originally used to install Kallithea.
79 originally used to install Kallithea.
79
80
80 If you originally installed using pip, it is as simple as::
81 If you originally installed using pip, it is as simple as::
81
82
82 pip install --upgrade kallithea
83 pip install --upgrade kallithea
83
84
84 If you originally installed from version control, assuming you did not make
85 If you originally installed from version control, assuming you did not make
85 private changes (in which case you should adapt the instructions accordingly)::
86 private changes (in which case you should adapt the instructions accordingly)::
86
87
87 cd my-kallithea-clone
88 cd my-kallithea-clone
88 hg parent # make a note of the original revision
89 hg parent # make a note of the original revision
89 hg pull
90 hg pull
90 hg update
91 hg update
91 hg parent # make a note of the new revision
92 hg parent # make a note of the new revision
92 pip install --upgrade -e .
93 pip install --upgrade -e .
93
94
94 .. _upgrade_config:
95 .. _upgrade_config:
95
96
96
97
97 5. Upgrade your configuration
98 5. Upgrade your configuration
98 -----------------------------
99 -----------------------------
99
100
100 Run the following command to create a new configuration (``.ini``) file::
101 Run the following command to create a new configuration (``.ini``) file::
101
102
102 kallithea-cli config-create new.ini
103 kallithea-cli config-create new.ini
103
104
104 Then compare it with your old config file and see what changed.
105 Then compare it with your old config file and copy over the required
106 configuration values from the old to the new file.
105
107
106 .. note::
108 .. note::
107 Please always make sure your ``.ini`` files are up to date. Errors
109 Please always make sure your ``.ini`` files are up to date. Errors
108 can often be caused by missing parameters added in new versions.
110 can often be caused by missing parameters added in new versions.
109
111
110 .. _upgrade_db:
112 .. _upgrade_db:
111
113
112
114
113 6. Upgrade your database
115 6. Upgrade your database
114 ------------------------
116 ------------------------
115
117
116 .. note::
118 .. note::
117 If you are *downgrading* Kallithea, you should perform the database
119 If you are *downgrading* Kallithea, you should perform the database
118 migration step *before* installing the older version. (That is,
120 migration step *before* installing the older version. (That is,
119 always perform migrations using the most recent of the two versions
121 always perform migrations using the most recent of the two versions
120 you're migrating between.)
122 you're migrating between.)
121
123
122 First, run the following command to see your current database version::
124 First, run the following command to see your current database version::
123
125
124 alembic -c new.ini current
126 alembic -c new.ini current
125
127
126 Typical output will be something like "9358dc3d6828 (head)", which is
128 Typical output will be something like "9358dc3d6828 (head)", which is
127 the current Alembic database "revision ID". Write down the entire output
129 the current Alembic database "revision ID". Write down the entire output
128 for troubleshooting purposes.
130 for troubleshooting purposes.
129
131
130 The output will be empty if you're upgrading from Kallithea 0.3.x or
132 The output will be empty if you're upgrading from Kallithea 0.3.x or
131 older. That's expected. If you get an error that the config file was not
133 older. That's expected. If you get an error that the config file was not
132 found or has no ``[alembic]`` section, see the next section.
134 found or has no ``[alembic]`` section, see the next section.
133
135
134 Next, if you are performing an *upgrade*: Run the following command to
136 Next, if you are performing an *upgrade*: Run the following command to
135 upgrade your database to the current Kallithea version::
137 upgrade your database to the current Kallithea version::
136
138
137 alembic -c new.ini upgrade head
139 alembic -c new.ini upgrade head
138
140
139 If you are performing a *downgrade*: Run the following command to
141 If you are performing a *downgrade*: Run the following command to
140 downgrade your database to the given version::
142 downgrade your database to the given version::
141
143
142 alembic -c new.ini downgrade 0.4
144 alembic -c new.ini downgrade 0.4
143
145
144 Alembic will show the necessary migrations (if any) as it executes them.
146 Alembic will show the necessary migrations (if any) as it executes them.
145 If no "ERROR" is displayed, the command was successful.
147 If no "ERROR" is displayed, the command was successful.
146
148
147 Should an error occur, the database may be "stranded" half-way
149 Should an error occur, the database may be "stranded" half-way
148 through the migration, and you should restore it from backup.
150 through the migration, and you should restore it from backup.
149
151
150 Enabling old Kallithea config files for Alembic use
152 Enabling old Kallithea config files for Alembic use
151 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
153 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
152
154
153 Kallithea configuration files created before the introduction of Alembic
155 Kallithea configuration files created before the introduction of Alembic
154 (i.e. predating Kallithea 0.4) need to be updated for use with Alembic.
156 (i.e. predating Kallithea 0.4) need to be updated for use with Alembic.
155 Without this, Alembic will fail with an error like this::
157 Without this, Alembic will fail with an error like this::
156
158
157 FAILED: No config file 'my.ini' found, or file has no '[alembic]' section
159 FAILED: No config file 'my.ini' found, or file has no '[alembic]' section
158
160
159 .. note::
161 .. note::
160 If you followed this upgrade guide correctly, you will have created a
162 If you followed this upgrade guide correctly, you will have created a
161 new configuration file in section :ref:`Upgrading your configuration
163 new configuration file in section :ref:`Upgrading your configuration
162 <upgrade_config>`. When calling Alembic, make
164 <upgrade_config>`. When calling Alembic, make
163 sure to use this new config file. In this case, you should not get any
165 sure to use this new config file. In this case, you should not get any
164 errors and the below manual steps should not be needed.
166 errors and the below manual steps should not be needed.
165
167
166 If Alembic complains specifically about a missing ``alembic.ini``, it is
168 If Alembic complains specifically about a missing ``alembic.ini``, it is
167 likely because you did not specify a config file using the ``-c`` option.
169 likely because you did not specify a config file using the ``-c`` option.
168 On the other hand, if the mentioned config file actually exists, you
170 On the other hand, if the mentioned config file actually exists, you
169 need to append the following lines to it::
171 need to append the following lines to it::
170
172
171 [alembic]
173 [alembic]
172 script_location = kallithea:alembic
174 script_location = kallithea:alembic
173
175
174 Your config file should now work with Alembic.
176 Your config file should now work with Alembic.
175
177
176
178
177 7. Prepare the front-end
179 7. Prepare the front-end
178 ------------------------
180 ------------------------
179
181
180 Starting with Kallithea 0.4, external front-end dependencies are no longer
182 Starting with Kallithea 0.4, external front-end dependencies are no longer
181 shipped but need to be downloaded and/or generated at installation time. Run the
183 shipped but need to be downloaded and/or generated at installation time. Run the
182 following command::
184 following command::
183
185
184 kallithea-cli front-end-build
186 kallithea-cli front-end-build
185
187
186
188
187 8. Rebuild the Whoosh full-text index
189 8. Rebuild the Whoosh full-text index
188 -------------------------------------
190 -------------------------------------
189
191
190 It is recommended that you rebuild the Whoosh index after upgrading since
192 It is recommended that you rebuild the Whoosh index after upgrading since
191 new Whoosh versions can introduce incompatible index changes.
193 new Whoosh versions can introduce incompatible index changes.
192
194
193
195
194 9. Start the Kallithea web application
196 9. Start the Kallithea web application
195 --------------------------------------
197 --------------------------------------
196
198
197 This step once again depends entirely on the web server software used to
199 This step once again depends entirely on the web server software used to
198 serve Kallithea.
200 serve Kallithea.
199
201
202 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::
204
205 gearbox serve -c new.ini
206
200 Before starting the new version of Kallithea, you may find it helpful to
207 Before starting the new version of Kallithea, you may find it helpful to
201 clear out your log file so that new errors are readily apparent.
208 clear out your log file so that new errors are readily apparent.
202
209
203 .. note::
210 .. note::
204 If you're using Celery, make sure you restart all instances of it after
211 If you're using Celery, make sure you restart all instances of it after
205 upgrade.
212 upgrade.
206
213
207
214
208 10. Update Git repository hooks
215 10. Update Git repository hooks
209 -------------------------------
216 -------------------------------
210
217
211 It is possible that an upgrade involves changes to the Git hooks installed by
218 It is possible that an upgrade involves changes to the Git hooks installed by
212 Kallithea. As these hooks are created inside the repositories on the server
219 Kallithea. As these hooks are created inside the repositories on the server
213 filesystem, they are not updated automatically when upgrading Kallithea itself.
220 filesystem, they are not updated automatically when upgrading Kallithea itself.
214
221
215 To update the hooks of your Git repositories:
222 To update the hooks of your Git repositories:
216
223
217 * Go to *Admin > Settings > Remap and Rescan*
224 * Go to *Admin > Settings > Remap and Rescan*
218 * Select the checkbox *Install Git hooks*
225 * Select the checkbox *Install Git hooks*
219 * Click the button *Rescan repositories*
226 * Click the button *Rescan repositories*
220
227
221 .. note::
228 .. note::
222 Kallithea does not use hooks on Mercurial repositories. This step is thus
229 Kallithea does not use hooks on Mercurial repositories. This step is thus
223 not necessary if you only have Mercurial repositories.
230 not necessary if you only have Mercurial repositories.
224
231
225
232
226 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
233 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
General Comments 0
You need to be logged in to leave comments. Login now