Skip to content

Add tt check, logrotate, connect #3051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions doc/reference/tt_cli/check.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Checking an application file
============================

.. code-block:: bash

tt check APP_FILE

``tt check`` checks the specified Tarantool application file for syntax errors.

Details
-------

``tt`` searches for ``APP_FILE`` inside the ``instances_available`` 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.


Examples
--------

* Check the syntax of the ``app.lua`` file from the ``instances_available`` directory:

.. code-block:: bash

tt check app


* Check the syntax of the ``init.lua`` file from the ``instance1/`` directory inside ``instances_available``:

.. code-block:: bash

tt check instance1
11 changes: 7 additions & 4 deletions doc/reference/tt_cli/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ help for the given command.
- Generate completion for a specified shell
* - :doc:`help <help>`
- Display help for ``tt`` or a specific command
* - ``logrotate``
- :ref:`Rotate logs <admin-logs>`
* - ``check``
* - :doc:`logrotate <logrotate>`
- Rotate instance logs
* - :doc:`check <check>`
- Check an application file for syntax errors
* - ``connect``
* - :doc:`connect <connect>`
- Connect to a Tarantool instance
* - ``rocks``
- Use the LuaRocks package manager
Expand All @@ -49,3 +49,6 @@ help for the given command.
version <version>
completion <completion>
help <help>
logrotate <logrotate>
check <check>
connect <connect>
81 changes: 81 additions & 0 deletions doc/reference/tt_cli/connect.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
Connecting to a Tarantool instance
==================================

.. code-block:: bash

tt connect URI|INSTANCE_NAME [flags]


``tt connect`` connects to a Tarantool instance by its URI or name specified
during its startup (``tt start``).

Flags
-----

.. container:: table

.. list-table::
:widths: 30 70
:header-rows: 0

* - ``-u``

``--username``
- Username
* - ``-p``

``--password``
- Password
* - ``-f``

``--file``
- Connect and evaluate the script from a file.

``-`` – read the script from stdin.

Details
-------

To connect to an instance, ``tt`` typically needs its URI -- the host name or IP address
and the port.

You can also connect to instances in the same ``tt`` environment
(that is, those that use the same :ref:`configuration file <tt-config_file>` and Tarantool installation)
by their instance names.

If authentication is required, specify the username and the password using the ``-u`` (``--username``)
and ``-p`` (``--password``) options.

By default, ``tt connect`` opens an interactive Tarantool console. Alternatively, you
can open a connection to evaluate a Lua script from a file or stdin. To do this,
pass the file path in the ``-f`` (``--file``) option or use ``-f -`` to take the script
from stdin.


Examples
--------

* Connect to the ``app`` instance in the same environment:

.. code-block:: bash

tt connect app

* Connect to the ``192.168.10.10`` host on port ``3301`` with authentication:

.. code-block:: bash

tt connect 192.168.10.10:3301 -u myuser -p p4$$w0rD

* Connect to the ``app`` instance and evaluate the code from the ``test.lua`` file:

.. code-block:: bash

tt connect app -f test.lua

* Connect to the ``app`` instance and evaluate the code from stdin:

.. code-block:: bash

echo "function test() return 1 end" | tt connect app -f - # Create the test() function
echo "test()" | tt connect app -f - # Call this function
18 changes: 18 additions & 0 deletions doc/reference/tt_cli/logrotate.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Rotate instance logs
====================

.. code-block:: bash

tt logrotate INSTANCE

``tt logrotate`` rotates logs of a specified Tarantool instance.
Learn more about :ref:`rotating logs <admin-logs>`.

Examples
--------

Rotate logs of the ``app`` instance:

.. code-block:: bash

tt logrotate app
11 changes: 6 additions & 5 deletions doc/reference/tt_cli/start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ Starting a Tarantool instance

tt start INSTANCE

``tt start`` starts the specified Tarantool :ref:`instance <admin-instance_file>`.
``tt start`` starts a Tarantool instance from an application file.

Details
-------

``INSTANCE`` is the name of an instance from the ``instances_available`` directory
specified in the :ref:`tt configuration file <tt-config_file_app>`. This can be:
The application file must be stored inside the ``instances_available``
directory specified in the :ref:`tt configuration file <tt-config_file_app>`.
The ``INSTANCE`` value can be:

* the name of an :ref:`instance file <admin-instance_file>` without the ``.lua`` extension.
* the name of a directory containing the ``init.lua`` file.
* the name of an application file without the ``.lua`` extension.
* the name of a directory containing the ``init.lua`` file. In this case, the instance is started from ``init.lua``.


Examples
Expand Down