CLOUD PAAS / DEVELOPMENT TOOLS

CLI Tutorial: Environment Creation

This guide has been reviewed and reformatted for Ruk-Com Cloud PaaS. Screens may vary slightly by platform version.

Click or tap a screenshot to view it at its original size.

Objective

This guide explains how to use CLI Tutorial: Environment Creation on Ruk-Com Cloud PaaS, with ordered procedures and practical verification points.

Before you begin

  • Sign in with an account permitted to manage the relevant environment.
  • Confirm the target environment, region and resources before saving changes.
  • Create a backup or rollback plan before changing a production system.

Creating environments via the command line is useful for a variety of solutions (such as managing complex DevOps situations), so let's look at how this can be accomplished via:

1. As a first step we will consider the different forms of this operation that can be used.

  • A simple way to create a new environment with the CLI is to manually declare the required parameters via the appropriate command. Just follow the instructions.createenvironment following by specifying your custom parameters:
~/jelastic/environment/control/createenvironment --env '{"shortdomain" : " {env_name}", "engine" : " {engine_type}"}' --nodes '[{"nodeType" : " {node_type}", "fixedCloudlets" :  {cloudlets_amount}, "flexibleCloudlets" :  {cloudlets_amount}}]'

In the example above, replace with the following:

  • {env_name}- Name for the new environment.
  • {engine_type}- The type of language to be used in this environment.
  • {node_type}- Stack type specified according toItem
  • {cloudlets_amount}- Defined and flexible number of cloudlets to be allocated for a particular node.

Tips:See more detailed information about the parameters contained in the description.API methodand overviewCreateEnvironment API

Note that in the image above the CLI responds with"result": 0This means that the operation was successful and there were no errors. (This applies to all commands you run)

  • The second option supported by Jelastic CLI is to use a JSON file with all environment parameters specified within. Creating files only once You can use it multiple times, which is faster and more convenient than setting everything manually each time.

The example creates a simple JSON file with the following environment topology:

{
  "env": {
    "shortdomain": "{env_name}",
    "engine": "{engine_type}"
  },
  "nodes": [
    {
      "nodeType": "{node_type}",
      "fixedCloudlets": "{cloudlets_amount}",
      "flexibleCloudlets": "{cloudlets_amount}"
    }
  ]
}

Do not forget to change the parameters in the same way as described earlier.
Now you need to create the environment using thecreateenvironmentWith the –myparams parameter including the.json file path as the value (or just the name if the file is in the home folder):

~/jelastic/environment/control/createenvironment --myparams {path_to_file}

Additionally, you can redefine or add some settings (e.g.short domain regionandDisplay name) in the env section of the configuration file by specifying it in square brackets within the parameters of this method, for example a short domain string. (In the image below) You can override settings with the same name from JSON, so the environment is created with the same topology but with a different name.

2. CreationDocker-based environmentIt is similar to the method described above but has a few specific parameters. So, to use a docker container through Jelastic CLI, you need to execute the following lines:

~/jelastic/environment/control/createenvironment --env '{"shortdomain" : "{env_name}"}' --nodes '[{"nodeType" : "docker", "fixedCloudlets" : {cloudlets_amount}, "flexibleCloudlets" : {cloudlets_amount}, "docker" : {"image" : "{image_name}"}}]'

Command above parametersnodeTypeindockershould replace{image_name}with the address of the Docker template you want to deploy (in the formserver.com/images/image_name:tag)

As follows:

  • If the template is within Registry Hub, the registry hostname can be omitted.
  • You can add the version tag after the separator.“:”at the end of the address image
  • Authentication for privateregistryAdditional registry parameters should be declared by specifying the URL and appropriate credentials (such as password and user) as values.

Note:A complete list of special Docker parameters can be found atDocument