XP commands
Contents
The following commands are used when communicating directly with an Enonic XP instance. For these commands to work, the CLI must have access to the management API of your XP instance.
Environment variables
Enonic CLI communicates with XP’s management API which require both endpoint details and credentials to be defined. These parameters may be specified directly via command line, but it is recommended to specify these as environment variables instead.
Use the following environment variables in your terminal to simplify the communication with XP:
Option | Description |
---|---|
|
URL of the running enonic XP instance ( Default is |
|
User name for authentication in enonic XP |
|
User password for authentication in enonic XP |
|
URL of proxy server to use |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
Credentials passed via command line overrides the environment variables. |
Snapshot
List of commands for manipulating repository snapshots can be seen by typing:
$ enonic snapshot Create and restore snapshots USAGE: Enonic CLI snapshot command [command options] [arguments...] COMMANDS: list, ls Returns a list of existing snapshots with name and status. create Stores a snapshot of the current state of the repository. restore Restores a snapshot of a previous state of the repository. delete, del Deletes snapshots, either before a given timestamp or by name. OPTIONS: --help, -h show help
Create
Create a snapshot of all or a single repository while running. The snapshots will be stored in the directory given in snapshots.dir
option in the Repo Configuration (default $xp_home/snapshots). Note that the first snapshot only stores markers in the repository for the current state. Subsequent snapshots stores the changes since the last snapshot. See Backup and Restore for more information on snapshots.
For a clustered installation, the snapshot-location must be on a shared file-system. |
$ enonic snapshot create [-r <value>] [-a <value>] [--cred-file <value>]
Options:
Option | Description |
---|---|
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
the name of the repository to snapshot. |
|
accept default answers to all prompts and run non-interactively |
|
$ enonic snapshot create --cred-file path\to\cred-file.json -r cms-repo
List
List all the snapshots for the installation. For more information on snapshots, see Backup and Restore.
$ enonic snapshot ls
Options:
Option | Description |
---|---|
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
Restore
Restore a named snapshot. See Backup and Restore for more information on snapshots.
$ enonic snapshot restore [--snap <value>] [--repo <value>] [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
snapshot name to restore |
|
the name of the repository to restore |
|
delete indices before restoring |
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
Delete
Deletes a snapshot by name or date:
$ enonic snapshot delete [-before <value>] [--snap <value>] [-a <value>] [-f]
Options:
Option | Description |
---|---|
|
"2 Jan 06" formatted date to delete snapshots up to |
|
snapshot name to delete |
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
Dump
List of command for manipulating all repositories can be seen by typing:
$ enonic dump Dump and load complete repositories USAGE: Enonic CLI dump command [command options] [arguments...] COMMANDS: create Export data from every repository. upgrade, up Upgrade a dump. load Import data from a dump. list, ls List available dumps OPTIONS: --help, -h show help
Create
Export data from every repository. The result will be stored in the $XP_HOME/data/dump
directory.
$ enonic dump create [-d <value>] [--skip-versions <value>] [--max-version-age <value>] [--max-versions <value>] [-a <value>] [--cred-file <value>] [-f]
Options:
Option | Description |
---|---|
|
dump name |
|
don’t dump version-history, only current versions included |
|
max age of versions to include, in days, in addition to current version |
|
max number of versions to dump in addition to current version |
|
outputs dump output to an archive (%name%.zip) file (default is false) |
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
auth
param:
$ enonic dump create --cred-file path\to\cred-file.json -d myDump
Upgrade
Upgrade a data dump from a previous version to the current version. The output of the upgrade will be placed alongside the dump that is being upgraded and will have the name <dump-name>_upgraded_<new-version>
.
The current version XP installation must be running with the upgraded app deployed. |
$ enonic dump upgrade [-d <value>] [-a <value>] [--cred-file <value>] [-f]
Options:
Option | Description |
---|---|
|
dump name |
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
$ enonic dump upgrade --cred-file path\to\cred-file.json -d myDump
List
Lists all the dumps
$ enonic dump ls [-a <value>] [--cred-file <value>] [-f]
Options:
Option | Description |
---|---|
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
Load
Load data from a named system dump into Enonic XP. The dump read has to be stored in the $XP_HOME/data/dump
directory. For more information on system dump/load, see Export and Import.
A load will delete all existing repositories before loading the repositories present in the system-dump |
$ enonic dump load [-d <value>] [--upgrade] [-a <value>] [--cred-file <value>] [-f]
Options:
Option | Description |
---|---|
|
dump name to load |
|
upgrade the dump if necessary (default is false) |
|
loads dump form an archive (%name%.zip) file (default is false) |
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
auth
param:
$ enonic dump load --cred-file path\to\cred-file.json -d newDump -f --upgrade
Export
Extract data from a given repository, branch and content path. The result will be stored in the $XP_HOME/data/export
directory. This is useful to move a part of a site from one installation to another. For more information on content export/import, see Export and Import.
Exporting content will not include the version history of the content, just the current version. |
To list available configuration options, type:
$ enonic export -h Export data from a given repository, branch and content path. USAGE: enonic export [command options] [arguments...] OPTIONS: -t value Target name to save export. --path value Path of data to export. Format: <repo-name>:<branch-name>:<node-path> e.g. 'cms-repo:draft:/' --skip-ids Flag to skip ids in data when exporting. --skip-versions Flag to skip versions in data when exporting. --dry Show the result without making actual changes. --auth value, -a value Authentication token for basic authentication (user:password) --cred-file value The path to the service account key file (in JSON format). This is only available for XP version 7.15 and later. Key file can be generated by Users application for System ID Provider users (aka Service Accounts) . If specified, the flag "--auth" or "-a" will be ignored -f, --force Accept default answers to all prompts and run non-interactively
|
$ enonic export --cred-file path\to\cred-file.json -t myExport --path cms-repo:draft:/content/some-content-name
Import
Import data from a named export into Enonic XP at the desired content path. The export has to be stored in the $XP_HOME/data/export
directory. For more information on content export/import, see Export and Import.
To list available configuration options, type:
$ enonic import -h Import data from a named export. USAGE: enonic import [command options] [arguments...] OPTIONS: -t value A named export to import. --path value Target path for import. Format: <repo-name>:<branch-name>:<node-path> e.g. 'cms-repo:draft:/' --xsl-source value Path to xsl file (relative to <XP_HOME>/data/export) for applying transformations to node.xml before importing. --xsl-param value Parameters to pass to the XSL transformations before importing nodes. Format: <parameter-name>=<parameter-value> e.g. 'applicationId=com.enonic.myapp' --skip-ids Flag to skips ids when importing --skip-permissions Flag to skips permissions when importing --dry Show the result without making actual changes. -a value, --auth value Authentication token for basic authentication (user:password) --cred-file value Absolute path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the `--auth` (or `-a`) flag will be ignored. -f, --force Accept default answers to all prompts and run non-interactively
|
auth
param:
$ enonic import --cred-file path\to\cred-file.json -t myExport --path cms-repo:draft:/some-content
An XSL file and a set of name=value parameters can be optionally passed for applying transformations to each node.xml file, before importing it. This option could for example be used for renaming types or fields. The .xsl file must be located in the |
App
Commands to install applications to the running enonic XP instance. Currently only one command is available here:
$ enonic app Install, stop and start applications USAGE: Enonic CLI app command [command options] [arguments...] COMMANDS: install, i Install an application from URL or file OPTIONS: --help, -h show help
Install
Installs an application on all nodes.
$ enonic app install [--url <value>] [--file <value>] [-a <value>] [--cred-file <value>] [-f]
Options:
Option | Description |
---|---|
|
the URL of the application |
|
path to an application file (mutually exclusive with url, used if both are present) |
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
$ enonic app install --cred-file path\to\cred-file.json --url https://repo.enonic.com/public/com/enonic/app/superhero/2.0.5/superhero-2.0.5.jar
$ enonic app install --cred-file path\to\cred-file.json --file /Users/nerd/Dev/apps/coolapp/build/libs/coolapp-1.0.0-SNAPSHOT.jar
Start
Start application on all nodes.
$ enonic app start <app key> [-a <value>] [--cred-file <value>] [-f]
Options:
Option | Description |
---|---|
|
application key |
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
com.enonic.app.superhero
app:
$ enonic app start com.enonic.app.superhero --cred-file path\to\cred-file.json
Stop
Stop application on all nodes.
$ enonic app stop <app key> [-a <value>] [--cred-file <value>] [-f]
Options:
Option | Description |
---|---|
|
application key |
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
com.enonic.app.superhero
app:
$ enonic app stop com.enonic.app.superhero --cred-file path\to\cred-file.json
Repo
Commands for configuring and managing repositories. Full list is available by typing:
$ enonic repo Tune and manage repositories USAGE: Enonic CLI repo command [command options] [arguments...] COMMANDS: reindex Reindex content in search indices for the given repository and branches. readonly Toggle read-only mode for server or single repository replicas Set the number of replicas in the cluster. list, ls List available repos OPTIONS: --help, -h show help
Reindex
Reindex the content in the search indices for the given repository and branches. This is usually required after upgrades, and may be useful in many other situation.
$ enonic repo reindex [--b <value, value...>] [-r <value>] [-i] [-a <value>] [--cred-file <value>] [-f]
Options:
Option | Description |
---|---|
|
a comma-separated list of branches to be reindexed |
|
the name of the repository to reindex |
|
if true, the indices will be deleted before recreated |
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
$ enonic repo reindex --cred-file path\to\cred-file.json -b draft,master -i -r cms-repo
Readonly
Toggle read-only mode. In read-only mode, no changes can be made on the server, or a single repo if specified
$ enonic repo readonly [readOnly] [-r <value>] [-a <value>] [--cred-file <value>] [-f]
Options:
Option | Description |
---|---|
|
boolean value to set |
|
single repository to toggle read-only mode for |
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
$ enonic repo readonly true --cred-file path\to\cred-file.json -r cms-repo
Replicas
Set the number of replicas in the cluster. For more information on how replicas work and recommended values, see: Replica setup.
$ enonic repo replicas [replicasNum] [-a <value>] [--cred-file <value>] [-f]
Options:
Option | Description |
---|---|
|
whole number between 1 and 99 to set |
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
$ enonic repo replicas 3 --cred-file path\to\cred-file.json
List
List available repositories.
$ enonic repo list [-a <value>] [--cred-file <value>] [-f]
Options:
Option | Description |
---|---|
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
$ enonic repo list --cred-file path\to\cred-file.json
Cms
Content metadata commands. Currently only one command present here:
$ enonic cms CMS commands USAGE: Enonic CLI cms command [command options] [arguments...] COMMANDS: reprocess Reprocesses content in the repository. OPTIONS: --help, -h show help
Reprocess
Reprocesses content in the repository and regenerates metadata for the media attachments. Only content of a media type (super-type = base:media) are processed.
Unless the –skip-children
flag is specified, it processes all descendants of the specified content path.
This command should be used after migrating content from Enonic CMS using the cms2xp tool. |
$ enonic cms reprocess [--path <value>] [--skip-children] [-a <value>] [--cred-file <value>] [-f]
Options:
Option | Description |
---|---|
|
target content path to be reprocessed. Format: |
|
flag to skip processing of content children |
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
$ enonic reprocess --cred-file path\to\cred-file.json -s draft:/some-content
System
System tasks show info about currently running enonic XP instance. Currently there is only one command as can be seen by running:
$ enonic system System commands USAGE: Enonic CLI system command [command options] [arguments...] COMMANDS: info, i XP distribution info OPTIONS: --help, -h show help
Info
Shows info about currently running enonic XP instance.
$ enonic system info { "Version": "7.2.0", "Installation": "demo", "RunMode": "PROD", "Build": { "Hash": "39d4b215fd2009d7ba65e07efc54ebad50638741", "ShortHash": "39d4b21", "Branch": "master", "Timestamp": "2019-12-19T15:18:13Z" } }
Auditlog
List of commands for managing audit log repository can be seen by typing:
$ enonic auditlog Manage audit log repository USAGE: Enonic CLI auditlog command [command options] [arguments...] COMMANDS: cleanup Deletes records from audit log repository. OPTIONS: --help, -h show help
Cleanup
Deletes records from audit log repository.
$ enonic auditlog cleanup
Options:
Option | Description |
---|---|
|
age of records to be removed. |
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
$ enonic auditlog cleanup --age P30D --cred-file path\to\cred-file.json
Vacuum
Permanently removes old versions and deleted items from disk.
To support snapshot restore
and a rich version history, XP does not physically remove the data from disk. The side-effect is that the disk usage will keep growing, even if you delete nodes from the repository. Vacuum command permanently removes old unused versions, as well as deleted nodes from disk. XP defines a default threshold of 21 days (configurable). This basically means that only items deleted at least 21 days ago, or version that are older than 21 days will be vacuumed.
Using the -b option will remove the underlying blobs, meaning restoring a snapshot that is older than 21 days (since last vacuum) will result in an inconsistent and broken dataset. |
To list available configuration options, type:
$ enonic vacuum -h Removes old version history and segments from content storage. USAGE: enonic vacuum [command options] [arguments...] OPTIONS: --blob, -b Also removes unused blobs --threshold, -t Age of data to be removed in ISO-8601 duration format PnDTnHnMn.nS with days considered to be exactly 24 hours --auth value, -a value Authentication token for basic authentication (user:password) --cred-file value Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the `--auth` (or `-a`) flag will be ignored. --force, -f Accept default answers to all prompts and run non-interactively
Options:
Option | Description |
---|---|
|
Triggers |
|
Age of data to be removed in ISO-8601 duration format PnDTnHnMn.nS with days considered to be exactly 24 hours |
|
A token for basic authentication in the following format <user:password>. Starting from XP 7.15, the |
|
Path to a service account key file (in JSON format). This flag will only work with XP 7.15 or later. A key file can be generated in the Users application for System ID Provider users (aka Service Accounts). If specified, the |
|
accept default answers to all prompts and run non-interactively |
|
$ enonic vacuum -b --cred-file path\to\cred-file.json