Jelastic CLI Overview

Note: This document is based on Jelastic version 4.6

The Jelastic command-line interface (CLI) is a tool, designed to simplify interaction with your Cloud Platform account through executing the appropriate commands directly from your local machine. It allows to handle the vast majority of available operations remotely, complementing the wide stack of capabilities, provided via dashboard and Jelastic API.

Jelastic CLI logo

The main benefit here is the advanced and comparatively simple automation facilities, that CLI provides to developers. Plain text line-commands can be easily grouped into scripts and, in such a way, mold a powerful mechanisms for accomplishing various objectives: from the most common and frequent tasks’ automation to monitoring of apps and managing complexive DevOps processes.

So, let’s start with the Jelastic CLI installation and reveal some key points of its usage before proceeding further.

Subsequently, you can dive deeper with the Jelastic CLI tutorials on particular operations.

    CLI Installation

    In order to install the Jelastic CLI at your local machine, you need to run just a single line of code via your terminal:

    curl -s ftp://ftp.jelastic.com/pub/cli/jelastic-cli-installer.sh | bash

    Note:

    • please ensure you have Java of the 1.7 version or higher installed beforehand
    • in case you are using Windows OS, you need to get the Unix-like environment installed first (e.g. Cygwin) and run all the appropriate commands within it

    Consequently, the Jelastic CLI will be installed to the dedicated jelastic folder at your home directory. The structure of the folders and bash scripts inside represents the hierarchy of Jelastic API, which results in a complete similarity of the corresponding working processes, so you can easily get used to our CLI.

    Getting Started

    The base of the Jelastic CLI is represented with an executable .jar archive and a number of preconfigured commands (bash scripts) for its operating. With their help you are able to monitor, control and automate your environment’s lifecycle.

    1. To get started, the authentication should be passed. It will be called automatically on the first CLI command use, e.g.:

    Jelastic CLI authentication

    Just follow the appearing questionnaire, specifying the asked values:

    • Platform URL - Jelastic installation URL in the app.{hoster_domain} format
    • Email - email (login), binded to your account
    • Password - your account password

    If the entered data is correct, you’ll see the Jelastic logo and version of the currently used platform.

    Tip: The authentication can be also initiated manually (e.g. in case you need to switch current session and login as another user or at different Jelastic installation) with the corresponding command:

    ~/jelastic/users/authentication/signin --login {email} --password {password} --platformUrl {platform_url}

    Here, the highlighted strings should be substituted with the corresponding account parameters (described above).

    Jelastic CLI manual authentication

    The “result”: 0 property within the received response (circled in the image above) means that the operation has passed successfully and without errors. Herewith, this is applicable for all of the commands you run.

    The information on actual user session (i.e. platform address and your credentials) is stored within the automatically generated ~/.config/jelastic/jelastic.properties file for being automatically fetched when necessary, allowing you to concentrate on performed operations with no repetitive authentication steps required.

    2. In case you are new to our API and need details on its command-line interface structure, you can access the embedded help file:

    ~/jelastic/help

    Jelastic CLI help

    Here you can see the hierarchical list of the available command types (methods), where each method has the dedicated same-named folder with a number of scripts (i.e. available functions) inside.

    3. In order to get the list of all possible operations for a particular method, you can use a simple listing command for the appropriate directory, for example:

    ls ~/jelastic/environment/control

    Jelastic CLI environment control list

    Each of the presented functions can be easily called using the full path to it.

    4. For more information on a particular operation, run it without any parameters specified to see the complete list of missed requirements.

    Jelastic CLI command help

    You can also check our API documentation for getting the additional information.

    5. By default, any command execution is supplied with “loading” cursor display, in order to indicate the called action is in process.

    However, in case you need to save the got response into a file (e.g. to use it for some automation tasks further), this element may be redundant and corrupt JSON formatting. In order to avoid this, append the following argument to the called command before execution:

    --silent true

    In such a way, the received output can be immediately used by your automation scripts without any additional edits required.

    Tip: The installed CLI will regularly check for updates, so when a new version becomes available, you’ll be shown the corresponding notification with an instruction on the actions required.

    Now, as you have some basic knowledge on Jelastic CLI, you can start exploring it by yourself.

    CLI Tutorials

    Ensuring the full-functional remote management, Jelastic CLI works with all types of environments and deployed applications. It supports all of the appropriate actions, from the simplest to the complex ones. To reveal its capabilities with real showcases, below we present some of the most common examples of its usage:

    Subsequently, when you caught the idea on how to work with Jelastic CLI and the possibilities it provides, you can proceed to automation of your environments’ management through building the frequently used operations’ chains by means of writing and applying the corresponding scripts.

    The full information on all of the available commands and methods can be found within the Jelastic API documentation.