CLOUD PAAS / DEVELOPMENT TOOLS

CLI Tutorial: Container Volumes

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: Container Volumes 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.

Management functionsContainer (Docker) VolumesThis allows for the creation of persistent local storage by design that does not affect operations during the container life cycle. Creating such storage ensures a high level of integrity and prevents data loss.

Using the CLI you can do this in two ways:

Setting Volumes via Environment Topology

The first method of creating a volume container we will consider.Creating the environmentcorrectly (or whenChange topology) So to set up local container storage, you can useParameterThe following while executing the CLI method:

  • volumes- Set the volume list on your device.
  • volumeMounts- Allows to configure mount points
  • volumesFrom- Import existing volumes from nodes in your account

1. All parameters are declared within the appropriate docker section. For example, the first parameter should be set like this:

... "docker":{... "volumes": ["{local_volume}", "{local_volume}", ...]}

in this place{local_volume}This is the text field for the location of your volume path, which should be placed within the container. You can specify multiple volumes at once by using comma separators.

In the example in the image above, we created an environment with image.jelastic/haproxyand attached 2 sets of volumes in the machine, namely:/my_volume_1and/my_volume_2

2. Specify parametersvolumeMountsWith the following command:

... "docker":{... "volumeMounts" : {"{local_path}" : {"sourcePath" : "{remote_path}", "sourceNodeId" : "{node_ID}", "readOnly" : {true/false}}, ...}}

where:

  • {local_path}- path to a folder within the specified environment node. Content to be mounted should be placed here.
  • {remote_path}- The desired directory location in the remote container (i.e. the address of the source data).
  • {node_ID}- The unique node identifier for your data to mount.

Note:You can use parameters“sourceNodeId”Can be substituted:
“sourceNodeGroup”- Define the environment layer which the master node will use as the resource for the mount operation.
“sourceHost”- External IP or custom domain name of the storage server. (including external name)

  • {true/false}- appropriate values for setting permissionsread onlyorread & writefor client nodes while performing data installation (false by default)
  • {local_volume}- List of volumes to mount (if not specified all will be copied)

Take for example the command in the picture above. We install data from the node.111109of the account used

3. Last parametervolumesFromYou can use this command to mount all existing volumes from one node to another (i.e. copy them). For example:

... "docker":{... "volumesFrom":[{"sourceNodeId" : "{node_ID}", "readOnly" : {true/false}, "volumes" : ["{local_volume}", "{local_volume}", ...]}]}

where:

  • {node_ID}- The unique node identifier for your data to mount.

Note:Alternatively, you can use “sourceNodeGroup” to define the environment layer which will use the parent node as the resource for the mount operation.

  • {true/false}- appropriate values for setting permissionsread onlyorread & writefor client nodes while performing data installation (false by default)
  • {local_volume}- List of volumes to mount (if not specified all will be copied)

The command in the image above we have added a new layer Docker images.jelastic/tomcat8and mount volumes to nodesjelastic/haproxyexisting

Managing Volumes Directly

We have provided a specially developed CLI method for managing volumes that does not affect the environment topology:

1. The first command isAddContainerVolumeAllows you to add new volumes within an existing environment.

~/jelastic/environment/control/addcontainervolume --envName {env_name} --nodeId {node_ID} --path {path}

where:

  • {env_name}- The domain name for the environment you want to edit.
  • {node_ID}-IDs that identify the selected environment-specific nodes should be added to the container volume.
  • {path}- The path in your local file system to the volume directory.

2. The deletion process is similar to the add process described above, using the same parameters:

~/jelastic/environment/control/removecontainervolume --envName {env_name} --nodeId {node_ID} --path {path}

3. In case you want to increase the volume of more than one node, you should use theAddContainerVolumeByGroupIt is more appropriate to add environment layers all at once.

~/jelastic/environment/control/addcontainervolumebygroup --envName  {env_name} --nodeGroup  {node_group} --path  {path}

Here the parameters{node_group}Allows to define layers in the current environment (such as cp, bl, storage, etc.) where all nodes should modify the new volume.

4. You can perform deletion of volumes for all layers with a single command:

~/jelastic/environment/control/removecontainervolumebygroup --envName  {env_name} --nodeGroup  {node_group} --path  {path}

When you use this method You can easily control your container volume and manage it in minutes. In case you want to addMount PointsAlong with the volume, you can click on the link for additional instructions.