Volumes Management Overview

AccuWeb.Cloud allows for persistent local storage in containers, guaranteeing data integrity and protecting against data loss during container operations. There are two main ways to configure container volumes:

Using the CLI of the platform natively

  • With Environment topology settings
  • Using Direct CLI methods

1. Setting Volumes Using Environment Topology

To define container volumes when creating or changing the topology of an environment, use the following methods:

  • Volumes: Set a list of local volumes.
  • VolumeMounts: Configure mount points.
  • VolumesFrom: Import existing volumes from another node.

These methods are specified in the docker section. Here’s how you can use them:

Volumes

Allows you to define multiple local volumes within a container. The syntax is as follows:


~/jelastic/environment/control/createenvironment \
--env '{"shortdomain":"{envName}"}' \
--nodes '[{
"nodeGroup": "{nodeGroup}",
"nodeType": "{nodeType}",
"fixedCloudlets": {number of fixedCloudlets},
"flexibleCloudlets": {number of flexibleCloudlets},
"docker": {
"image": "{application node image}",
"volumes": ["/path_to_volume1", "/path_to_volume2"]
}
}]'

Example Command:


~/jelastic/environment/control/createenvironment \
--env '{"shortdomain":"cli-volumes"}' \
--nodes '[{
"nodeGroup": "cp",
"nodeType": "apache",
"fixedCloudlets": 4,
"flexibleCloudlets": 8,
"docker": {
"image": "jelastic/apachephp",
"volumes": ["/my_volume_1", "/my_volume_2"]
}
}]'

Volumes

Parameters:

  • envName: The name of the environment where the container(s) is present.
  • nodeGroup: Identifier of the environment layer.
  • nodeId: ID of the specific container.
  • fixedCloudlets: fixed cloudlets number.
  • flexibleCloudlets: flexible cloudlets number.
  • image: name and tag of Docker image.
  • volumes: Docker node volumes (here name of the folder(s) you want to create).

VolumeMounts

Allows you to configure specific mount points. The syntax is:


~/jelastic/environment/control/changetopology \
--envName "{envName}" \
--env '{"shortdomain":"{envName}"}' \
--nodes '[{
"nodeGroup": "{nodeGroup}",
"nodeType": "{nodeType}",
"fixedCloudlets": {number of fixedCloudlets},
"flexibleCloudlets": {number of flexibleCloudlets},
"docker": {
"image": "{application node image}",
"volumeMounts": {
"{/local_path}": {
"sourcePath": "{/remote_path}",
"sourceNodeId": "{nodeId}"
}
}
}
}]'

Example Command:


~/jelastic/environment/control/changetopology \
--envName cli-volumes \
--env '{"shortdomain":"cli-volumes"}' \
--nodes '[{
"nodeGroup": "cp",
"nodeType": "docker",
"fixedCloudlets": 4,
"flexibleCloudlets": 8,
"docker": {
"image": "jelastic/apachephp",
"volumeMounts": {
"/var/www/webroot": {
"sourcePath": "/var/www/webroot",
"sourceNodeId": "5333"
}
}
}
}]'

VolumeMounts

Parameters:

  • envName: The name of the environment where the container(s) is present.
  • nodeGroup: Identifier of the environment layer. (The list of available stacks are here)
  • nodeType: the defined node type. (The list of available stacks are here)
  • fixedCloudlets: fixed cloudlets number.
  • flexibleCloudlets: flexible cloudlets number.
  • image: name and tag of Docker image.
  • local_path: Path of the local folder you want to mount with another environment.
  • sourcePath: Path from target environment where you want to mount the local folder.
  • sourceNodeId: Node ID of the target environment where you want to mount the local folder.

VolumesFrom

Allows you to mount all existing volumes from one node to another. The syntax is:


~/jelastic/environment/control/changetopology \
--envName "{envName}" \
--env '{"shortdomain":"{envName}"}' \
--nodes '[{
"nodeGroup": "{nodeGroup}",
"nodeType": "{nodeType}",
"fixedCloudlets": {number of fixedCloudlets},
"flexibleCloudlets": {number of flexibleCloudlets},
"docker": {
"image": "{application node image}",
"volumesFrom": [{
"sourceNodeId": "{nodeId}",
"readOnly": false,
"volumes": ["/local_volume"]
}]
}
}]'

Example Command:


~/jelastic/environment/control/changetopology \
--envName cli-volumes \
--env '{"shortdomain":"cli-volumes"}' \
--nodes '[{
"nodeGroup": "cp",
"nodeType": "docker",
"fixedCloudlets": 4,
"flexibleCloudlets": 8,
"docker": {
"image": "jelastic/apachephp",
"volumesFrom": [{
"sourceNodeId": "5333",
"readOnly": false,
"volumes": ["/my_volume_1"]
}]
}
}]'

VolumesFrom

Parameters:

  • envName: The name of the environment where the container(s) is present.
  • nodeGroup: Identifier of the environment layer. (The list of available stacks are here)
  • nodeType: the defined node type. (The list of available stacks are here)
  • fixedCloudlets: fixed cloudlets number.
  • flexibleCloudlets: flexible cloudlets number.
  • image: name and tag of Docker image.
  • sourceNodeId: Node ID of the target environment where you want to mount the local folder.
  • volumes: Docker node volumes (here name of the folder(s) you want to create).

2. Direct Volumes Management

The platform provides several CLI methods specifically for managing volumes without affecting the rest of the environment topology.

AddContainerVolume

Adds a new volume to an existing environment


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

Example Command:


~/jelastic/environment/control/addcontainervolume \
--envName cli-volumes \
--nodeId 6756 \
--path /my_volume

Add Container Volume

RemoveContainerVolume

Removes a volume from an existing environment


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

Example Command:


~/jelastic/environment/control/removecontainervolume \
--envName cli-volumes \
--nodeId 6756 \
--path /my_volume

Remove Container Volume

AddContainerVolumeByGroup

Adds volumes to all nodes in an environment layer:


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

Example Command:


~/jelastic/environment/control/addcontainervolumebygroup \
--envName cli-volumes \
--nodeGroup cp \
--path /my_group_volume

Add Container Volume by Group

RemoveContainerVolumeByGroup

Removes volumes from all nodes in an environment layer:


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

Example Command:


~/jelastic/environment/control/removecontainervolumebygroup \
--envName cli-volumes \
--nodeGroup cp \
--path /my_group_volume

Remove Container Volume by Group

Conclusion

Using these CLI commands, you can effectively handle container volumes on the AccuWeb.Cloud platform and preserve data state and consistency throughout your containerized applications.

If you need to add additional Mount Points alongside volumes, please refer to the linked guide for detailed instructions.