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