The Option File
Set DBTrail's settings in /etc/dbtrail/dbtrail.cnf, written like MySQL's my.cnf, and check every line with dbtrail config check.
Needs DBTrail 0.131.0 or newer.
Every DBTrail program reads /etc/dbtrail/dbtrail.cnf when it starts. It is
written like MySQL's my.cnf: options under a [dbtrail] group, one per
line.
[dbtrail]
commit-within = 2s
rotate-retain = 7d
index-dsn = 'dbtrail:secret@tcp(127.0.0.1:3306)/dbtrail_index'An option is the name of its environment variable without BINTRAIL_, in
lower case, with dashes: BINTRAIL_COMMIT_WITHIN is commit-within.
commit_within reads the same.
Every option is on a page of its own, with what it changes, its default and which programs read it. From 0.135.0, every install comes with the same list as a file, every option explained and commented out.
Check it
dbtrail config checkIt lists the settings the file sets, with their lines, and every line that is not used, and why. It exits with an error when it finds one, so a deploy can stop there. It never prints a value, since a value can hold a password.
See what is in effect
Needs DBTrail 0.135.0 or newer.
dbtrail config show
dbtrail config show --allIt lists every setting that has a value, the value and where it comes from:
the environment, .bintrail.env or config.env, or a line of the file. A
password, a token or a key is never printed, and neither is any other value
that looks like it carries one. --all also lists the settings with no value.
What wins
- An option on the command line.
- The environment DBTrail was started with. A variable set to an empty value does not hide the file.
.bintrail.envin the current folder, or~/.config/bintrail/config.env./etc/dbtrail/dbtrail.cnf.- The default.
A change to the file is used at the next start. DBTrail never writes to it: what you save in the web interface stays where the web interface saves it.
For index rotation and the backup settings, a value saved in the web interface
comes before all of these. The web interface says which value it is using
instead of what, and where that is set, and dbtrail config check says when a
line of the file is not used because of it.
The file is only read from /etc/dbtrail/dbtrail.cnf, never from the folder
you are in. The dbtrail commands that talk to a running DBTrail send a
password, and a file in whatever folder you happen to be in must not decide
where it goes.
Lines that are not used
DBTrail starts anyway and prints a warning with the line number:
- An option DBTrail does not have. The warning names the nearest one.
Write
loose-in front (loose-new-option = 1) to keep a line for a newer version without the warning. - An option with no value, or one before any
[group]. - A name DBTrail sets for its own processes, one that no longer does anything, or one for its tests.
- An option the environment or
.bintrail.envalready sets. !includeand!includedir, which are not followed.- Text after the
]of a group, or a[bintrail]group with no[dbtrail].
Other groups ([client], [mysqld]) are left alone. When an option is
written twice, the last line that can be used wins.
Values
They are read as MySQL reads them. A # outside quotes starts a comment, so
a password with a # goes in quotes; DBTrail warns when a # cuts a value
that can hold a password. A backslash starts an escape (\n, \t, \s),
so write \\ for a backslash.
Permissions
- A file every user on the machine can change is not used at all, as
MySQL does: it could point DBTrail at another server. Fix it with
chmod o-w /etc/dbtrail/dbtrail.cnf. - A file every user can read that sets a DSN or another secret is used, with
a warning. Fix it with
chmod o-r /etc/dbtrail/dbtrail.cnf.
With Docker Compose
DBTrail runs inside containers and reads the file there. From 0.135.0, put it in dbtrail-config/dbtrail.cnf, in the folder that holds
docker-compose.yml: the compose file mounts that folder in every DBTrail
service. The installer leaves a copy there with every option commented out.
Restart the stack after a change: docker compose restart.
The services read it as user 999. Once it holds a password, chown 999 and
chmod 600 it.
If you mounted the file yourself before, with a docker-compose.override.yml
like this one, it keeps being read. Move it to dbtrail-config/dbtrail.cnf and
delete the override when you can, so there is one place to look.
services:
bintrail:
volumes:
- ./dbtrail.cnf:/etc/dbtrail/dbtrail.cnf:roThe ./dbtrail config check of the stack runs inside the container, with
DBTrail's own environment.
With the packages
From 0.135.0, the bintrail-console package (.deb and
.rpm) installs the file at /etc/dbtrail/dbtrail.cnf, every option commented
out, and an upgrade never replaces it. Once it holds a password,
chgrp bintrail and chmod 640 it, which keeps it readable by the service.
dbtrail config check compares the file with what the web interface saved in
the service's server list: name it with
--servers-file /var/lib/bintrail/console-servers.yaml.
Web Interface on a Hostname
Put the DBTrail web interface on console.example.com with TLS, covering DNS, certificate, and the Host header rule that returns 403 until you set it.
Every Option
Every setting of /etc/dbtrail/dbtrail.cnf, what it changes, its default, its environment variable and which programs read it.