CLI Commands

The Zegami Command Line Interface (CLI) allows administrators to manage Zegami server, collections and users.

The Zegami CLI can be executed from the command line and the –help (or -h) option can be used on any command to find out more.

Basic Usage

In general the Zegami CLI is used by selecting the resource, then an action for the resource. Before using the client, switch to the zegami user and the zegami base directory.

Starting the Server

Zegami comes built in with a simple web server. To start it run

Creating a Collection

Collections can be created via the CLI. For a step-by-step see our tutorial on creating a collection.

The default arguments for creating a collection are the collection name, path to the data source conf file and path to the image source conf file.

The following optonal arguments can also be used

--dataSource

The data source plugin to use. Out-of-the-box the following data source plugins are available:

  • CSVDataSource (default) – used to process Comma and Tab delimited data files
  • ODBCDataSource – collection based on an SQL query

--imageSource

The image source plugin to use. Out-of-the-box the following image source plugins are available:

  • FilesystemImageSource – use images located in a directory that the server has access to.
  • ODBCImageSource - images stored as blobs in an RDMS.
  • S3ImageSource (beta) - images stored in an Amazon Web Services Simple Storage Service (S3) bucket.

--tileSize

The size of the Deep Zoom tile. The default is 256.

--collectionId

If the optional collection id is specified then it will update the parameters for an existing collection.

The following is an example of using the explicit parameters:

Example of how to update the parameters of an existing collection:

List all Collections

Listing all available collections

 

Process a Collection

Process a collection by id, where `556eb6b05f1c37459b3ac5ff` is the collection id.

Remove a Collection

Remove (delete) a collection by id, where `556eb6b05f1c37459b3ac5ff` is the collection id

Create a User

There are two options for creating a user - using the optional arguments or in interactive mode.

Users created via the CLI are automatically assinged the Administrator role. A users role can be changed using the modify command.

Interactive mode is triggered by calling `users create` without any arguments. You will then be prompted to enter the users details:

 

Alternatively the following arguments can be used:

--username

The username of the new user.

--password

The users password

--first

The first name of the user

--last

The users last name

--email

The email address

List Users

List all users

Modify a Users Role

Modify an existing users Role.

The default arguments for modifying a user is the username followed by the new Role.

Possible Role values are:

  • user – read only access to public collections.
  • manager – can create new collections and edit collections created by the user.
  • admin – can create and manage all collections. Can manage server configuration and users.

The following example will put user1 in the user role.

Delete a User

Deletes a user by username.

The following example will delete user1.

View Server Logs

The following example will display latest 50 server log entries.

View Web Logs

The following example will display latest 50 web log entries.

Search logs

Search for logs by specific level by adding optional argument -l LEVEL or --level LEVEL

Level of logs to look for - could be "DEBUG", "INFO", "WARNING", "CRITICAL", "ERROR".

The following example will search logs with level ERROR.

Use optional argument -timestamp TIMESTAMP, --timestamp TIMESTAMP.

The following example will search logs before the specified timestamp.

```
python bin/zegami.pyc tail logs --timestamp "2017-04-13 13:06:12,345"
```