Show More
@@ -1,264 +1,300 b'' | |||
|
1 | 1 | .. _admin-tricks: |
|
2 | 2 | |
|
3 | 3 | One-time Admin Tasks |
|
4 | 4 | -------------------- |
|
5 | 5 | |
|
6 | 6 | * :ref:`web-analytics` |
|
7 | 7 | * :ref:`admin-tricks-license` |
|
8 | 8 | * :ref:`announcements` |
|
9 | 9 | * :ref:`md-rst` |
|
10 | 10 | * :ref:`repo-stats` |
|
11 | 11 | * :ref:`server-side-merge` |
|
12 | 12 | * :ref:`remap-rescan` |
|
13 | 13 | * :ref:`custom-hooks` |
|
14 | 14 | * :ref:`clear-repo-cache` |
|
15 | 15 | * :ref:`set-repo-pub` |
|
16 | 16 | * :ref:`ping` |
|
17 | 17 | |
|
18 | 18 | .. _web-analytics: |
|
19 | 19 | |
|
20 | 20 | Adding Web Analytics |
|
21 | 21 | ^^^^^^^^^^^^^^^^^^^^ |
|
22 | 22 | |
|
23 | 23 | If you wish to add a Google Analytics, or any other kind of tracker to your |
|
24 | 24 | |RCE| instance you can add the necessary codes to the header or footer |
|
25 | 25 | section of each instance using the following steps: |
|
26 | 26 | |
|
27 | 27 | 1. From the |RCE| interface, select |
|
28 | 28 | :menuselection:`Admin --> Settings --> Global` |
|
29 | 29 | 2. To add a tracking code to you instance, enter it in the header or footer |
|
30 | 30 | section and select **Save** |
|
31 | 31 | |
|
32 | 32 | Use the example templates in the drop-down menu to set up your configuration. |
|
33 | 33 | |
|
34 | 34 | .. _admin-tricks-license: |
|
35 | 35 | |
|
36 | 36 | Licence Key Management |
|
37 | 37 | ^^^^^^^^^^^^^^^^^^^^^^ |
|
38 | 38 | |
|
39 | 39 | To manage your license key, go to |
|
40 | 40 | :menuselection:`Admin --> Settings --> License`. |
|
41 | 41 | On this page you can see the license key details. If you need a new license, |
|
42 | 42 | or have questions about your current one, contact support@rhodecode.com |
|
43 | 43 | |
|
44 | 44 | .. _announcements: |
|
45 | 45 | |
|
46 | 46 | Server-wide Announcements |
|
47 | 47 | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
48 | 48 | |
|
49 | 49 | If you need to make a server-wide announcement to all users, |
|
50 | 50 | you can add a message to be displayed using the following steps: |
|
51 | 51 | |
|
52 | 52 | 1. From the |RCE| interface, select |
|
53 | 53 | :menuselection:`Admin --> Settings --> Global` |
|
54 | 54 | 2. To add a message that will be displayed to all users, |
|
55 | 55 | select :guilabel:`Server Announcement` from the drop-down menu and |
|
56 | 56 | change the ``var message = "TYPE YOUR MESSAGE HERE";`` example line. |
|
57 | 57 | 3. Select :guilabel:`Save`, and you will see the message once your page |
|
58 | 58 | refreshes. |
|
59 | 59 | |
|
60 | 60 | .. image:: ../../images/server-wide-announcement.png |
|
61 | 61 | :alt: Server Wide Announcement |
|
62 | 62 | |
|
63 | 63 | .. _md-rst: |
|
64 | 64 | |
|
65 | 65 | |
|
66 | 66 | Suppress license warnings or errors |
|
67 | 67 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
68 | 68 | |
|
69 | 69 | In case you're running on maximum allowed users, RhodeCode will display a |
|
70 | 70 | warning message on pages that you're close to the license limits. |
|
71 | 71 | It's often not desired to show that all the time. Here's how you can suppress |
|
72 | 72 | the license messages. |
|
73 | 73 | |
|
74 | 74 | 1. From the |RCE| interface, select |
|
75 | 75 | :menuselection:`Admin --> Settings --> Global` |
|
76 | 76 | 2. Select :guilabel:`Flash message filtering` from the drop-down menu. |
|
77 | 77 | 3. Select :guilabel:`Save`, and you will no longer see the license message |
|
78 | 78 | once your page refreshes. |
|
79 | 79 | |
|
80 | 80 | .. _admin-tricks-suppress-license-messages: |
|
81 | 81 | |
|
82 | 82 | |
|
83 | 83 | Markdown or RST Rendering |
|
84 | 84 | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
85 | 85 | |
|
86 | 86 | |RCE| can use `Markdown`_ or `reStructured Text`_ in commit message, |
|
87 | 87 | code review messages, and inline comments. To set the default to either, |
|
88 | 88 | select your preference from the drop-down menu on the |
|
89 | 89 | :menuselection:`Admin --> Settings --> Visual` page and select |
|
90 | 90 | :guilabel:`Save settings`. |
|
91 | 91 | |
|
92 | 92 | .. _repo-stats: |
|
93 | 93 | |
|
94 | 94 | Enabling Repository Statistics |
|
95 | 95 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
96 | 96 | |
|
97 | 97 | To enable |repo| statistics, use the following steps: |
|
98 | 98 | |
|
99 | 99 | 1. From the |RCE| interface, open |
|
100 | 100 | :menuselection:`Admin --> Repositories` and select |
|
101 | 101 | :guilabel:`Edit` beside the |repo| for which you wish to enable statistics. |
|
102 | 102 | 2. Check the :guilabel:`Enable statistics` box, and select :guilabel:`Save` |
|
103 | 103 | |
|
104 | 104 | .. _server-side-merge: |
|
105 | 105 | |
|
106 | 106 | Enabling Server-side Merging |
|
107 | 107 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
108 | 108 | |
|
109 | 109 | To enable server-side merging, use the following steps: |
|
110 | 110 | |
|
111 | 111 | 1. From the |RCE| interface, open :menuselection:`Admin --> Settings --> VCS` |
|
112 | 112 | 2. Check the :guilabel:`Server-side merge` box, and select |
|
113 | 113 | :guilabel:`Save Settings` |
|
114 | 114 | |
|
115 | 115 | If you encounter slow performance with server-side merging enabled, check the |
|
116 | 116 | speed at which your server is performing actions. When server-side merging is |
|
117 | 117 | enabled, the following actions occurs on the server. |
|
118 | 118 | |
|
119 | 119 | * A |pr| is created in the database. |
|
120 | 120 | * A shadow |repo| is created as a working environment for the |pr|. |
|
121 | 121 | * On display, |RCE| checks if the |pr| can be merged. |
|
122 | 122 | |
|
123 | 123 | To check how fast the shadow |repo| creation is occurring on your server, use |
|
124 | 124 | the following steps: |
|
125 | 125 | |
|
126 | 126 | 1. Log into your server and create a directory in your |repos| folder. |
|
127 | 127 | 2. Clone a |repo| that is showing slow performance and time the action. |
|
128 | 128 | |
|
129 | 129 | .. code-block:: bash |
|
130 | 130 | |
|
131 | 131 | # One option is to use the time command |
|
132 | 132 | $ time hg clone SOURCE_REPO TARGET |
|
133 | 133 | |
|
134 | 134 | .. _remap-rescan: |
|
135 | 135 | |
|
136 | 136 | Remap and Rescan Repositories |
|
137 | 137 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
138 | 138 | |
|
139 | 139 | You may want to Remap and rescan the |repos| that |RCE| is managing to ensure |
|
140 | 140 | the system is always up-to-date. This is useful after importing, deleting, |
|
141 | 141 | or carrying out general cleaning up operations. To do this use the |
|
142 | 142 | following steps: |
|
143 | 143 | |
|
144 | 144 | 1. From the |RCE|, open |
|
145 | 145 | :menuselection:`Admin --> Settings --> Remap and rescan` |
|
146 | 146 | 2. Click :guilabel:`Rescan Repositories` |
|
147 | 147 | |
|
148 | 148 | Check the additional options if needed: |
|
149 | 149 | |
|
150 | 150 | * :guilabel:`Destroy old data`: Useful for purging deleted repository |
|
151 | 151 | information from the database. |
|
152 | 152 | * :guilabel:`Invalidate cache for all repositories`: Use this to completely |
|
153 | 153 | remap all |repos|. Useful when importing or migrating |repos| to ensure all |
|
154 | 154 | new information is picked up. |
|
155 | 155 | |
|
156 | 156 | .. _custom-hooks: |
|
157 | 157 | |
|
158 | 158 | Adding Custom Hooks |
|
159 | 159 | ^^^^^^^^^^^^^^^^^^^ |
|
160 | 160 | |
|
161 | 161 | To add custom hooks to your instance, use the following steps: |
|
162 | 162 | |
|
163 | 163 | 1. Open :menuselection:`Admin --> Settings --> Hooks` |
|
164 | 164 | 2. Add your custom hook details, you can use a file path to specify custom |
|
165 | 165 | hook scripts, for example: |
|
166 | 166 | ``pretxnchangegroup.example`` with value ``python:/path/to/custom_hook.py:my_func_name`` |
|
167 | 167 | 3. Select :guilabel:`Save` |
|
168 | 168 | |
|
169 | 169 | Also, see the RhodeCode Extensions section of the :ref:`rc-tools` guide. RhodeCode |
|
170 | 170 | Extensions can be used to add additional hooks to your instance and comes |
|
171 | 171 | with a number of pre-built plugins if you chose to install them. |
|
172 | 172 | |
|
173 | 173 | .. _clear-repo-cache: |
|
174 | 174 | |
|
175 | 175 | Clearing |repo| cache |
|
176 | 176 | ^^^^^^^^^^^^^^^^^^^^^ |
|
177 | 177 | |
|
178 | 178 | If you need to clear the cache for a particular |repo|, use the following steps: |
|
179 | 179 | |
|
180 | 180 | 1. Open :menuselection:`Admin --> Repositories` and select :guilabel:`Edit` |
|
181 | 181 | beside the |repo| whose cache you wish to clear. |
|
182 | 182 | 2. On the |repo| settings page, go to the :guilabel:`Caches` tab and select |
|
183 | 183 | :guilabel:`Invalidate repository cache`. |
|
184 | 184 | |
|
185 | 185 | .. _set-lang: |
|
186 | 186 | |
|
187 | 187 | Changing Default Language |
|
188 | 188 | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
189 | 189 | |
|
190 | 190 | To change the default language of a |RCE| instance, change the language code |
|
191 | 191 | in the :file:`/home/{user}/.rccontrol/{instance-id}/rhodecode.ini` file. To |
|
192 | 192 | do this, use the following steps. |
|
193 | 193 | |
|
194 | 194 | 1. Open the :file:`rhodecode.ini` file and set the required language code. |
|
195 | 195 | |
|
196 | 196 | .. code-block:: ini |
|
197 | 197 | |
|
198 | 198 | ## Optional Languages |
|
199 | 199 | ## en(default), de, fr, it, ja, pl, pt, ru, zh |
|
200 | 200 | lang = de |
|
201 | 201 | |
|
202 | 202 | 2. Restart the |RCE| instance and check that the language has been updated. |
|
203 | 203 | |
|
204 | 204 | .. code-block:: bash |
|
205 | 205 | |
|
206 | 206 | $ rccontrol restart enterprise-2 |
|
207 | 207 | Instance "enterprise-2" successfully stopped. |
|
208 | 208 | Instance "enterprise-2" successfully started. |
|
209 | 209 | |
|
210 | 210 | .. image:: ../../images/language.png |
|
211 | 211 | |
|
212 | 212 | .. _set-repo-pub: |
|
213 | 213 | |
|
214 | 214 | Setting Repositories to Publish |
|
215 | 215 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
216 | 216 | |
|
217 | 217 | To automatically promote your local |repos| to public after pushing to |RCE|, |
|
218 | 218 | enable the :guilabel:`Set repositories as publishing` option on the |
|
219 | 219 | :menuselection:`Admin --> Settings --> VCS` page. |
|
220 | 220 | |
|
221 | 221 | .. note:: |
|
222 | 222 | |
|
223 | 223 | This option is enabled by default on most |RCE| versions, but if upgrading |
|
224 | 224 | from a 1.7.x version it could be disabled on upgrade due to inheriting |
|
225 | 225 | older default settings. |
|
226 | 226 | |
|
227 | 227 | .. _ping: |
|
228 | 228 | |
|
229 | 229 | Pinging the |RCE| Server |
|
230 | 230 | ^^^^^^^^^^^^^^^^^^^^^^^^ |
|
231 | 231 | |
|
232 | 232 | You can check the IP Address of your |RCE| instance using the |
|
233 | 233 | following URL: ``{instance-URL}/_admin/ping``. |
|
234 | 234 | |
|
235 | 235 | .. code-block:: bash |
|
236 | 236 | |
|
237 | 237 | $ curl https://your.rhodecode.url/_admin/ping |
|
238 | 238 | pong[rce-7880] => 203.0.113.23 |
|
239 | 239 | |
|
240 | 240 | .. _Markdown: http://daringfireball.net/projects/markdown/ |
|
241 | 241 | .. _reStructured Text: http://docutils.sourceforge.io/docs/index.html |
|
242 | 242 | |
|
243 | 243 | |
|
244 | 244 | Unarchiving a repository |
|
245 | 245 | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
246 | 246 | |
|
247 | 247 | Archive operation for the repository is similar as delete. Archive keeps the data for future references |
|
248 | 248 | but makes the repository read-only. After archiving the repository it shouldn't be modified in any way. |
|
249 | 249 | This is why repository settings are disabled for an archived repository. |
|
250 | 250 | |
|
251 | 251 | If there's a need for unarchiving a repository for some reasons, the interactive |
|
252 | 252 | ishell interface should be used. |
|
253 | 253 | |
|
254 | 254 | .. code-block:: bash |
|
255 | 255 | |
|
256 | 256 | # Open iShell from the terminal |
|
257 | 257 | $ rccontrol ishell enterprise-1/community-1 |
|
258 | 258 | |
|
259 | 259 | .. code-block:: python |
|
260 | 260 | |
|
261 | 261 | # Set repository as un-archived |
|
262 | 262 | In [1]: repo = Repository.get_by_repo_name('SOME_REPO_NAME') |
|
263 | 263 | In [2]: repo.archived = False |
|
264 | 264 | In [3]: Session().add(repo);Session().commit() |
|
265 | ||
|
266 | ||
|
267 | ||
|
268 | ||
|
269 | Bulk change repository owner | |
|
270 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
|
271 | ||
|
272 | Here's how one can change an owner of repository for an user who has been de activated. | |
|
273 | Settings a new owner can be done via ishell for all repositories that past owner had. | |
|
274 | ||
|
275 | do run this script the interactive ishell interface should be used. | |
|
276 | ||
|
277 | .. code-block:: bash | |
|
278 | ||
|
279 | # Open iShell from the terminal | |
|
280 | $ rccontrol ishell enterprise-1/community-1 | |
|
281 | ||
|
282 | ||
|
283 | .. code-block:: python | |
|
284 | ||
|
285 | from rhodecode.model.db import User, Repository, Session | |
|
286 | from rhodecode.model.permission import PermissionModel | |
|
287 | ||
|
288 | # replace old-owner and new-owner with your exact users | |
|
289 | old_owner = User.get_by_username('old-owner') | |
|
290 | new_owner = User.get_by_username('new-owner') | |
|
291 | ||
|
292 | # list of users we need to "flush" permissions | |
|
293 | affected_user_ids = [new_owner.user_id, old_owner.user_id] | |
|
294 | ||
|
295 | for repo in Repository.get_all_repos(user_id=old_owner.user_id): | |
|
296 | repo.user = new_owner | |
|
297 | Session().add(repo) | |
|
298 | Session().commit() | |
|
299 | ||
|
300 | PermissionModel().trigger_permission_flush(affected_user_ids) |
General Comments 0
You need to be logged in to leave comments.
Login now