##// END OF EJS Templates
repo-scan: recommend running this to reinstall Git hooks after upgrading...
Mads Kiilerich -
r8554:92894fcc default
parent child Browse files
Show More
@@ -1,243 +1,247 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 custom :ref:`extensions <customization>`, you should also
42 If you are using custom :ref:`extensions <customization>`, you should also
43 make a copy of the ``extensions.py`` file.
43 make a copy of the ``extensions.py`` file.
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 MariaDB/MySQL, please consult the documentation for the ``mysqldump``
54 If using MariaDB/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 or recreate the Kallithea virtual environment (if any)
62 3. Activate or recreate the Kallithea virtual environment (if any)
63 ------------------------------------------------------------------
63 ------------------------------------------------------------------
64
64
65 .. note::
65 .. note::
66 If you did not install Kallithea in a virtual environment, skip this step.
66 If you did not install Kallithea in a virtual environment, skip this step.
67
67
68 For major upgrades, e.g. from 0.3.x to 0.4.x, it is recommended to create a new
68 For major upgrades, e.g. from 0.3.x to 0.4.x, it is recommended to create a new
69 virtual environment, rather than reusing the old. For minor upgrades, e.g.
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).
70 within the 0.4.x range, this is not really necessary (but equally fine).
71
71
72 To create a new virtual environment, please refer to the appropriate
72 To create a new virtual environment, please refer to the appropriate
73 installation page for details. After creating and activating the new virtual
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
74 environment, proceed with the rest of the upgrade process starting from the next
75 section.
75 section.
76
76
77 To reuse the same virtual environment, first activate it, then verify that you
77 To reuse the same virtual environment, first activate it, then verify that you
78 are using the correct environment by running::
78 are using the correct environment by running::
79
79
80 pip freeze
80 pip freeze
81
81
82 This will list all packages installed in the current environment. If
82 This will list all packages installed in the current environment. If
83 Kallithea isn't listed, deactivate the environment and then activate the correct
83 Kallithea isn't listed, deactivate the environment and then activate the correct
84 one, or recreate a new environment. See the appropriate installation page for
84 one, or recreate a new environment. See the appropriate installation page for
85 details.
85 details.
86
86
87
87
88 4. Install new version of Kallithea
88 4. Install new version of Kallithea
89 -----------------------------------
89 -----------------------------------
90
90
91 Please refer to the instructions for the installation method you
91 Please refer to the instructions for the installation method you
92 originally used to install Kallithea.
92 originally used to install Kallithea.
93
93
94 If you originally installed using pip, it is as simple as::
94 If you originally installed using pip, it is as simple as::
95
95
96 pip install --upgrade kallithea
96 pip install --upgrade kallithea
97
97
98 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
99 private changes (in which case you should adapt the instructions accordingly)::
99 private changes (in which case you should adapt the instructions accordingly)::
100
100
101 cd my-kallithea-clone
101 cd my-kallithea-clone
102 hg parent # make a note of the original revision
102 hg parent # make a note of the original revision
103 hg pull
103 hg pull
104 hg update
104 hg update
105 hg parent # make a note of the new revision
105 hg parent # make a note of the new revision
106 pip install --upgrade -e .
106 pip install --upgrade -e .
107
107
108 .. _upgrade_config:
108 .. _upgrade_config:
109
109
110
110
111 5. Upgrade your configuration
111 5. Upgrade your configuration
112 -----------------------------
112 -----------------------------
113
113
114 Run the following command to create a new configuration (``.ini``) file::
114 Run the following command to create a new configuration (``.ini``) file::
115
115
116 kallithea-cli config-create new.ini
116 kallithea-cli config-create new.ini
117
117
118 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
119 configuration values from the old to the new file.
119 configuration values from the old to the new file.
120
120
121 .. note::
121 .. note::
122 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
123 can often be caused by missing parameters added in new versions.
123 can often be caused by missing parameters added in new versions.
124
124
125 .. _upgrade_db:
125 .. _upgrade_db:
126
126
127
127
128 6. Upgrade your database
128 6. Upgrade your database
129 ------------------------
129 ------------------------
130
130
131 .. note::
131 .. note::
132 If you are *downgrading* Kallithea, you should perform the database
132 If you are *downgrading* Kallithea, you should perform the database
133 migration step *before* installing the older version. (That is,
133 migration step *before* installing the older version. (That is,
134 always perform migrations using the most recent of the two versions
134 always perform migrations using the most recent of the two versions
135 you're migrating between.)
135 you're migrating between.)
136
136
137 First, run the following command to see your current database version::
137 First, run the following command to see your current database version::
138
138
139 alembic -c new.ini current
139 alembic -c new.ini current
140
140
141 Typical output will be something like "9358dc3d6828 (head)", which is
141 Typical output will be something like "9358dc3d6828 (head)", which is
142 the current Alembic database "revision ID". Write down the entire output
142 the current Alembic database "revision ID". Write down the entire output
143 for troubleshooting purposes.
143 for troubleshooting purposes.
144
144
145 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
146 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
147 found or has no ``[alembic]`` section, see the next section.
147 found or has no ``[alembic]`` section, see the next section.
148
148
149 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
150 upgrade your database to the current Kallithea version::
150 upgrade your database to the current Kallithea version::
151
151
152 alembic -c new.ini upgrade head
152 alembic -c new.ini upgrade head
153
153
154 If you are performing a *downgrade*: Run the following command to
154 If you are performing a *downgrade*: Run the following command to
155 downgrade your database to the given version::
155 downgrade your database to the given version::
156
156
157 alembic -c new.ini downgrade 0.4
157 alembic -c new.ini downgrade 0.4
158
158
159 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.
160 If no "ERROR" is displayed, the command was successful.
160 If no "ERROR" is displayed, the command was successful.
161
161
162 Should an error occur, the database may be "stranded" half-way
162 Should an error occur, the database may be "stranded" half-way
163 through the migration, and you should restore it from backup.
163 through the migration, and you should restore it from backup.
164
164
165 Enabling old Kallithea config files for Alembic use
165 Enabling old Kallithea config files for Alembic use
166 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
166 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
167
167
168 Kallithea configuration files created before the introduction of Alembic
168 Kallithea configuration files created before the introduction of Alembic
169 (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.
170 Without this, Alembic will fail with an error like this::
170 Without this, Alembic will fail with an error like this::
171
171
172 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
173
173
174 .. note::
174 .. note::
175 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
176 new configuration file in section :ref:`Upgrading your configuration
176 new configuration file in section :ref:`Upgrading your configuration
177 <upgrade_config>`. When calling Alembic, make
177 <upgrade_config>`. When calling Alembic, make
178 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
179 errors and the below manual steps should not be needed.
179 errors and the below manual steps should not be needed.
180
180
181 If Alembic complains specifically about a missing ``alembic.ini``, it is
181 If Alembic complains specifically about a missing ``alembic.ini``, it is
182 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.
183 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
184 need to append the following lines to it::
184 need to append the following lines to it::
185
185
186 [alembic]
186 [alembic]
187 script_location = kallithea:alembic
187 script_location = kallithea:alembic
188
188
189 Your config file should now work with Alembic.
189 Your config file should now work with Alembic.
190
190
191
191
192 7. Prepare the front-end
192 7. Prepare the front-end
193 ------------------------
193 ------------------------
194
194
195 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
196 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
197 following command::
197 following command::
198
198
199 kallithea-cli front-end-build
199 kallithea-cli front-end-build
200
200
201
201
202 8. Rebuild the Whoosh full-text index
202 8. Rebuild the Whoosh full-text index
203 -------------------------------------
203 -------------------------------------
204
204
205 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
206 new Whoosh versions can introduce incompatible index changes.
206 new Whoosh versions can introduce incompatible index changes.
207
207
208
208
209 9. Start the Kallithea web application
209 9. Start the Kallithea web application
210 --------------------------------------
210 --------------------------------------
211
211
212 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
213 serve Kallithea.
213 serve Kallithea.
214
214
215 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
216 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::
217
217
218 gearbox serve -c new.ini
218 gearbox serve -c new.ini
219
219
220 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
221 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.
222
222
223 .. note::
223 .. note::
224 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
225 upgrade.
225 upgrade.
226
226
227
227
228 10. Update Git repository hooks
228 10. Update Git repository hooks
229 -------------------------------
229 -------------------------------
230
230
231 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
232 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
233 filesystem, they are not updated automatically when upgrading Kallithea itself.
233 filesystem, they are not updated automatically when upgrading Kallithea itself.
234
234
235 To update the hooks of your Git repositories:
235 To update the hooks of your Git repositories, run::
236
237 kallithea-cli repo-scan -c my.ini --install-git-hooks
238
239 Or:
236
240
237 * Go to *Admin > Settings > Remap and Rescan*
241 * Go to *Admin > Settings > Remap and Rescan*
238 * Select the checkbox *Install Git hooks*
242 * Select the checkbox *Install Git hooks*
239 * Click the button *Rescan repositories*
243 * Click the button *Rescan repositories*
240
244
241 .. note::
245 .. note::
242 Kallithea does not use hooks on Mercurial repositories. This step is thus
246 Kallithea does not use hooks on Mercurial repositories. This step is thus
243 not necessary if you only have Mercurial repositories.
247 not necessary if you only have Mercurial repositories.
General Comments 0
You need to be logged in to leave comments. Login now