Configuration
The key artifact that defines the tt environment and various aspects
of its execution is its configuration file. You can generate it with a
tt init call. In the
default launch mode, the file is generated in
the current directory, making it the environment root.
By default, the configuration file is called tt.yaml and located in
the tt environment root directory. It depends on the
launch mode.
It is also possible to pass the configuration file name and location explicitly using the following ways:
-c/--cfgglobal optionTT_CLI_CFGenvironment variable.
The TT_CLI_CFG variable has a lower priority than the --cfg option.
The tt configuration file is a YAML file with the following structure:
env:instances_enabled: path/to/available/applicationsbin_dir: path/to/bin_dirinc_dir: path/to/inc_dirrestart_on_failure: booltarantoolctl_layout: boolmodules:directory: path/to/modules/dirapp:run_dir: path/to/run_dirlog_dir: path/to/log_dirwal_dir: path/to/wal_dirvinyl_dir: path/to/vinyl_dirmemtx_dir: path/to/memtx_dirrepo:rocks: path/to/rocksdistfiles: path/to/installee:credential_path: path/to/filetemplates:- path: path/to/app/templates1- path: path/to/app/templates2
-
instances_enabled– the directory where instances are stored. Default:instances.enabled. -
bin_dir– the directory where binary files are stored. Default:bin. -
inc_dir– the base directory for storing header files. They will be placed in theincludesubdirectory inside the specified directory. Default:include. -
restart_on_failure– restart the instance on failure:trueorfalse. Default:false. -
tarantoolctl_layout– use a layout compatible with the deprecatedtarantoolctlutility for artifact files: control sockets,.pidfiles, log files. Default:false.
directory– the directory where external modules are stored.
run_dir– the directory for instance runtime artifacts, such as console sockets or PID files. Default:var/run.log_dir– the directory where log files are stored. Default:var/log.wal_dir– the directory where write-ahead log (.xlog) files are stored. Default:var/lib.memtx_dir– the directory where memtx stores snapshot (.snap) files. Default:var/lib.vinyl_dir– the directory where vinyl files or subdirectories are stored. Default:var/lib.
-
rocks– the directory where rocks files are stored. -
distfiles– the directory where installation files are stored.
-
credential_path– a path to the file with credentials used for downloading Tarantool Enterprise Edition (Tarantool customer zone credentials). The file should contain a username and a password, each on a separate line. Find an example in the tt install command reference.
path– a path to application templates used for creating applications with tt create. May be specified more than once.
tt launch mode defines its working directory and the way it searches
for the configuration file. There are three launch modes:
- default
- system
- local
Global option: none
Configuration file: searched from the current directory to the root.
Taken from /etc/tarantool if the file is not found.
Working directory: The directory where the configuration file is found.
Global option: --system or -S
Configuration file: Taken from /etc/tarantool.
Working directory: Current directory.
Global option: --local=DIRECTORY or -L=DIRECTORY
Configuration file: Searched from the specified directory to the
root. Taken from /etc/tarantool if the file is not found.
Working directory: The specified directory. If tarantool or tt
executable files are found in the working directory, they will be used.
The tt configuration and application layout were changed
in version 2.0. If you are using tt 1.*, complete the following steps
to migrate to tt 2.0 or later:
-
Update the tt configuration file. In tt 2.0, the following changes were made to the configuration file:
- The root section
ttwas removed. Its child sections –app,repo,modules, and other – have been moved to the top level. - Environment configuration parameters were moved from the
appsection to the new sectionenv. These parameters areinstances.enabled,bin_dir,inc_dir, andrestart_on_failure. - The paths in the
appsection are now relative to the app directory ininstances.enabledinstead of the environment root.
You can use tt init to generate a configuration file with the new structure and default parameter values.
- The root section
-
Move application artifacts. With
tt1.*, application artifacts (logs, snapshots, pid, and other files) were created in thevardirectory inside the environment root. Starting fromtt2.0, these artifacts are created in thevardirectory inside the application directory, which isinstances.enabled/<app-name>. This is how an application directory looks:instances.enabled/app/├── init.lua├── instances.yml└── var├── lib│ ├── instance1│ └── instance2├── log│ ├── instance1│ └── instance2└── run├── instance1└── instance2To continue using existing application artifacts after migration from
tt1.*:- Create the
vardirectory inside the application directory. - Create the
lib,log, andrundirectories insidevar. - Move directories with instance artifacts from the old
vardirectory to the newvardirectories in applications' directories.
- Create the
-
Move the files accessed from the application code. The working directory of instance processes was changed from the
ttworking directory to the application directory insideinstances.enabled. If the application accesses files using relative paths, move the files accordingly or adjust the application code.