Aegis documentation

#Cube: mariadb

MariaDB 13 with its own data directory and socket. The server runs as the mysql operating-system account and the platform gets a superuser with the password from aegis.toml.

In the panel: Database → MariaDB. Every write there is a task.

#Configuration

toml
[mariadb]port = 3306user = "mysql"                    # operating-system accountconfig_dir = "/aegis/config/mariadb"data_dir = "/aegis/data/mariadb"run_dir = "/aegis/run/mariadb"log_dir = "/aegis/logs/mariadb"max_connections = 200innodb_buffer_pool = "512M"
KeyDefaultMeaning
port3306TCP port on 127.0.0.1
usermysqlsystem account the server runs as
config_dir/aegis/config/mariadbaegis-my.cnf
data_dir/aegis/data/mariadbdatadir created by mariadb-install-db
run_dir/aegis/run/mariadbsocket and pid file
log_dir/aegis/logs/mariadberror.log
max_connections200server ceiling
innodb_buffer_pool512MInnoDB buffer pool size

The platform role comes from [aegis] user / [aegis] password; configure creates it on both localhost and 127.0.0.1 with GRANT ALL … WITH GRANT OPTION.

#Files

text
<mariadb.config_dir>/└── aegis-my.cnf             server configuration (0600)<mariadb.data_dir>/          data directory (mariadb-install-db)<mariadb.run_dir>/├── mysqld.sock└── mysqld.pid<mariadb.log_dir>/└── error.log

#Commands

bash
aegis cubes mariadb configure      # data directory on first run, config, startaegis cubes mariadb validate       # mariadb-admin ping over the socketaegis cubes mariadb reload         # FLUSH PRIVILEGES + table cacheaegis cubes mariadb start|stop|restart|statusaegis cubes mariadb databases list|create|dropaegis cubes mariadb users list|add|remove|password|grant|revokeaegis cubes mariadb tables <db> list|check|repair|optimize|analyzeaegis cubes mariadb expose

#Users

A user is created on both local hosts (localhost and 127.0.0.1), because MariaDB treats them as different accounts and the platform connects over TCP. Grants are per database; nothing is granted globally.

bash
# generated password, printed onceaegis cubes mariadb users add shop --database shop_db# explicit password, granted on two databasesaegis cubes mariadb users add shop --password 'secret'     --database shop_db --database shop_statsaegis cubes mariadb users grant  shop shop_statsaegis cubes mariadb users revoke shop shop_statsaegis cubes mariadb users password shop --password 'new-secret'aegis cubes mariadb users remove shop

users list shows user@host pairs. add refuses a name that already exists; it never resets the password of an existing account (that is password).

#Tables and maintenance

bash
aegis cubes mariadb tables shop_db listaegis cubes mariadb tables shop_db checkaegis cubes mariadb tables shop_db repairaegis cubes mariadb tables shop_db optimize orders invoicesaegis cubes mariadb tables shop_db analyze
ActionStatementUse
checkCHECK TABLEreports errors without touching data
repairREPAIR TABLEfixes crash damage (MyISAM; InnoDB reports "not supported")
optimizeOPTIMIZE TABLErewrites the table, reclaims space
analyzeANALYZE TABLErefreshes index statistics

Without a table list, the action runs on every table of the database. A failure names the table and stops with the first ten problems.

#configure

  • creates the mysql group and user when missing;
  • renders aegis-my.cnf;
  • runs mariadb-install-db when the data directory is empty —
  • --auth-root-authentication-method=normal, --skip-test-db, with the rendered defaults file;

  • starts the server through the keeper;
  • creates or updates the platform role.
  • Where the bootstrap tool lives: mariadb-install-db is installed under scripts/, not bin/, so the cube searches bin, sbin and scripts.

    #The platform role

    [aegis] user / [aegis] password become a superuser on both local hosts (localhost and 127.0.0.1), because a client that resolves localhost to IPv6 would otherwise fail:

    bash
    mariadb -h 127.0.0.1 -u aegis -p

    root over the socket has no password (--auth-root-authentication-method=normal), which is what the cube itself uses for administration.

    #databases

    Created databases get utf8mb4 / utf8mb4_unicode_ci and a GRANT ALL to the platform role for both local hosts.

    #Process

    toml
    [services.mariadb]command  = <prefix>/bin/mariadbd --defaults-file=<config_dir>/aegis-my.cnfpid_file = <run_dir>/mysqld.piduser     = mysql

    #expose

    bash
    aegis cubes mariadb exposecube           mariadbinstalled      /aegis/apps/data/mariadb/13.0configuration  /aegis/config/mariadbstate          running pid 741852log            /aegis/logs/mariadb/error.logconfig         /aegis/config/mariadb/aegis-my.cnfdata           /aegis/data/mariadbport           3306socket         /aegis/run/mariadb/mysqld.sockpublished      /aegis/bin/mariadb /aegis/bin/mariadb-admin 

    #Notes

  • The MariaDB client prints a TLS warning on stderr (`--ssl-verify-server-cert
  • is disabled`); the cube reads only stdout, so results stay clean.

  • mariadb-admin ping is the validation step: it answers without credentials
  • because root uses socket authentication.

  • Query output goes through --skip-column-names --batch and is split on |.