Skip to content

Commit 23e77fd

Browse files
p7novandreyaksenov
authored andcommitted
Add TT CLI 1.0.0 docs (#3414)
Resolves #3413
1 parent 5885d14 commit 23e77fd

34 files changed

+1938
-4
lines changed

.github/workflows/deploy-branch.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
# for example,
1010
# `deploy-branch/refs/add-concurrency`.
1111
#
12-
# Runs on branches `latest`, `tt`, and also tags, will never be canceled,
12+
# Runs on branch `latest` and tags will never be canceled,
1313
# due to having a unique group name
1414
# `{github.run_id}-{github.run_attempt}`,
1515
# for example,
@@ -18,7 +18,6 @@ concurrency:
1818
group: ${{
1919
(
2020
github.ref == 'refs/heads/latest' ||
21-
github.ref == 'refs/heads/tt' ||
2221
startsWith(github.ref, 'refs/tags/')
2322
) &&
2423
format('{0}-{1}', github.run_id, github.run_attempt) ||

doc/book/admin/upgrades.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ replication cluster (see :ref:`below <admin-upgrades_replication_cluster>`).
3232

3333
#. Update your application files, if needed.
3434

35-
#. Launch the updated Tarantool server using ``tarantoolctl`` or ``systemctl``.
35+
#. Launch the updated Tarantool server using ``tarantoolctl``, ``tt``, or ``systemctl``.
3636

3737
.. _admin-upgrades_replication_cluster:
3838

doc/concepts/modules.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ For example, here's a Lua application that uses ``myfun()`` from
4040
end
4141
4242
Tarantool provides an `extensive library <https://www.tarantool.io/en/download/rocks>`_ of compatible modules.
43-
Install them using Tarantool's CLI utility :ref:`tarantoolctl <tarantoolctl>`.
43+
Install them using Tarantool's CLI utilities like :ref:`tarantoolctl <tarantoolctl>`
44+
or :ref:`tt CLI <tt-cli>`.
4445
Some modules are also included in the Tarantool repository and can be installed
4546
via your operating system's package manager.
4647

doc/reference/tooling/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ to work with Tarantool.
88
:maxdepth: 1
99

1010
interactive_console
11+
tt_cli/index
1112
tarantoolctl
1213
luajit_memprof
1314
luajit_getmetrics
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Arguments
2+
=========
3+
4+
``tt`` has the following arguments:
5+
6+
.. container:: table
7+
8+
.. list-table::
9+
:widths: 40 60
10+
:header-rows: 0
11+
12+
* - ``--cfg=FILE``
13+
14+
``-c=FILE``
15+
- Path to the :ref:`configuration file <tt-config_file>`.
16+
* - ``--internal``
17+
18+
``-I``
19+
- Force the use of an internal module even if there is an :doc:`external module <external_modules>` with the same name.
20+
* - ``--local=DIRECTORY``
21+
22+
``-L=DIRECTORY``
23+
- Use the ``tt`` environment from the specified directory.
24+
Learn more about the :ref:`local launch mode <tt-config_modes-local>`.
25+
* - ``--system``
26+
27+
``-S``
28+
- Use the ``tt`` environment installed in the system.
29+
Learn more about the :ref:`system launch mode <tt-config_modes-system>`.
30+
* - ``--help``
31+
32+
``-h``
33+
- Display help.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
.. _tt-build:
2+
3+
Building an application
4+
=======================
5+
6+
.. code-block:: bash
7+
8+
tt build [PATH] [flags]
9+
10+
11+
``tt build`` builds a Tarantool application locally.
12+
13+
Flags
14+
-----
15+
16+
.. container:: table
17+
18+
.. list-table::
19+
:widths: 30 70
20+
:header-rows: 0
21+
22+
* - ``--spec``
23+
- Path to a ``.rockspec`` file to use for the current build
24+
25+
26+
Details
27+
-------
28+
29+
The ``PATH`` argument should contain the path to the application directory
30+
(that is, to the build source). The default path is ``.`` (current directory).
31+
32+
The application directory must contain a ``.rockspec`` file to use for the build.
33+
If there is more than one ``.rockspec`` file in the application directory, specify
34+
the one to use in the ``--spec`` argument.
35+
36+
``tt build`` builds an application with the ``tt rocks make`` command.
37+
It downloads the application dependencies into the ``.rocks`` directory,
38+
making the application ready to run locally.
39+
40+
Pre-build and post-build scripts
41+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42+
43+
In addition to building the application with LuaRocks, ``tt build``
44+
can execute *pre-build* and *post-build* scripts. These scripts should
45+
contain steps to execute right before and after building the application.
46+
These files must be named ``tt.pre-build`` and ``tt.post-build`` correspondingly
47+
and located in the application directory.
48+
49+
.. note::
50+
51+
For compatibility with Cartridge applications,
52+
the pre-build and post-build scripts can also have names ``cartridge.pre-build``
53+
and ``cartridge.post-build``.
54+
55+
If your application depends on closed-source rocks, or if the build should contain
56+
rocks from a project added as a submodule, **install** these
57+
dependencies using the pre-build script **before** building.
58+
For example, add the following line:
59+
60+
.. code-block:: bash
61+
62+
tt rocks make --chdir ./third_party/proj
63+
64+
Learn more about :doc:`pre-build and post-build scripts </book/cartridge/cartridge_cli/pre-post-build>`.
65+
66+
Examples
67+
--------
68+
69+
* Build the application ``app1`` from its directory:
70+
71+
.. code-block:: bash
72+
73+
tt build
74+
75+
* Build the application ``app1`` from the ``simple_app`` directory inside the current directory:
76+
77+
.. code-block:: bash
78+
79+
tt build simple_app
80+
81+
* Build the application ``app1`` from its directory explicitly specifying the rockspec file to use:
82+
83+
.. code-block:: bash
84+
85+
tt build --spec app1-scm-1.rockspec

doc/reference/tooling/tt_cli/cat.rst

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
Printing the contents of .snap and .xlog files
2+
==============================================
3+
4+
.. code-block:: bash
5+
6+
tt cat FILE .. [flags]
7+
8+
``tt cat`` prints the contents of :ref:`snapshot <internals-snapshot>` (``.snap``) and
9+
:ref:`WAL <internals-wal>` (``.xlog``) files to stdout. A single call of ``tt cat`` can
10+
print the contents of multiple files.
11+
12+
13+
Flags
14+
-----
15+
16+
.. container:: table
17+
18+
.. list-table::
19+
:widths: 20 80
20+
:header-rows: 0
21+
22+
* - ``--format``
23+
- Output format: ``yaml`` (default), ``json``, or ``lua``
24+
* - ``--from``
25+
- Show operations starting from the given LSN
26+
* - ``--to``
27+
- Show operations up to the given LSN. Default: 18446744073709551615
28+
* - ``--replica``
29+
- Filter the output by replica ID. Can be passed more than once
30+
* - ``--space``
31+
- Filter the output by space ID. Can be passed more than once
32+
* - ``--show-system``
33+
- Show the contents of system spaces
34+
35+
Details
36+
-------
37+
38+
When calling ``tt cat`` with filters by LSN (``--from`` and ``--to`` flags) and
39+
replica ID (``--replica``), remember that LSNs differ across replicas.
40+
Thus, if you pass more than one replica ID via ``--from`` or ``--to``,
41+
the result may not reflect the actual sequence of operations.
42+
43+
Examples
44+
--------
45+
46+
* Output contents of ``00000000000000000000.xlog`` WAL file in the YAML format:
47+
48+
.. code-block:: bash
49+
50+
tt cat 00000000000000000000.xlog
51+
52+
* Output operations on spaces with ``space_id`` 512 and 513 from the
53+
``00000000000000000012.snap`` snapshot file in the JSON format:
54+
55+
.. code-block:: bash
56+
57+
tt cat 00000000000000000012.snap --space 512 --space 513 --format json
58+
59+
* Output operations on all spaces, including system spaces,
60+
from the ``00000000000000000000.xlog`` WAL file:
61+
62+
.. code-block:: bash
63+
64+
tt cat 00000000000000000000.xlog --show-system
65+
66+
* Output operations with LSNs between 100 and 500 on replica 1
67+
from the ``00000000000000000000.xlog`` WAL file:
68+
69+
.. code-block:: bash
70+
71+
tt cat 00000000000000000000.xlog --from 100 --to 500 --replica 1
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Checking an application file
2+
============================
3+
4+
.. code-block:: bash
5+
6+
tt check APP_FILE
7+
8+
``tt check`` checks the specified Tarantool application file for syntax errors.
9+
10+
Details
11+
-------
12+
13+
``tt`` searches for ``APP_FILE`` inside the ``instances_enabled`` directory
14+
specified in the :ref:`tt configuration file <tt-config_file_app>`. ``APP_FILE`` can be:
15+
16+
* the name of an application file without the ``.lua`` extension.
17+
* the name of a directory containing the ``init.lua`` file. In this case, ``init.lua`` is checked.
18+
19+
20+
Examples
21+
--------
22+
23+
* Check the syntax of the ``app.lua`` file from the ``instances_enabled`` directory:
24+
25+
.. code-block:: bash
26+
27+
tt check app
28+
29+
30+
* Check the syntax of the ``init.lua`` file from the ``instance1/`` directory inside ``instances_enabled``:
31+
32+
.. code-block:: bash
33+
34+
tt check instance1
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
.. _tt-clean:
2+
3+
Cleaning instance files
4+
=======================
5+
6+
.. code-block:: bash
7+
8+
tt clean INSTANCE|APPLICATION [flags]
9+
10+
``tt clean`` cleans stored files of Tarantool instances: logs, snapshots, and
11+
other files. To avoid accidental deletion of files, ``tt clean`` shows
12+
the files it is going to delete and asks for confirmation.
13+
14+
Flags
15+
-----
16+
17+
.. container:: table
18+
19+
.. list-table::
20+
:widths: 30 70
21+
:header-rows: 0
22+
23+
* - ``-f``
24+
25+
``--force``
26+
- Clean files without confirmation
27+
28+
29+
Examples
30+
--------
31+
32+
Single instance
33+
~~~~~~~~~~~~~~~
34+
35+
* Clean the files of the ``app`` instance:
36+
37+
.. code-block:: bash
38+
39+
tt clean app
40+
41+
Multiple instances
42+
~~~~~~~~~~~~~~~~~~
43+
44+
* Clean the files of all instances of the ``app`` application:
45+
46+
.. code-block:: bash
47+
48+
tt clean app
49+
50+
* Clean the files of the ``master`` instance of the ``app`` application:
51+
52+
.. code-block:: bash
53+
54+
tt clean app:master

0 commit comments

Comments
 (0)