Skip to content

Commit

Permalink
Update tt commands descriptions to 2.1.2 (#4039)
Browse files Browse the repository at this point in the history
Resolves #3999 tarantool/enterprise_doc#260 tarantool/enterprise_doc#259

Co-authored-by: Pavel Sergeev <[email protected]>
Co-authored-by: Andrey Aksenov <[email protected]>
  • Loading branch information
3 people authored Feb 14, 2024
1 parent d7d55a7 commit 9980524
Show file tree
Hide file tree
Showing 14 changed files with 109 additions and 153 deletions.
48 changes: 14 additions & 34 deletions doc/reference/tooling/tt_cli/check.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,32 @@ Checking an application file

.. code-block:: console
$ tt check {INSTANCE | APPLICATION[:APP_INSTANCE]}
``tt check`` checks the specified Tarantool application or instance for syntax errors.

Details
-------

``tt`` searches for ``APP_FILE`` inside the ``instances_enabled`` directory
specified in the :ref:`tt configuration file <tt-config_file_app>`. ``APP_FILE`` can be:

* the name of an application file without the ``.lua`` extension.
* the name of a directory containing the ``init.lua`` file. In this case, ``init.lua`` is checked.
$ tt check {FILEPATH | APPLICATION[:APP_INSTANCE]}
``tt check`` checks the syntax correctness of Lua files within Tarantool applications
or separate Lua scripts. The files must be stored inside the ``instances_enabled``
directory specified in the :ref:`tt configuration file <tt-config_file_app>`.

Examples
--------

Single instance
~~~~~~~~~~~~~~~

* Check the syntax of the ``app.lua`` file from the ``instances_enabled`` directory:
To check all Lua files in an application directory at once, specify the directory name:

.. code-block:: console
$ tt check app
* Check the syntax of the ``init.lua`` file from the ``instance1/`` directory inside ``instances_enabled``:
.. code-block:: console
.. code-block:: console
$ tt check app
$ tt check instance1
To check a single Lua file from an application directory, add the path to this file:

Multiple instances
~~~~~~~~~~~~~~~~~~
.. code-block:: console
* Check all source files of the application stored in the ``app/`` directory inside
``instances_enabled`` in accordance with the :ref:`instances configuration <tt-instances>`:
$ tt check app/router
# or
$ tt check app/router.lua
.. code-block:: console
.. note::

$ tt check app
The ``.lua`` extension can be omitted.

* Check the source of the ``master`` instance of the application stored in the
``app/`` directory inside ``instances_enabled``:

.. code-block:: console

$ tt check app:master
17 changes: 4 additions & 13 deletions doc/reference/tooling/tt_cli/clean.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ Cleaning instance files

.. code-block:: console
$ tt clean {INSTANCE | APPLICATION[:APP_INSTANCE]} [OPTION ...]
$ tt clean APPLICATION[:APP_INSTANCE] [OPTION ...]
``tt clean`` cleans stored files of Tarantool instances: logs, snapshots, and
other files. To avoid accidental deletion of files, ``tt clean`` shows
the files it is going to delete and asks for confirmation.

When called without arguments, cleans files of all applications in the current environment.


Options
-------

Expand All @@ -22,18 +25,6 @@ Options
Examples
--------

Single instance
~~~~~~~~~~~~~~~

* Clean the files of the ``app`` instance:

.. code-block:: console
$ tt clean app
Multiple instances
~~~~~~~~~~~~~~~~~~

* Clean the files of all instances of the ``app`` application:

.. code-block:: console
Expand Down
2 changes: 1 addition & 1 deletion doc/reference/tooling/tt_cli/connect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Connecting to a Tarantool instance

.. code-block:: console
$ tt connect {URI|INSTANCE} [OPTION ...]
$ tt connect {URI|INSTANCE_NAME} [OPTION ...]
``tt connect`` connects to a Tarantool instance by its URI or instance name specified
Expand Down
24 changes: 12 additions & 12 deletions doc/reference/tooling/tt_cli/create.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Variables

Templates variables are replaced with their values provided upon the instantiation.

All templates have the ``name`` variable. Its value is taken from the ``--name`` flag.
All templates have the ``name`` variable. Its value is taken from the ``--name`` option.

To add other variables, define them in the ``vars`` section of the template manifest.
A variable can have the following attributes:
Expand Down Expand Up @@ -151,17 +151,17 @@ Examples:

Variables receive their values during the template instantiation. By default, ``tt create``
asks you to provide the values interactively. You can use the ``-s`` (or ``--non-interactive``)
flag to disable the interactive input. In this case, the values are searched in the following order:
option to disable the interactive input. In this case, the values are searched in the following order:

* In the ``--var`` flag. Pass a string of the ``var=value`` format after the ``--var``
flag. You can pass multiple variables, each after a separate ``--var`` flag:
* In the ``--var`` option. Pass a string of the ``var=value`` format after the ``--var``
option. You can pass multiple variables, each after a separate ``--var`` option:

.. code-block:: console
$ tt create template app --var user_name=admin
* In a file. Specify ``var=value`` pairs in a plain text file, each on a new line, and
pass it as the value of the ``--vars-file`` flag:
pass it as the value of the ``--vars-file`` option:

.. code-block:: console
Expand All @@ -176,32 +176,32 @@ flag to disable the interactive input. In this case, the values are searched in
version=2
If a variable isn't initialized in any of these ways, the default value
from the manifest will be used.
from the manifest is used.

You can combine different ways of passing variables in a single call of ``tt create``.

Application directory
~~~~~~~~~~~~~~~~~~~~~

By default, the application will appear in the directory named after the provided
By default, the application appears in the directory named after the provided
application name (``--name`` value).

To change the application location, use the ``-dst`` flag.
To change the application location, use the ``-dst`` option.

Examples
--------

* Create the application ``app1`` from the ``simple_app`` template in the current directory:
* Create the application ``app1`` from the ``simple_app`` user-defined template in the current directory:

.. code-block:: console
$ tt create simple_app --name app1
* Create the ``app1`` application in ``/opt/tt/apps/``, set the ``user_name``
variable to ``admin``, force rewrite the application directory if it already exists.
* Create the ``app1`` application in ``/opt/tt/apps`` from the built-in ``vshard_cluster`` template,
force rewrite the application directory if it already exists.
User interaction is disabled.

.. code-block:: console
$ tt create cartridge --name app1 --var user_name=admin -f --non-interactive -dst /opt/tt/apps/
$ tt create vshard_cluster --name app1 -f --non-interactive -dst /opt/tt/apps/
8 changes: 4 additions & 4 deletions doc/reference/tooling/tt_cli/export.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Exporting data

.. code-block:: console
$ tt [crud] export URI FILE SPACE [EXPORT_OPTION ...]
$ tt [crud] export URI SPACE:FILE ... [EXPORT_OPTION ...]
``tt [crud] export`` exports a space's data to a file.
The ``crud`` command is optional and can be used to export a cluster's data by using the `CRUD <https://github.com/tarantool/crud>`_ module. Without ``crud``, data is exported using the :ref:`box.space <box_space>` API.
Expand Down Expand Up @@ -43,7 +43,7 @@ The command below exports data of the ``customers`` space to the ``customers.csv

.. code-block:: console
$ tt crud export localhost:3301 customers.csv customers
$ tt crud export localhost:3301 customers:customers.csv
If the ``customers`` space has five fields (``id``, ``bucket_id``, ``firstname``, ``lastname``, and ``age``), the file with exported data might look like this:

Expand All @@ -70,7 +70,7 @@ To export data with a space's field names in the first row, use the ``--header``

.. code-block:: console
$ tt crud export localhost:3301 customers.csv customers \
$ tt crud export localhost:3301 customers:customers.csv \
--header
In this case, field values start from the second row, for example:
Expand All @@ -95,7 +95,7 @@ For example, the command below exports compound values serialized in JSON:

.. code-block:: console
$ tt crud export localhost:3301 customers.csv customers \
$ tt crud export localhost:3301 customers:customers.csv \
--compound-value-format json
Expand Down
16 changes: 8 additions & 8 deletions doc/reference/tooling/tt_cli/import.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ Importing data

.. code-block:: console
$ tt [crud] import URI FILE SPACE [IMPORT_OPTION ...]
$ tt [crud] import URI FILE:SPACE [IMPORT_OPTION ...]
# or
$ tt [crud] import URI - SPACE < FILE [IMPORT_OPTION ...]
$ tt [crud] import URI :SPACE < FILE [IMPORT_OPTION ...]
``tt [crud] import`` imports data from a file to a space.
The ``crud`` command is optional and can be used to import data to a cluster by using the `CRUD <https://github.com/tarantool/crud>`_ module. Without ``crud``, data is imported using the :ref:`box.space <box_space>` API.
Expand Down Expand Up @@ -62,7 +62,7 @@ If the target ``customers`` space has fields with the same names, you can import

.. code-block:: console
$ tt crud import localhost:3301 customers.csv customers \
$ tt crud import localhost:3301 customers.csv:customers \
--header \
--match=header
Expand Down Expand Up @@ -92,15 +92,15 @@ you can configure mapping as follows:

.. code-block:: console
$ tt crud import localhost:3301 customers.csv customers \
$ tt crud import localhost:3301 customers.csv:customers \
--header \
--match "id=customer_id;firstname=name;lastname=surname;age=customer_age"
Similarly, you can configure mapping using numeric field positions in the input file:

.. code-block:: console
$ tt crud import localhost:3301 customers.csv customers \
$ tt crud import localhost:3301 customers.csv:customers \
--header \
--match "id=1;firstname=2;lastname=3;age=4"
Expand All @@ -119,7 +119,7 @@ In the example below, values already existing in the space are replaced with new

.. code-block:: console
$ tt crud import localhost:3301 customers.csv customers \
$ tt crud import localhost:3301 customers.csv:customers \
--on-exist replace
.. _tt-import-parsing-error:
Expand All @@ -131,7 +131,7 @@ To skip rows whose data cannot be parsed correctly, use the ``--on-error`` optio

.. code-block:: console
$ tt crud import localhost:3301 customers.csv customers \
$ tt crud import localhost:3301 customers.csv:customers \
--on-error skip
Expand All @@ -156,7 +156,7 @@ Options

.. code-block:: console
$ tt crud import localhost:3301 customers.csv customers \
$ tt crud import localhost:3301 customers.csv:customers \
--delimiter tab
.. NOTE::
Expand Down
2 changes: 1 addition & 1 deletion doc/reference/tooling/tt_cli/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ To build ``tt`` from sources:
git clone https://github.com/tarantool/tt --recursive
3. Go to the ``tt/`` directory:
3. Go to the ``tt`` directory:

.. code-block:: bash
Expand Down
5 changes: 3 additions & 2 deletions doc/reference/tooling/tt_cli/instances.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Listing enabled applications
$ tt instances
``tt instances`` shows the list of enabled applications.
``tt instances`` shows the list of enabled applications and their instances
in the current environment.

.. note::

Expand All @@ -19,7 +20,7 @@ Listing enabled applications
Example
--------

* Show the list of enabled applications:
* Show the list of enabled applications and their instances:

.. code-block:: console
Expand Down
2 changes: 1 addition & 1 deletion doc/reference/tooling/tt_cli/logrotate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Rotating instance logs

.. code-block:: console
$ tt logrotate {INSTANCE | APPLICATION[:APP_INSTANCE]}
$ tt logrotate APPLICATION[:APP_INSTANCE]
``tt logrotate`` rotates logs of a Tarantool application or specific instances,
and the ``tt`` log. For example, you need to call this function to continue logging
Expand Down
30 changes: 15 additions & 15 deletions doc/reference/tooling/tt_cli/restart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ Restarting a Tarantool instance

.. code-block:: console
$ tt restart {INSTANCE | APPLICATION[:APP_INSTANCE]} [OPTION ...]
$ tt restart APPLICATION[:APP_INSTANCE] [OPTION ...]
``tt restart`` restarts the specified running Tarantool instance.
A ``tt restart`` call is equivalent to consecutive calls of
:doc:`tt stop <stop>` and :doc:`tt start <start>`.

When called without arguments, restarts all running applications in the current environment.

See also: :ref:`tt-start`, :ref:`tt-stop`, :ref:`tt-status`.


Options
-------

Expand All @@ -21,27 +26,22 @@ Options
Examples
--------

Single instance
~~~~~~~~~~~~~~~
* Restart all instances of the application stored in the ``app`` directory inside
``instances_enabled`` in accordance with the :ref:`instances configuration <tt-instances>`:

Restart the ``app`` instance with automatic confirmation:
.. code-block:: console
.. code-block:: console
$ tt restart app
$ tt restart app -y
.. note::

Multiple instances
~~~~~~~~~~~~~~~~~~
This call starts all application instances specified in its ``instances.yml``,
even those that were not running before the call.

* Restart all instances of the application stored in the ``app/`` directory inside
``instances_enabled`` in accordance with the :ref:`instances configuration <tt-instances>`:
* Restart only the ``master`` instance of the ``app`` application with automatic confirmation:

.. code-block:: console
$ tt restart app
$ tt restart app:master -y
* Restart only the ``master`` instance of the application stored in the ``app/`` directory inside ``instances_enabled``:

.. code-block:: console
$ tt restart app:master
2 changes: 1 addition & 1 deletion doc/reference/tooling/tt_cli/run.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Running code in a Tarantool instance
$ tt run [SCRIPT|-e EXPR] [OPTION ...]
``tt run`` executes Lua code in a Tarantool instance.
``tt run`` executes Lua code in a new Tarantool instance.

Options
-------
Expand Down
Loading

0 comments on commit 9980524

Please sign in to comment.