@@ -14,36 +14,63 @@ execution is its configuration file.
14
14
By default, the configuration file is called ``tt.yaml ``. The location
15
15
where ``tt `` searches for it depends on the :ref: `launch mode <tt-config_modes >`.
16
16
You can also pass the configuration file explicitly in the ``--cfg ``
17
- :ref: `option <tt-global-options >`.
17
+ :ref: `global option <tt-global-options >`.
18
18
19
- The ``tt `` configuration file is a YAML file with the following content :
19
+ The ``tt `` configuration file is a YAML file with the following structure :
20
20
21
21
.. code-block :: yaml
22
22
23
- tt :
24
- modules :
25
- directory : path/to/modules/dir
26
- app :
27
- instances_enabled : path/to/applications
28
- run_dir : path/to/run_dir
29
- log_dir : path/to/log_dir
30
- bin_dir : path/to/bin_dir
31
- inc_dir : path/to/inc_dir
32
- wal_dir : path/to/wal_dir
33
- vinyl_dir : path/to/vinyl_dir
34
- memtx_dir : path/to/memtx_dir
35
- log_maxsize : num (MB)
36
- log_maxage : num (days)
37
- log_maxbackups : num
38
- restart_on_failure : bool
39
- repo :
40
- rocks : path/to/rocks
41
- distfiles : path/to/install
42
- ee :
43
- credential_path : path/to/file
44
- templates :
45
- - path : path/to/app/templates1
46
- - path : path/to/app/templates2
23
+ env :
24
+ instances_enabled : path/to/available/applications
25
+ bin_dir : path/to/bin_dir
26
+ inc_dir : path/to/inc_dir
27
+ restart_on_failure : bool
28
+ tarantoolctl_layout : bool
29
+ modules :
30
+ directory : path/to/modules/dir
31
+ app :
32
+ run_dir : path/to/run_dir
33
+ log_dir : path/to/log_dir
34
+ wal_dir : path/to/wal_dir
35
+ vinyl_dir : path/to/vinyl_dir
36
+ memtx_dir : path/to/memtx_dir
37
+ repo :
38
+ rocks : path/to/rocks
39
+ distfiles : path/to/install
40
+ ee :
41
+ credential_path : path/to/file
42
+ templates :
43
+ - path : path/to/app/templates1
44
+ - path : path/to/app/templates2
45
+
46
+ .. note ::
47
+
48
+ The ``tt `` configuration format and application layout have been changed in version
49
+ 2.0. Learn how to upgrade from earlier versions in :ref: `tt-config_migrating-from-1 `.
50
+
51
+ .. _tt-config_file_env :
52
+
53
+ env section
54
+ ~~~~~~~~~~~
55
+
56
+ .. note ::
57
+
58
+ The paths specified in ``env.* `` parameters are relative to the current ``tt ``
59
+ environment's root.
60
+
61
+ * ``instances_enabled `` -- the directory where :ref: `instances <admin-instance_file >`
62
+ are stored. Default: ``instances.enabled ``.
63
+ * ``bin_dir `` -- the directory where binary files are stored. Default: ``bin ``.
64
+ * ``inc_dir `` -- the base directory for storing header files. They will
65
+ be placed in the ``include `` subdirectory inside the specified directory.
66
+ Default: ``include ``.
67
+ * ``restart_on_failure `` -- restart the instance on failure: ``true `` or ``false ``.
68
+ Default: ``false ``.
69
+ * ``tarantoolctl_layout `` -- use a layout compatible with the deprecated ``tarantoolctl ``
70
+ utility for artifact files: control sockets, ``.pid `` files, log files.
71
+ Default: ``false ``.
72
+
73
+ .. _tt-config_file_modules :
47
74
48
75
modules section
49
76
~~~~~~~~~~~~~~~
@@ -56,44 +83,25 @@ modules section
56
83
app section
57
84
~~~~~~~~~~~
58
85
59
- * ``instances_enabled `` -- the directory where :ref: `instances <admin-instance_file >`
60
- are stored.
86
+ .. note ::
87
+
88
+ The paths specified in ``app.*_dir `` parameters are relative to the application
89
+ location inside the ``instances.enabled `` directory specified in the ``env ``
90
+ configuration section. For example, the default location of the ``myapp ``
91
+ application's logs is ``instances.enabled/myapp/var/log ``.
92
+ Inside this location, ``tt `` creates separate directories for each application
93
+ instance that runs in the current environment.
94
+
61
95
* ``run_dir ``-- the directory for instance runtime artifacts, such as console
62
96
sockets or PID files. Default: ``var/run ``.
63
97
* ``log_dir `` -- the directory where log files are stored. Default: ``var/log ``.
64
- * ``bin_dir `` -- the directory where binary files are stored. Default: ``bin ``.
65
- * ``inc_dir `` -- the base directory for storing header files. They will
66
- be placed in the ``include `` subdirectory inside the specified directory.
67
- Default: ``include ``.
68
98
* ``wal_dir `` -- the directory where write-ahead log (``.xlog ``) files are stored.
69
99
Default: ``var/lib ``.
70
100
* ``memtx_dir `` -- the directory where memtx stores snapshot (``.snap ``) files.
71
101
Default: ``var/lib ``.
72
102
* ``vinyl_dir `` -- the directory where vinyl files or subdirectories are stored.
73
103
Default: ``var/lib ``.
74
104
75
- .. note ::
76
-
77
- In all directories specified in ``*_dir `` parameters, ``tt `` creates a
78
- directory for each application and instance directories inside it.
79
- Names of these directories match the names of applications and instances.
80
-
81
- * ``log_maxsize `` -- the maximum size of the log file before it gets rotated,
82
- in megabytes. Default: 100.
83
- * ``log_maxage `` -- the maximum age of log files in days. The age of a log
84
- file is defined by the timestamp encoded in its name. Default: not defined
85
- (log files aren't deleted based on their age).
86
-
87
- .. note ::
88
-
89
- A day is defined as exactly 24 hours. It may not exactly correspond to
90
- calendar days due to daylight savings, leap seconds, and other time adjustments.
91
-
92
- * ``log_maxbackups `` -- the maximum number of stored log files.
93
- Default: not defined (log files aren't deleted based on their count).
94
- * ``restart_on_failure `` -- restart the instance on failure: ``true `` or ``false ``.
95
- Default: ``false ``.
96
-
97
105
.. _tt-config_file_repo :
98
106
99
107
repo section
@@ -131,7 +139,7 @@ configuration file. There are three launch modes:
131
139
Default launch
132
140
~~~~~~~~~~~~~~
133
141
134
- **Argument **: none
142
+ **Global option **: none
135
143
136
144
**Configuration file **: searched from the current directory to the root.
137
145
Taken from ``/etc/tarantool `` if the file is not found.
@@ -143,7 +151,7 @@ Taken from ``/etc/tarantool`` if the file is not found.
143
151
System launch
144
152
~~~~~~~~~~~~~
145
153
146
- **Argument **: ``--system `` or ``-S ``
154
+ **Global option **: ``--system `` or ``-S ``
147
155
148
156
**Configuration file **: Taken from ``/etc/tarantool ``.
149
157
@@ -154,10 +162,68 @@ System launch
154
162
Local launch
155
163
~~~~~~~~~~~~
156
164
157
- **Argument **: ``--local=DIRECTORY `` or ``-L=DIRECTORY ``
165
+ **Global option **: ``--local=DIRECTORY `` or ``-L=DIRECTORY ``
158
166
159
167
**Configuration file **: Searched from the specified directory to the root.
160
168
Taken from ``/etc/tarantool `` if the file is not found.
161
169
162
170
**Working directory **: The specified directory. If ``tarantool `` or ``tt ``
163
- executable files are found in the working directory, they will be used.
171
+ executable files are found in the working directory, they will be used.
172
+
173
+ .. _tt-config_migrating-from-1 :
174
+
175
+ Migrating from tt 1.* to 2.0 or later
176
+ -------------------------------------
177
+
178
+ The `tt ` configuration and application layout were changed in version 2.0.
179
+ If you are using ``tt `` 1.*, complete the following steps to migrate to ``tt `` 2.0 or later:
180
+
181
+ #. **Update the tt configuration file **.
182
+ In tt 2.0, the following changes were made to the configuration file:
183
+
184
+ * The root section ``tt `` was removed. Its child sections -- ``app ``, ``repo ``,
185
+ ``modules ``, and other -- have been moved to the top level.
186
+ * Environment configuration parameters were moved from the ``app `` section
187
+ to the new section ``env ``. These parameters are ``instances.enabled ``,
188
+ ``bin_dir ``, ``inc_dir ``, and ``restart_on_failure ``.
189
+ * The paths in the ``app `` section are now relative to the app directory in ``instances.enabled ``
190
+ instead of the environment root.
191
+
192
+ You can use :ref: `tt init <tt-init >` to generate a configuration file with
193
+ the new structure and default parameter values.
194
+
195
+ #. **Move application artifacts **.
196
+ With ``tt `` 1.*, application artifacts (logs, snapshots, pid, and other files)
197
+ were created in the ``var `` directory inside the *environment root *. Starting from
198
+ ``tt `` 2.0, these artifacts are created in the ``var `` directory inside the
199
+ *application directory *, which is ``instances.enabled/<app-name> ``. This is
200
+ how an application directory looks:
201
+
202
+ .. code-block :: text
203
+
204
+ instances.enabled/app/
205
+ ├── init.lua
206
+ ├── instances.yml
207
+ └── var
208
+ ├── lib
209
+ │ ├── instance1
210
+ │ └── instance2
211
+ ├── log
212
+ │ ├── instance1
213
+ │ └── instance2
214
+ └── run
215
+ ├── instance1
216
+ └── instance2
217
+
218
+ To continue using existing application artifacts after migration from ``tt `` 1.*:
219
+
220
+ #. Create the ``var `` directory inside the application directory.
221
+ #. Create the ``lib ``, ``log ``, and ``run `` directories inside ``var ``.
222
+ #. Move directories with instance artifacts from the old ``var `` directory
223
+ to the new ``var `` directories in applications' directories.
224
+
225
+ #. **Move the files accessed from the application code **.
226
+ The working directory of instance processes was changed from the ``tt `` working
227
+ directory to the application directory inside ``instances.enabled ``. If the
228
+ application accesses files using relative paths, move the files accordingly
229
+ or adjust the application code.
0 commit comments