From e07a77709384c9ac11cdc0b141ed57118118d8ee Mon Sep 17 00:00:00 2001
From: Pavel Semyonov
Date: Mon, 13 Feb 2023 17:55:12 +0700
Subject: [PATCH] Add tt init reference page
---
doc/reference/tooling/tt_cli/commands.rst | 2 +
doc/reference/tooling/tt_cli/init.rst | 52 +++++++++++++++++++++++
2 files changed, 54 insertions(+)
create mode 100644 doc/reference/tooling/tt_cli/init.rst
diff --git a/doc/reference/tooling/tt_cli/commands.rst b/doc/reference/tooling/tt_cli/commands.rst
index 4569aaf5fb..6a9f9f50a0 100644
--- a/doc/reference/tooling/tt_cli/commands.rst
+++ b/doc/reference/tooling/tt_cli/commands.rst
@@ -30,6 +30,8 @@ help for the given command.
- Create an application from a template
* - :doc:`help `
- Display help for ``tt`` or a specific command
+ * - :doc:`init `
+ - Create a new ``tt`` environment in the current directory
* - :doc:`logrotate `
- Rotate instance logs
* - :doc:`play `
diff --git a/doc/reference/tooling/tt_cli/init.rst b/doc/reference/tooling/tt_cli/init.rst
new file mode 100644
index 0000000000..f845a39075
--- /dev/null
+++ b/doc/reference/tooling/tt_cli/init.rst
@@ -0,0 +1,52 @@
+.. _tt-init:
+
+Creating a tt environment
+=========================
+
+.. code-block:: bash
+
+ tt init
+
+``tt init`` creates a ``tt`` environment in the current directory. This includes:
+
+* Setting up directories for working files: binaries, templates, and so on.
+* Creating a corresponding ``tt.yaml`` :ref:`configuration file `.
+
+Details
+-------
+
+``tt init`` checks the existence of configuration files for Cartridge (``cartridge.yml``)
+or the ``tarantoolctl`` utility (``.tarantoolctl``) in the current directory.
+If such files are found, ``tt`` generates an environment that uses the same
+directories:
+
+* ``cartridge.yml`` -- the directories specified in the file.
+* ``.tarantoolctl`` -- the directories specified in the ``default_cfg`` table.
+
+ .. note::
+
+ ``init`` is the only ``tt`` command that invokes ``.tarantoolctl`` files.
+ Thus, variables defined in this script will not be available in
+ applications launched by a ``tt start`` call.
+
+If there is no ``cartridge.yml`` or ``.tarantoolctl`` files in the current directory,
+``tt init`` creates a default environment in it. This includes creating the
+following directories and files:
+
+* ``bin`` -- the directory for storing binary files.
+* ``include`` -- the directory for storing header files.
+* ``distfiles`` -- the directory for storing installation files.
+* ``instances.enabled`` -- the directory for storing running applications or symlinks.
+* ``modules`` -- the directory for storing external modules.
+* ``tt.yaml`` -- the configuration file.
+* ``templates`` -- the directory for storing application templates.
+
+
+Example
+--------
+
+Create a ``tt`` environment in the current directory:
+
+.. code-block:: bash
+
+ tt init
\ No newline at end of file