Skip to content
Snippets Groups Projects

Database profiles

Introduction

In this folder are several ini files. They describe a database environment by the [detect] section. If a profile matches then a database will be dumped or restored.

File names

File convention: <DBTYPE>_<PROFILE>.ini

  • must match a database dumper in plugins/localdump/ without extension ".sh"

  • _ is the target folder to store backups.

    • is a custom name to
    • _ can be empty to mark a local database of the given type.

Detect

To detect the existance of you can use the following keys. If all found detect entries match it is counted as detected.

Key Type Description
file[] string full path of a file. It must match "type". It can be given multiple times.
process regex A binary to be matched in the process list
tcp integer A tcp port number that must match
tcp-process regex A process name offering the local tcp port (regex for last column in netstat -tulpen)
tcp-target string A hostname for tcp port check, eg localhost
type regex a matching regex for file -b FILE

Example:

Mysql detection in a docker container:

[detect]
process = 'mysqld|mariadb'
tcp = 13306
tcp-target = localhost
tcp-process = 'rootlesskit'

Multiple Sqlite files

[detect]
file[] = "/home/axel/data/docker/ciserver/data/imldeployment/data/database/logs.db"
file[] = "/home/axel/data/docker/ciserver/public_html/valuestore/data/versioncache.db"
type = "sqlite"

Setter

If a profile detection was successful then values in the [set] section will be applied.

Key Type Description
su string User for su command; used for postgres
dbuser string Database user; for replacement
dbpassword string Password of database user; for replacement
params string cli paramaters für dump / restore tools.
env string extend environment with some variables, eg. export var1="something here". After backup/ restore this variables will be unset

Replacements that can be used for values params and env:

Key Description
{{tcp}} value of [detect] -> tcp
{{dbpassword}} value of [set] -> dbpassword
{{dbuser}} value of [set] -> dbuser
{{tcp-target}} value of [detect] -> tcp-target
[set]

su = ''
dbuser = 'root'
dbpassword = '12345678'
params = '--port={{tcp}} --password={{dbpassword}} --user={{dbuser}} --host={{tcp-target}}'

env = 'export var1="happy meal"; export var2="new"; export var3="year!"'