Both Community Edition and Enterprise Edition comes with the command
countly where you can perform specific actions, including backup and restore.
When Countly is installed, the command
countly is also installed on your Linux server. Basic usage is as follows (as root):
# countly command optional-parameters
These are the basic commands you can do with countly command:
- countly start: Starts Countly process
- countly stop: Stops Countly process
- countly restart: Restarts Countly
- countly status: Outputs process status, output depends on init system type
- countly upgrade: Starts upgrade process
- countly usage: Prints out usage information
- countly version: Gives Countly version
- countly test: Runs countly test set
- countly dir: Outputs absolute path to directory where Countly is installed
Above, most of the commands are self-explanatory. Below you can find detailed explanations of commands.
Countly can be upgraded via command line easily. These are the basic steps for upgrading:
- First, you should extract new Countly package on top of your existing installation (hint: use
countly dircommand to know where Countly is installed)
countly upgrade command does the following:
- It runs npm to install any new dependencies, in your case there won't be any new dependencies.
- It executes
grunt dist-allto minify all files and make production files from them for more effective loading.
- It restarts Countly's Nodejs process to take into account new files changes.
countly upgrade, go to your dashboard and start working with your new, shiny Countly platform.
To make automatic backups to your server, you can run
countly backup on the command line, or provide a cron job that runs every day or week. This cron job ideally backs up Countly data to a directory of your choice.
The following command backs up database, Countly configuration & user files (e.g app images, user images, certificates, etc).
countly backup /var/backups/countly
countly backupdb /var/backups/countly
countly backupfiles /var/backups/countly
Additionally you can back up files or database separately by calling
countly backupdb or
Note: Countly backup command simply copies files and exports database. You would need to ensure back up rotation and archiving yourself, depending on your needs.
You can restore Countly from backup by running restore command and pointing it to the same path you provided for backup. Similarly you can restore only files by calling
countly restorefiles and only db by calling
countly restore /var/backups/countly
countly restoredb /var/backups/countly
countly restorefiles /var/backups/countly
Note if you want to restore Countly on clean server, you need to install Countly itself and then run restore command.
countly update command has the ability to update some components of Countly server. Currently this command supports following parameters:
- countly update translations: Retrieves latest translated localization files from Countly's transifex project
- countly update devices: Retrieves latest list of device ids to prettier device names
- countly update geoip: Retrieves latest geoip-lite IP to city mapping files (can consume lots of RAM during upgrade)
- countly update sdk-web: Retrieves latest version of web SDK to be hosted with your Countly installation in yourdomain.com/sdk/web/countly.min.js
countly update sdk-web
countly plugin command can enable or disable plugin, as well as check current status and version of the plugin.
This command supports following parameters:
- countly plugin list: List all available plugins
- countly plugin list states: List all available plugins with their states
- countly plugin enable <pluginname>: Enables plugin if plugin was not yet enabled
- countly plugin upgrade <pluginname>: Run plugin installation script only (even if plugin is already enabled)
- countly plugin disable <pluginname>: Disables plugin if plugin was enabled
- countly plugin status <pluginname>: Outputs status of the plugin: enabled or disabled
- countly plugin version <plugnname>: Outputs version of the plugin
Note: after enabling or disabling one or multiple plugins, you need to complete the process by running countly upgrade to prepare needed production files and restart countly process
countly plugin enable crashes # In order for changes to take affect countly upgrade
countly config command allows you to manage Countly configurations from command line, like checking value of specific configs or changing their values.
This command supports following parameters:
- countly config list: List all configuration options
- countly config list values: List all configuration options and their current values
- countly config <config.name>: Show specific configuration value
- countly config <config.name> <value>: Change specific configuration value
- countly config <config.name> null: Removes specific configuration
countly config frontend.production false
There is a simple
countly api command to make a HTTP request to the same Countly server with provided path and parameters. Additionally you can use
countly api pretty to format json response from the api request.
For more information about possible api requests, you can read REST API reference section.