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