Skip to main content

CLI reference

Most administration is done in Settings. The command-line tools cover what has to work without the web application — the first start, a lost password, scripted set-up, operations.

ToolPurpose
liberty-nextStarts the server. Address and port come from Liberty Next → Administer → App.
liberty-adminDatabase bootstrap, users, roles and data scope, installation jobs, schema migrations.
./liberty and liberty-opsOperations on a Docker or a Python install — see Operations.
liberty-connectorsLists the connectors and runs a query or an endpoint.
liberty-cryptoEncrypts a value into an ENC: string.
liberty-licenseChecks a licence key.

Docker: run them inside the container as the liberty user — docker exec -u liberty liberty-next liberty-admin list-users. Python install: run them as the service user with its environment loaded, so that they read the same configuration and the same master key as the server.


liberty-admin​

Two options apply to every command: --config-app <app.toml> and --config-connectors <connectors.toml>. Commands print JSON.

Bootstrap​

CommandEffect
init-db [--admin-username admin] [--password P | --password-env VAR]Creates the user store (the auth.toml file or the database tables) and the missing framework tables, then the first superuser. Without a password, a random one is generated and printed. Running it again changes nothing.
set-default-poolRewrites the application's default database connection from POSTGRES_HOST, _PORT, _USER, _PASSWORD and _DB — after the database moved. The password is stored encrypted. ./liberty db external runs it for you.
retarget-pools --from host[:port] --to host[:port] [--dry-run]Points every pool on one database server at another (--from pg:5432); --dry-run lists them without writing. A pool whose host is a ${VAR} is left alone.
run-install-jobs [--force]Runs, in order, every Nomaflow job of the licensed apps marked as an installation step (deploy-databases, nomasx1-import-reference). Jobs already completed are skipped unless --force.

Users​

CommandEffect
create-user <name> [--email E] [--full-name N] [--role R]… [--attribute KEY=VALUE]… [--superuser] [--password P | --password-env VAR]Creates a local user. Without a password, one is generated and printed.
set-password <name> [--password P | --password-env VAR]Changes a password; without one, generates and prints it.
set-active <name> --active | --inactiveEnables or disables a user.
set-attributes <name> KEY=VALUE… [--replace]Sets the user's data-scope attributes. company=00001,00050 gives a list; company= removes the key; --replace drops the attributes not given.
list-usersLists the users.

Roles and data scope​

CommandEffect
create-role <name> [--permission P]… [--description D] [--scope RULE]…Creates a role, or updates it.
set-scope <name> --rule RULE… | --clearReplaces the role's data-scope rules.
list-rolesLists the roles with their permissions and data scope.

A RULE is a TOML inline table or JSON object, with the keys described on Roles and permissions → Data scope:

liberty-admin set-scope subsidiary --rule '{dd = "CO", source = "#USER.company#", mode = "deny"}'
liberty-admin set-scope controllers --rule '{dd = "SY", values = ["00"], exclude = true}'
liberty-admin set-attributes alice company=00001,00050
Updating an existing role

create-role on an existing role replaces its permissions with the --permission values given; without --permission, the role keeps its permissions. To change only the scope of a role, use set-scope, which needs --rule or --clear.

Schema migrations​

liberty-admin migrate [--app X]… [--dry-run] [--target-connector C] [--revision head]
[--plugins-dir D] [--stamp REV]

Applies the pending schema migrations of each licensed app (the plugins/<app>/db modules) and records each run in Liberty Next → Deploy → History → Upgrades.

OptionEffect
--dry-runLists the pending migrations. Exit code 2 when some are pending, 0 when up to date, 1 on error.
--app nomasx1Only that app (repeatable).
--target-connector CThe connector of the database to migrate (default: the app's own).
--revision RStop at that revision instead of the latest.
--plugins-dir DWhere the apps' code is (default: plugins/ next to LIBERTY_APPS_DIR).
--stamp REVRepair: records REV as the database's current revision without running anything, then applies what is left. Needs --app. For a database whose recorded version is ahead of its real tables.

./liberty migrate and liberty-ops migrate run this command.

Upgrade reports​

record-upgrade stores an upgrade or rollback report in the upgrade history. ./liberty upgrade, ./liberty rollback and liberty-ops call it; it is not meant to be run by hand.


liberty-connectors​

Runs connectors without the web application — handy to test a pool or a query from the server.

CommandEffect
liberty-connectors listPools and connectors.
liberty-connectors describe <connector>One connector's definition.
liberty-connectors run <connector> <query or endpoint> [-p KEY=VALUE]…Runs a query (SQL connector) or calls an endpoint (API connector) and prints the result.

--config <connectors.toml> reads another file than the one named in app.toml.


liberty-crypto​

Encrypts values for the configuration files with the install's master key. Settings encrypts on its own what it saves; this tool is for a value written by hand in a TOML file.

CommandEffect
liberty-crypto encrypt [VALUE]Prints ENC:…. Reads the value from standard input when it is not given — better for a password.
liberty-crypto is-encrypted [VALUE]Says whether the value starts with ENC:.

The key comes from LIBERTY_MASTER_KEY; --master-key and --config override it.


liberty-license​

CommandEffect
liberty-license statusChecks the key configured in Liberty Next → Administer → App → License: validity, products covered, expiry.
liberty-license verify [KEY]Checks a key given as argument or on standard input, before pasting it.

--config names another app.toml. See Licence key.