Contents
Shifting workloads between different environments – e.g. blue-green deployment – can be a painful process if you lack the right tools for the job. Thankfully Enscale makes it easy for you to migrate a public IP, completely eliminating any DNS propagation effects and reducing downtime for this process to just a few seconds.
This feature is intended to be used by advanced users, such as within a CI/CD workflow. Therefore it is currently only available via the CLI tool or API commands:
Skills required: Java-jitsu
Enscale provides a CLI tool to simplify interacting with your account and environments.
The tool is relatively easy to use and you can install it on your local machine.
Before installing the CLI tool, you need to ensure a few things are present on your system.
If you haven’t already, install Java 1.7 or higher on your local machine. Please refer to Java installation guides for instructions on how to get Java.
If you are a Windows user, you also need Cygwin to provide you with a Unix-like environment. Mac and Linux users should skip this step.
To install CLI tool run the following on your command line / terminal:
curl -s ftp://ftp.jelastic.com/pub/cli/jelastic-cli-installer.sh | bash
The tool will be installed in your home directory with all commands placed in a dedicated enscale directory.
On your first run you will be asked to provide your account details as well as Platform URL: app.enscale.cloud .
More detailed information on the CLI tool is available in the PaaS documentation.
Once the CLI tool is installed, you can use it to swap the public IPs used by any nodes within or between any environments on your account.
The swap itself is fast and should only cause a few seconds interruption to traffic, but a service restart is triggered for the following nodes:
The command takes three parameters:
And optional parameters in case the environment has more than 1 IP attached:
If the target node already has a public IP, it will be moved to the source node at the same time. I.e. the public IPs of the source and target nodes will be swapped.
Private / internal IP addresses are statically assigned to a node and cannot be swapped.
NOTE: You can find node IDs in your dashboard; example marked below:
Once you have the details of the nodes you want to move public IP(s) between, you can do the swap using the command below:
~/jelastic/environment/control/swapextips --envName {env_name} \
--sourceNodeId {source_node_id} \
--targetNodeId {target_node_id} \
--sourceIp sourceIp \
--targetIp targetIp
You may verify the IP swap was successful by reviewing the response output, or checking the public IP assignments for each node as shown within the Enscale dashboard.
Skills required: Inception
If you would rather not install Java on your local machine but still wish to use the Jelastic CLI tool, you can make use of Docker. Our engineers at Layershift have prepared a lightweight docker image that has java and the CLI tool pre-installed. All you have to do is to pass some variables to the image and you can use the CLI tool straight away.
To run the container, specify the following variables:
Run the image:
docker run -it --rm \
-e "J_LOGIN=you@domain.com" \
-e "J_PASSWORD=password" \
-e "J_PLATFORM=hoster.url" layershift/jelastic-cli
You will enter bash shell where you will be able to use the CLI commands.
NOTE: This Docker image is intended to be run locally (not deployed onto Enscale).
Skills: God mode
If you are brave enough not to install Java or don’t have a way or feel the need to install Docker, you may still swap IPs using a curl command, or in fact a few API commands issued from any programming language of your choice.
NOTE: Windows users may need to install curl executable. It can be obtained from here. In the ‘Select operating system’ box, choose Win32 or Win64, depending on your architecture.
The swap IP API call is described in PaaS API documentation.
Remember to change [hoster-api-host] to app.enscale.cloud.
The method takes the following parameters:
And optional parameters in case the environment has more than 1 IP attached: