CLI reference
Every cardinal command, its options and its aliases.
Run commands inside a workspace. Commands that act on a site take -t HOST. cardinal help, or cardinal with no arguments, prints the list.
bin/cardinal runs mix cardinal ARGS in the workspace when it has a mix.exs, and in the checkout's platform/ otherwise. It asks terminal questions itself and passes passwords on in environment variables, never on the command line.
Workspaces and sites
| Command | What it does |
|---|---|
init [PATH] [--pkg bun|pnpm|npm] [--db docker|external] [--db-host H --db-port P --db-user U] | Create a workspace. On a terminal it asks for anything left out. The external database password comes from CARDINAL_DB_PASSWORD or a hidden prompt |
new-site HOST [--install-app APP]... [--admin-email E [--admin-name N] [--admin-password-file F]] | Create a site with core, then each --install-app in requirement order. Alias tenant create |
list-sites | List the workspace's sites, marking unclaimed ones. Alias tenant list |
drop-site HOST [--force] | Drop a site's schema, its reopened copies and its platform row. Asks first on a terminal. Alias tenant drop |
start [--verbose] | Start Postgres, S3 and the web server. --verbose logs at debug level and starts Perch beside it when the workspace has it |
nodes | List the nodes that reported in the last day. Exits 1 if one is stale |
migrate -t HOST|all | Run pending migrations and sync each installed app |
setup complete -t HOST --email E --full-name N --country C --time-zone Z --currency CUR [--language L] [--password-file F] | Claim an unclaimed site for E and finish its setup without the browser |
setup reopen -t HOST [--admin-email E [--admin-password-file F]] | Take back a site the wrong visitor claimed. The old schema stays under a new name |
add-to-hosts HOST | Add HOST to /etc/hosts (asks for sudo) |
update [--pull] [--build] [--migrate] | Fast-forward each app in apps/, repin it, build, and migrate every site. With flags, only those steps |
self-update [--branch B] | Update this checkout to the latest commit of branch B (production when left out) and compile it |
build [--target release] | Build the desk when its sources changed, each app's desk plugins, and write build/build.json. --target release also runs MIX_ENV=prod mix release into _build/prod/rel/cardinal |
help | Print the command list |
Admin passwords
new-site --admin-email, setup complete and setup reopen --admin-email read the password from, in order:
--admin-password-file F(or--password-file Fforsetup complete)- the
CARDINAL_ADMIN_PASSWORDvariable - a hidden prompt
--admin-password P also works, but leaves P in your shell history. bin/cardinal moves it into CARDINAL_ADMIN_PASSWORD before calling mix.
Apps
| Command | What it does |
|---|---|
app new NAME [--with-frontend] [--requires APP]... | Write a new app into apps/NAME, run git init there and add it to cardinal.workspace.exs. - and spaces in NAME become _ |
app build [APP]... | Build the desk plugins and own frontend of APP, or of every workspace app |
app get SOURCE [--ref REF] [--resolve-deps] [--link PATH] [--trust] [--overwrite] [--skip-build] | Fetch an app into apps/ and pin its git URL, tag and commit. org/repo@tag is GitHub shorthand |
app remove APP [--no-backup] [--force] | Remove an app from the workspace and archive its source. Refused while a site has it installed, unless --force |
app install -t HOST APP... | Install APP and any missing requirements on the site. Alias install-app |
app uninstall -t HOST APP | Uninstall APP from the site. Its tables are renamed, not dropped |
app list | List the apps in this build with versions, in hook order |
app check | Check every app's requires: present, in mix.exs, in version range, no cycle. Also lists fixture rows that widen another app's role |
test --app APP | Run APP's tests against the workspace database name plus _test. Each test module installs a throwaway tenant |
meta check | Check every app's RecType, permission and website files |
APP:COMMAND [ARGS] | Run a command an app lists under cli: in app.exs, such as cardinal gate:hello |
app get trusts sources under github.com/revaik-org/ only. Pass --trust for any other source.
Users and permissions
| Command | What it does |
|---|---|
user add -t HOST EMAIL [--first-name N] [--last-name L] [--role R]... [--system-manager] [--password-file F] [--invite] | Add a user. --invite (alias --send-welcome-email) mails a link to set a password |
user set-password -t HOST USER [--logout-all] [--password-file F] | Set a user's password. On a terminal it asks without echo. --logout-all ends their sessions |
user unlock -t HOST LOGIN | Clear a failed-login lockout |
user disable|enable -t HOST USER | Disable a user, ending their sessions, or enable them |
sessions revoke -t HOST --user U|--all | End U's sessions, or everyone's, and close their realtime sockets |
perm explain -t HOST --user U --rectype R [--name N] --ptype P | Say whether U may use right P on R, or on Record N, with each step of the decision |
perm reset -t HOST [--rectype R] | Restore the original rules of app RecType R, or of every app RecType, by deleting its Custom RecPerm rows |
Jobs and scheduler
| Command | What it does |
|---|---|
jobs list -t HOST [--state S] | List the site's 100 newest jobs, or those in state S |
jobs retry -t HOST ID | Run job ID again |
jobs cancel -t HOST ID | Cancel job ID, stopping it if it runs |
jobs trigger -t HOST JOB_TYPE | Queue one run of a Scheduled Job Type now |
scheduler status -t HOST | Say whether the scheduler runs jobs, and why not |
scheduler enable|disable -t HOST | Turn the site's scheduler on or off in System Settings |
scheduler pause -t HOST [--ttl T] | Run no scheduled job for T: a number and s, m, h or d (30m when left out) |
scheduler resume -t HOST | End a pause |
Job states are available, scheduled, executing, retryable, completed, cancelled and discarded.
Mail, search, schema and translations
| Command | What it does |
|---|---|
email test -t HOST ADDRESS | Send a test mail through the site's default outgoing Email Account |
search reindex -t HOST [--rectype R] | Queue a rebuild of the global search rows of R, or of every searchable RecType |
schema orphans -t HOST | List columns that a RecType no longer has. Migrations never drop them |
i18n extract --app APP | Write APP's locale/main.pot from its RecTypes, workspaces, templates and code |
i18n new LOCALE --app APP [--pseudo] | Write APP's locale/LOCALE.po. --pseudo wraps every message as ⟦…⟧, for tests |
i18n update --app APP [--locale L] | Refresh APP's PO files from its pot, keeping existing translations |
Perch
| Command | What it does |
|---|---|
perch get [--ref REF] | Fetch Perch, the workspace watcher, into tools/perch and pin it under perch: in cardinal.workspace.exs |
perch | Run Perch against the running workspace, on PERCH_PORT (4100 when unset) |
Example
cardinal init acme --pkg bun --db docker
cd acme
cardinal app get git@github.com:revaik-org/erp-cardinal.git
cardinal new-site erp.localhost --install-app erp --admin-email admin@acme.test
cardinal user add -t erp.localhost jane@acme.test --system-manager --invite
cardinal startThe pins land in cardinal.workspace.exs:
[
apps: [
erp: [
git: "git@github.com:revaik-org/erp-cardinal.git",
commit: "6a96e90f8e6e79780d810e3803859fc927d9ed97"
]
],
name: "acme",
pkg: "bun",
db: "docker",
...
]