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