CLI Tutorial: Environment Migration
Sometimes, it is necessary to shift your application to a different environment that offers improved conditions or is in a better location. Alternatively, you may need to replicate your environment across various hardware setups to enhance availability. To do this remotely, you must run a specific migration command line method using your terminal. Let’s delve into this further.
1. First off, you’ll need to grab the list of regions offered on the platform. To do this, use the “getregions” command, but make sure to apply the right search filter. By doing this, the output will be reduced and it will be easier to understand.
~/jelastic/environment/control/getregions | sed -rne '/(uniqueName|isEnabled|displayName)/{/Name/,/isEnabled/p}'
On your dashboard, you’ll find a list of environmental regions linked to your account, each marked as ‘isEnabled’ (meaning it’s active). They’re identified by their display names and unique identifiers. Remember, the crucial detail here is the unique identifier.
To clarify further, the distinct ‘uniqueName‘ values are highlighted within the image provided.
2. Before initiating the operation, it’s wise to assess whether migration is feasible. Utilize the CheckMigrationPossibility CLI method tailored for this purpose.
~/jelastic/environment/control/checkmigrationpossibility --envName {env_name} --hardwareNodeGroup {region_id}
Here are the details you need:
- {env_name}: This is the name of the environment you want to move.
- {region_id}: This is a special code that identifies the specific region where you want to relocate your environment, as determined in the previous step.
3. You’ve got everything you need to start moving things over:
~/jelastic/environment/control/migrate --envName {env_name} --hardwareNodeGroup {region_id} --isOnline {true/false}
The only thing that’s different now is the addition of the “isOnline” parameter. You can choose to set it as either “true” or “false” to decide whether you want to use the live migration mode or the offline one.
Before long (though the timing could shift depending on your setup), the process will wrap up, and your application will smoothly transition to its new location.