##// END OF EJS Templates
fix(docs): fixed cli usage docs
super-admin -
r5644:09e63857 default
parent child Browse files
Show More
@@ -1,578 +1,582
1 1 .. _tools-cli:
2 2
3 3 |RCT| CLI
4 4 ---------
5 5
6 6 The commands available with |RCT| can be split into three categories:
7 7
8 8 - Remotely executable commands that can be run from your local machine once you
9 9 have your connection details to |RCE| configured.
10 10 - Locally executable commands the can be run on the server to carry out
11 11 general maintenance.
12 12 - Local configuration commands used to help set up your |RCT| configuration.
13 13
14 14
15 .. _tools-rhodecode-list-instance:
16
17 rhodecode-list-instances
18 ------------------------
19
20 Use this command to list the instance details configured in the
21 :file:`/etc/rhodecode/conf/.rhoderc` file.
22
23 .. code-block:: bash
24
25 $ ./rcstack cli cmd rhodecode-list-instances --config=/etc/rhodecode/conf/.rhoderc
26 [instance:production] - Config only
27 API-HOST: https://some.url.com
28 API-KEY: some.auth.token
29
30 [instance:development] - Config only
31 API-HOST: http://some.ip.address
32 API-KEY: some.auth.token
33
34
15 35 rhodecode-tools
16 36 ---------------
17 37
18 38 Use |RCT| to setup automation, run the indexer, and install extensions for
19 39 your |RCE| instances. Options:
20 40
21 41 .. rst-class:: dl-horizontal
22 42
23 43 \ - -apihost <api_host>
24 44 Set the API host value.
25 45
26 46 \ - -apikey <apikey_value>
27 47 Set the API key value.
28 48
29 49 \-c, - -config <config_file>
30 50 Create a configuration file. The default file is created
31 51 in ``~/.rhoderc``
32 52
33 53 \ - -save-config
34 54 Save the configuration file.
35 55
36 56 \ - -show-config
37 57 Show the current configuration values.
38 58
39 59 \ - -format {json,pretty}
40 60 Set the formatted representation.
41 61
42 62 Example usage:
43 63
44 64 .. code-block:: bash
45 65
46 66 $ rhodecode-tools --apikey=key --apihost=http://rhodecode.server \
47 67 --save-config
48 68
49 69 rhodecode-api
50 70 -------------
51 71
52 72 The RhodeCode API lets you connect to |RCE| and carry out management tasks from a
53 73 remote machine, for more information about the API, see the :ref:`api`. To
54 74 pass arguments on the command-line use the ``method:option`` syntax.
55 75
56 76 Example usage:
57 77
58 78 .. code-block:: bash
59 79
60 80 # Run the get_repos API call and sample output
61 81 $ rhodecode-api --instance-name=enterprise-1 create_repo \
62 82 repo_name:brand-new repo_type:hg description:repo-desc
63 83
64 84 {
65 85 "error": null,
66 86 "id": 1110,
67 87 "result": {
68 88 "msg": "Created new repository `brand-new`",
69 89 "success": true,
70 90 "task": null
71 91 }
72 92 }
73 93
74 94 Options:
75 95
76 96 .. rst-class:: dl-horizontal
77 97
78 98 \ - -api-cache-only
79 99 Requires a cache to be present when running this call
80 100
81 101 \ - -api-cache-rebuild
82 102 Replaces existing cached values with new ones from server
83 103
84 104 \ - -api-cache <PATH>
85 105 Use a special cache dir to read responses from instead of the server
86 106
87 107 \ - -api-cert-verify
88 108 Verify the endpoint ssl certificate
89 109
90 110 \ - -api-cert <PATH>
91 111 Path to alternate CA bundle.
92 112
93 113 \ - -apihost <api_host>
94 114 Set the API host value.
95 115
96 116 \ - -apikey <apikey_value>
97 117 Set the API key value.
98 118
99 119 \ - -instance-name <instance-id>
100 120 Set the instance name
101 121
102 122 \-I, - -install-dir <DIR>
103 123 Location of application instances
104 124
105 125 \-c, - -config <.rhoderc-file>
106 126 Location of the :file:`.rhoderc`
107 127
108 128 \-F, - -format {json,pretty}
109 129 Set the formatted representation.
110 130
111 131 \-h, - -help
112 132 Show help messages.
113 133
114 134 \-v, - -verbose
115 135 Enable verbose messaging
116 136
117 137 rhodecode-cleanup-gists
118 138 -----------------------
119 139
120 140 Use this to delete gists within |RCE|. Options:
121 141
122 142 .. rst-class:: dl-horizontal
123 143
124 144 \-c, - -config <config_file>
125 145 Set the file path to the configuration file. The default file is
126 146 :file:`/home/{user}/.rhoderc`
127 147
128 148 \ - -corrupted
129 149 Remove gists with corrupted metadata.
130 150
131 151 \ - -dont-ask
132 152 Remove gists without asking for confirmation.
133 153
134 154 \-h, - -help
135 155 Show help messages. current configuration values.
136 156
137 157 \ - -instance-name <instance-id>
138 158 Set the instance name.
139 159
140 160 \-R, - -repo-dir
141 161 Set the repository file path.
142 162
143 163 \ - -version
144 164 Display your |RCT| version.
145 165
146 166 Example usage:
147 167
148 168 .. code-block:: bash
149 169
150 170 # Clean up gists related to an instance
151 171 $ rhodecode-cleanup-gists --instance-name=enterprise-1
152 172 Scanning for gists in /home/brian/repos/.rc_gist_store...
153 173 preparing to remove [3] found gists
154 174
155 175 # Clean up corrupted gists in an instance
156 176 $ rhodecode-cleanup-gists --instance-name=enterprise-1 --corrupted
157 177 Scanning for gists in /home/brian/repos/.rc_gist_store...
158 178 preparing to remove [2] found gists
159 179 the following gists will be archived:
160 180 * EXPIRED: BAD METADATA | /home/brian/repos/.rc_gist_store/5
161 181 * EXPIRED: BAD METADATA | /home/brian/repos/.rc_gist_store/8FtC
162 182 are you sure you want to archive them? [y/N]: y
163 183 removing gist /home/brian/repos/.rc_gist_store/5
164 184 removing gist /home/brian/repos/.rc_gist_store/8FtCKdcbRKmEvRzTVsEt
165 185
186
166 187 rhodecode-cleanup-repos
167 188 -----------------------
168 189
169 190 Use this to manage |repos| and |repo| groups within |RCE|. Options:
170 191
171 192 .. rst-class:: dl-horizontal
172 193
173 194 \-c, - -config <config_file>
174 195 Set the file path to the configuration file. The default file is
175 196 :file:`/home/{user}/.rhoderc`.
176 197
177 198 \-h, - -help
178 199 Show help messages. current configuration values.
179 200
180 201 \ - -interactive
181 202 Enable an interactive prompt for each repository when deleting.
182 203
183 204 \ - -include-groups
184 205 Remove repository groups.
185 206
186 207 \ - -instance-name <instance-id>
187 208 Set the instance name.
188 209
189 210 \ - -list-only
190 211 Display repositories selected for deletion.
191 212
192 213 \ - -older-than <str>
193 214 Delete repositories older that a specified time.
194 215 You can use the following suffixes; d for days, h for hours,
195 216 m for minutes, s for seconds.
196 217
197 218 \-R, - -repo-dir
198 219 Set the repository file path
199 220
200 221 Example usage:
201 222
202 223 .. code-block:: bash
203 224
204 # Cleaning up repos using tools installed with RCE 350 and above
205 $ ~/.rccontrol/enterprise-4/profile/bin/rhodecode-cleanup-repos \
206 --instance-name=enterprise-4 --older-than=1d
207 Scanning for repositories in /home/brian/repos...
208 preparing to remove [2] found repositories older than 1 day, 0:00:00 (1d)
225
226 # create a .rhoderc file in your host config directory (in :file:`config/_shared/.rhoderc`):
227
228 [instance:rcstack-instance]
229 api_host = http://rhodecode:10020
230 api_key = <API_KEY>
231 repo_dir = /var/opt/rhodecode_repo_store
232
233 # Run rcstack cli
234 ./rcstack cli cmd rhodecode-cleanup-repos --instance-name=rcstack-instance --config=/etc/rhodecode/conf/.rhoderc
235
236 checking if config files needs bootstrapping
237 Scanning for repositories in /var/opt/rhodecode_repo_store...
209 238
210 239 the following repositories will be deleted completely:
211 * REMOVED: 2015-08-05 00:23:18 | /home/brian/repos/rm__20150805_002318_831
212 * REMOVED: 2015-08-04 01:22:10 | /home/brian/repos/rm__20150804_012210_336
240 * REMOVED: 2015-08-05 00:23:18 | /var/opt/rhodecode_repo_store/rm__20150805_002318_831
241 * REMOVED: 2015-08-04 01:22:10 | /var/opt/rhodecode_repo_store/rm__20150804_012210_336
213 242 are you sure you want to remove them? [y/N]:
214 243
215 244 # Clean up repos older than 1 year
216 # If using virtualenv and pre RCE 350 tools installation
217 (venv)$ rhodecode-cleanup-repos --instance-name=enterprise-1 \
218 --older-than=365d
245 ./rcstack cli cmd rhodecode-cleanup-repos --instance-name=rcstack-instance --config=/etc/rhodecode/conf/.rhoderc --older-than=365d
219 246
220 Scanning for repositories in /home/brian/repos...
247 checking if config files needs bootstrapping
248 Scanning for repositories in /var/opt/rhodecode_repo_store...
221 249 preparing to remove [343] found repositories older than 365 days
222 250
223 251 # clean up repos older than 3 days
224 # If using virtualenv and pre RCE 350 tools installation
225 (venv)$ rhodecode-cleanup-repos --instance-name=enterprise-1 \
226 --older-than=3d
227 Scanning for repositories in /home/brian/repos...
252 ./rcstack cli cmd rhodecode-cleanup-repos --instance-name=rcstack-instance --config=/etc/rhodecode/conf/.rhoderc --older-than=3d
253
254 checking if config files needs bootstrapping
255 Scanning for repositories in /var/opt/rhodecode_repo_store...
228 256 preparing to remove [3] found repositories older than 3 days
229 257
230 258 .. _tools-config:
231 259
232 260 rhodecode-config
233 261 ----------------
234 262
235 263 Use this to create or update a |RCE| configuration file on the local machine.
236 264
237 265 .. rst-class:: dl-horizontal
238 266
239 267 \- -filename </path/to/config_file>
240 268 Set the file path to the |RCE| configuration file.
241 269
242 270 \- -show-defaults
243 271 Display the defaults set in the |RCE| configuration file.
244 272
245 273 \- -update
246 274 Update the configuration with the new settings passed on the command
247 275 line.
248 276
249 277 .. code-block:: bash
250 278
251 279 # Create a new config file
252 280 $ rhodecode-config --filename=dev.ini
253 281 Wrote new config file in /Users/user/dev.ini
254 282
255 283 # Update config value for given section:
256 284 $ rhodecode-config --update --filename=prod.ini [handler_console]level=INFO
257 285
258 286 $ rhodecode-config --filename=dev.ini --show-defaults
259 287 lang=en
260 288 cpu_number=4
261 289 uuid=<function <lambda> at 0x10d86ac08>
262 290 license_token=ff1e-aa9c-bb66-11e5
263 291 host=127.0.0.1
264 292 here=/Users/brian
265 293 error_aggregation_service=None
266 294 database_url=sqlite:///%(here)s/rhodecode.db?timeout=30
267 295 git_path=git
268 296 http_server=waitress
269 297 port=5000
270 298
271 299 .. _tools-rhodecode-extensions:
272 300
273 301 rhodecode-extensions
274 302 --------------------
275 303
276 304 The `rcextensions` since version 4.14 are now shipped together with |RCE| please check
277 305 the using :ref:`integrations-rcextensions` section.
278 306
279 307
280 308 rhodecode-gist
281 309 --------------
282 310
283 311 Use this to create, list, show, or delete gists within |RCE|. Options:
284 312
285 313 .. rst-class:: dl-horizontal
286 314
287 315 \ - -api-cache-only
288 316 Requires a cache to be present when running this call
289 317
290 318 \ - -api-cache-rebuild
291 319 Replaces existing cached values with new ones from server
292 320
293 321 \ - -api-cache PATH
294 322 Use a special cache dir to read responses from instead of the server
295 323
296 324 \ - -api-cert-verify
297 325 Verify the endpoint ssl certificate
298 326
299 327 \ - -api-cert PATH
300 328 Path to alternate CA bundle.
301 329
302 330 \ - -apihost <api_host>
303 331 Set the API host value.
304 332
305 333 \ - -apikey <apikey_value>
306 334 Set the API key value.
307 335
308 336 \-c, - -config <config_file>
309 337 Create a configuration file.
310 338 The default file is created in :file:`~/.rhoderc`
311 339
312 340 \ - -create <gistname>
313 341 create the gist
314 342
315 343 \-d, - -description <str>
316 344 Set gist description
317 345
318 346 \ - -delete <gistid>
319 347 Delete the gist
320 348
321 349 \-f, - -file
322 350 Specify the filename The file extension will enable syntax highlighting.
323 351
324 352 \-F, - -format {json,pretty}
325 353 Set the formatted representation.
326 354
327 355 \ - -help
328 356 Show help messages.
329 357
330 358 \-I, - -install-dir <DIR>
331 359 Location of application instances
332 360
333 361 \ - -instance-name <instance-id>
334 362 Set the instance name.
335 363
336 364 \ - -list
337 365 Display instance gists.
338 366
339 367 \-l, --lifetime <minutes>
340 368 Set the gist lifetime. The default value is (-1) forever
341 369
342 370 \ - -show <gistname>
343 371 Show the content of the gist
344 372
345 373 \-o, - -open
346 374 After creating Gist open it in browser
347 375
348 376 \-p, - -private
349 377 Create a private gist
350 378
351 379 \ - -version
352 380 Display your |RCT| version.
353 381
354 382 Example usage:
355 383
356 384 .. code-block:: bash
357 385
358 386 # List the gists in an instance
359 387 (venv)brian@ubuntu:~$ rhodecode-gist --instance-name=enterprise-1 list
360 388 {
361 389 "error": null,
362 390 "id": 7102,
363 391 "result": [
364 392 {
365 393 "access_id": "2",
366 394 "content": null,
367 395 "created_on": "2015-01-19T12:52:26.494",
368 396 "description": "A public gust",
369 397 "expires": -1.0,
370 398 "gist_id": 2,
371 399 "type": "public",
372 400 "url": "http://127.0.0.1:10003/_admin/gists/2"
373 401 },
374 402 {
375 403 "access_id": "7gs6BsSEC4pKUEPLz5AB",
376 404 "content": null,
377 405 "created_on": "2015-01-19T11:27:40.812",
378 406 "description": "Gist testing API",
379 407 "expires": -1.0,
380 408 "gist_id": 1,
381 409 "type": "private",
382 410 "url": "http://127.0.0.1:10003/_admin/gists/7gs6BsSEC4pKUEPLz5AB"
383 411 }
384 412 ]
385 413 }
386 414
387 415 # delete a particular gist
388 416 # You use the access_id to specify the gist to delete
389 417 (venv)brian@ubuntu:~$ rhodecode-gist delete 2 --instance-name=enterprise-1
390 418 {
391 419 "error": null,
392 420 "id": 6284,
393 421 "result": {
394 422 "gist": null,
395 423 "msg": "deleted gist ID:2"
396 424 }
397 425 }
398 426
399 427 # cat a file and pipe to new gist
400 428 # This is if you are using virtualenv
401 429 (venv)$ cat ~/.rhoderc | rhodecode-gist --instance-name=enterprise-1 \
402 430 -d '.rhoderc copy' create
403 431
404 432 {
405 433 "error": null,
406 434 "id": 5374,
407 435 "result": {
408 436 "gist": {
409 437 "access_id": "7",
410 438 "content": null,
411 439 "created_on": "2015-01-26T11:31:58.774",
412 440 "description": ".rhoderc copy",
413 441 "expires": -1.0,
414 442 "gist_id": 7,
415 443 "type": "public",
416 444 "url": "http://127.0.0.1:10003/_admin/gists/7"
417 445 },
418 446 "msg": "created new gist"
419 447 }
420 448 }
421 449
422 450 # Cat a file and pipe to gist
423 # in RCE 3.5.0 tools and above
424 $ cat ~/.rhoderc | ~/.rccontrol/{instance-id}/profile/bin/rhodecode-gist \
425 --instance-name=enterprise-4 -d '.rhoderc copy' create
451
452 $ cat ~/.rhoderc | ./rcstack cli cmd rhodecode-gist --instance-name=rcstack-instance --config=/etc/rhodecode/conf/.rhoderc -d '.rhoderc copy' create
426 453 {
427 454 "error": null,
428 455 "id": 9253,
429 456 "result": {
430 457 "gist": {
431 458 "access_id": "4",
432 459 "acl_level": "acl_public",
433 460 "content": null,
434 461 "created_on": "2015-08-20T05:54:11.250",
435 462 "description": ".rhoderc copy",
436 463 "expires": -1.0,
437 464 "gist_id": 4,
438 465 "modified_at": "2015-08-20T05:54:11.250",
439 466 "type": "public",
440 467 "url": "http://127.0.0.1:10000/_admin/gists/4"
441 468 },
442 469 "msg": "created new gist"
443 470 }
444 471 }
445 472
446 473
447 474 rhodecode-index
448 475 ---------------
449 476
450 477 More detailed information regarding setting up the indexer is available in
451 478 the :ref:`indexing-ref` section. Options:
452 479
453 480 .. rst-class:: dl-horizontal
454 481
455 482 \ - -api-cache-only
456 483 Requires a cache to be present when running this call
457 484
458 485 \ - -api-cache-rebuild
459 486 Replaces existing cached values with new ones from server
460 487
461 488 \ - -api-cache PATH
462 489 Use a special cache dir to read responses from instead of the server
463 490
464 491 \ - -api-cert-verify
465 492 Verify the endpoint ssl certificate
466 493
467 494 \ - -api-cert PATH
468 495 Path to alternate CA bundle.
469 496
470 497 \ - -apihost <api_host>
471 498 Set the API host value.
472 499
473 500 \ - -apikey <apikey_value>
474 501 Set the API key value.
475 502
476 503 \-c, --config <config_file>
477 504 Create a configuration file.
478 505 The default file is created in :file:`~/.rhoderc`
479 506
480 507 \ - -create-mapping <PATH>
481 508 Creates an example mapping configuration for indexer.
482 509
483 510 \-F, - -format {json,pretty}
484 511 Set the formatted representation.
485 512
486 513 \-h, - -help
487 514 Show help messages.
488 515
489 516 \ - -instance-name <instance-id>
490 517 Set the instance name
491 518
492 519 \-I, - -install-dir <DIR>
493 520 Location of application instances
494 521
495 522 \-m, - -mapping <file_name>
496 523 Parse the output to the .ini mapping file.
497 524
498 525 \ - -optimize
499 526 Optimize index for performance by amalgamating multiple index files
500 527 into one. Greatly increases incremental indexing speed.
501 528
502 529 \-R, - -repo-dir <DIRECTORY>
503 530 Location of repositories
504 531
505 532 \ - -source <PATH>
506 533 Use a special source JSON file to feed the indexer
507 534
508 535 \ - -version
509 536 Display your |RCT| version.
510 537
511 538 Example usage:
512 539
513 540 .. code-block:: bash
514 541
515 # Run the indexer
516 $ ~/.rccontrol/enterprise-4/profile/bin/rhodecode-index \
517 --instance-name=enterprise-4
542 # Create the indexing mapping file
543 $ ./rcstack cli cmd rhodecode-index --instance-name=rcstack-instance --config=/etc/rhodecode/conf/.rhoderc --create-mapping search_mapping.ini
518 544
519 # Run indexer based on search_mapping.ini file
520 # This is using pre-350 virtualenv
521 (venv)$ rhodecode-index --instance-name=enterprise-1
545 # Run the indexer
546 $ ./rcstack cli cmd rhodecode-index --instance-name=rcstack-instance --config=/etc/rhodecode/conf/.rhoderc
547
548 # Run indexer based on search_mapping.ini file using rhodecode-tools virtualenv
549 (venv)$ rhodecode-index --instance-name=rcstack-instance
522 550
523 551 # Index from the command line without creating
524 552 # the .rhoderc file
525 $ rhodecode-index --apikey=key --apihost=http://rhodecode.server \
526 --instance-name=enterprise-2 --save-config
527
528 # Create the indexing mapping file
529 $ ~/.rccontrol/enterprise-4/profile/bin/rhodecode-index \
530 --create-mapping search_mapping.ini --instance-name=enterprise-4
531
532 .. _tools-rhodecode-list-instance:
533
534 rhodecode-list-instances
535 ------------------------
536
537 Use this command to list the instance details configured in the
538 :file:`~/.rhoderc` file.
539
540 .. code-block:: bash
541
542 $ .rccontrol/enterprise-1/profile/bin/rhodecode-list-instances
543 [instance:production] - Config only
544 API-HOST: https://some.url.com
545 API-KEY: some.auth.token
546
547 [instance:development] - Config only
548 API-HOST: http://some.ip.address
549 API-KEY: some.auth.token
553 $ rhodecode-index --apikey=key --apihost=http://rhodecode.server --instance-name=rcstack-instance --save-config
550 554
551 555
552 556 .. _tools-setup-config:
553 557
554 558 rhodecode-setup-config
555 559 ----------------------
556 560
557 561 Use this command to create the ``~.rhoderc`` file required by |RCT| to access
558 562 remote instances.
559 563
560 564 .. rst-class:: dl-horizontal
561 565
562 566 \- -instance-name <name>
563 567 Specify the instance name in the :file:`~/.rhoderc`
564 568
565 569 \api_host <hostname>
566 570 Create a configuration file. The default file is created
567 571 in ``~/.rhoderc``
568 572
569 573 \api_key <auth-token>
570 574 Create a configuration file. The default file is created
571 575 in ``~/.rhoderc``
572 576
573 577
574 578 .. code-block:: bash
575 579
576 580 (venv)$ rhodecode-setup-config --instance-name=tea api_host=URL api_key=xyz
577 581 Config not found under /Users/username/.rhoderc, creating a new one
578 582 Wrote new configuration into /Users/username/.rhoderc
General Comments 0
You need to be logged in to leave comments. Login now