cli.rst 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. Command Line Reference
  2. ======================
  3. Lakesuperior comes with some command-line tools aimed at several purposes.
  4. If Lakesuperior is installed via ``pip``, all tools can be invoked as normal
  5. commands (i.e. they are in the virtualenv ``PATH``).
  6. The tools are currently not directly available on Docker instances (*TODO add
  7. instructions and/or code changes to access them*).
  8. ``lsup-server``
  9. ---------------
  10. Single-threaded server. Use this for testing, debugging, or to multiplex via
  11. WSGI in a Windows environment. For non-Windows production environments, use
  12. ``fcrepo``.
  13. ``fcrepo``
  14. ----------
  15. This is the main server command. It has no parameters. The command spawns
  16. Gunicorn workers (as many as set up in the configuration) and can be sent in
  17. the background, or started via init script.
  18. The tool must be run in the same virtual environment Lakesuperior
  19. was installed in (if it was)—i.e.::
  20. source <virtualenv root>/bin/activate
  21. must be run before running the server.
  22. In the case an init script is used, ``coilmq`` (belonging to a 3rd party
  23. package) needs to be launched as well; unless a message broker is already set
  24. up, or if messaging is disabled in the configuration.
  25. **Note:** This command is not available in Windows because GUnicorn is not
  26. available in Windows. Windows users should look for alternative WSGI servers
  27. to run the single-threaded service (``lsup-server``) over multiple processes
  28. and/or threads.
  29. ``lsup-admin``
  30. --------------
  31. ``lsup-admin`` is the principal repository management tool. It is
  32. self-documented, so this is just a redundant overview::
  33. $ lsup-admin
  34. Usage: lsup-admin [OPTIONS] COMMAND [ARGS]...
  35. Options:
  36. --help Show this message and exit.
  37. Commands:
  38. bootstrap Bootstrap binary and graph stores.
  39. check_fixity [STUB] Check fixity of a resource.
  40. check_refint Check referential integrity.
  41. cleanup [STUB] Clean up orphan database items.
  42. migrate Migrate an LDP repository to Lakesuperior.
  43. stats Print repository statistics.
  44. All entries marked ``[STUB]`` are not yet implemented, however the
  45. ``lsup_admin <command> --help`` command will issue a description of what
  46. the command is meant to do. Check the
  47. `issues page <https://github.com/scossu/lakesuperior/issues>`__ for what's on
  48. the radar.
  49. All of the above commands are also available via, and based upon, the
  50. native Python API.
  51. ``lsup-benchmark``
  52. ------------------
  53. This command is used to run performance tests in a predictable way.
  54. The command line options can be queried with the ``--help`` option::
  55. Usage: lsup-benchmark [OPTIONS]
  56. Options:
  57. -e, --endpoint TEXT LDP endpoint. Default: http://localhost:8000/ldp
  58. -c, --count INTEGER Number of resources to ingest. Default: {def_ct}
  59. -p, --parent TEXT Path to the container resource under which the new
  60. resources will be created. It must begin with a
  61. slash (`/`) character. Default: /pomegranate
  62. -d, --delete-container Delete container resource and its children if
  63. already existing. By default, the container is not
  64. deleted and new resources are added to it.
  65. -m, --method TEXT HTTP method to use. Case insensitive. Either PUT
  66. or POST. Default: PUT
  67. -s, --graph-size INTEGER Number of triples in each graph. Default: 200
  68. -t, --resource-type TEXT Type of resources to ingest. One of `r` (only LDP-
  69. RS, i.e. RDF), `n` (only LDP-NR, i.e. binaries),
  70. or `b` (50/50% of both). Default: r
  71. -p, --plot Plot a graph of ingest timings. The graph figure
  72. is displayed on screen with basic manipulation and
  73. save options.
  74. --help Show this message and exit.
  75. The benchmark tool is able to create RDF sources, or non-RDF, or an equal mix
  76. of them, via POST or PUT, in a given lDP endpoint. It runs single threaded.
  77. The RDF sources are randomly generated graphs of consistent size and
  78. complexity. They include a mix of in-repository references, literals, and
  79. external URIs. Each graph has 200 triples by default.
  80. The non-RDF sources are randomly generated 1024x1024 pixel PNG images.
  81. You are warmly encouraged to run the script and share the performance results (
  82. *TODO add template for posting results*).
  83. ``profiler``
  84. ------------
  85. This command launches a single-threaded HTTP server (Flask) on port 5000 that
  86. logs profiling information. This is useful for analyzing application
  87. performance.
  88. For more information, consult the `Python profilers guide
  89. <https://docs.python.org/3/library/profile.html>`__.
  90. Do not launch this while a WSGI server (``fcrepo``) is already running, because
  91. that also launches a Flask server on port 5000.