Move an Application from a Cluster to a Server¶
Appliku can move an application from a cluster to a standalone server of the same team. The move copies the datastores of the application that run on a node of the cluster to the new server, starts the application there with one container for each process, and makes the load balancer of the cluster forward the visitors to the new server. The application is down for a short time during the switch.
After the switch the move is in its hold (7 days). The old copy stays stopped on the cluster: the stack of the application and the datastore folders on the node. You can roll back in this time. At the finish Appliku removes the stopped stack and the old datastore folders.
This page tells only what is different from a move between two servers. Read Move to Another Server first: the plan, the confirm, the progress, the hold and the notifications work the same.
Availability
The move from a cluster is available to teams step by step, together with the move to a cluster. When it is not available for your team, the Move tab of a cluster application is not shown, and the API refuses the plan with "Only an application in server mode can move to another server."
Requirements¶
- The application runs on a cluster of the same team, with exactly one ready primary manager and one ready load balancer.
- The application has a deployment that runs on the cluster.
- The new server is a ready standalone server of the team (not a node or a build server of a cluster) with the Docker nginx, and it has the same CPU architecture as the cluster (not for a static site).
- The datastores of the application that run on the cluster are on one node. A datastore on another standalone server stays there; the application on the new server connects to it over the network.
- The application has no volumes.
- A static site can move when its last deployment on the cluster is published on the load balancer, it is not larger than 2 GB, it has no datastore on a node of the cluster, and it has no service on the cluster (if it has one, the plan says "The static site has services on the cluster. Contact support."). When the size of the site cannot be read, make a new plan. The CPU architecture of the new server does not matter for a static site. See Static Sites.
- A cluster takes part in one move at a time.
The Plan¶
Open the application, Settings > Move, select the new server and click Make a plan. The plan shows:
- each datastore: "moves to the new server" (a datastore on a node of the cluster) or "stays on its server" (a datastore on another standalone server: the warning gives the address that the application uses),
- the changes on the new server: a process with replicas runs as one container, placement constraints are not used, the published ports, the cron jobs (they run on the new server), the new web port, and "The stack on the cluster stops at the switch and is removed after the finish.",
- the warnings, for example the copy of the certificates from the load balancer, the copy of your cluster firewall rules of a moved datastore port, and a firewall rule on the server of a datastore that stays,
- the data to copy and the expected downtime.
Traffic and Certificates¶
The move copies each certificate that is valid on the load balancer for at least 7 more days to the new server: the certificate of the default subdomain (an enabled default subdomain needs one) and of each custom domain. After the switch the default subdomain points to the new server; a disabled default subdomain stays disabled. The load balancer forwards the custom domains with a copied certificate to the new server until their DNS records name the new server, at the latest 30 days after the finish: change the DNS records in the hold. A custom domain with no copied certificate is not forwarded; it works after its DNS record names the new server, which then gets its certificate.
Hold, Finish and Rollback¶
The hold works as for a move between servers. Finish now removes the stopped stack on the cluster, the old datastore folders on the node, and the cluster firewall rules of the moved datastore ports (the copied rules on the new server stay).
Roll back stops the application on the new server and starts the stack and the datastores on the cluster again. The moved datastores start with their data of the time of the switch: the data written on the new server since then is lost, and you tick "The data written on the new server since the move is lost." (CLI: --accept-data-loss). The rollback is not possible after a change of an environment variable or a process (not its replicas), or after a deployment that built new images.
Retry and Remove the forwarders are not available for a move from a cluster: Appliku tries a failed step again by itself, and the forwarders on the load balancer end by the normal rule.
Static Sites¶
A static site has no stack on the cluster: the load balancer serves its files. Before the switch, the move copies the published files of the site from the load balancer to the new server and checks that both copies are equal. Nothing stops: the load balancer serves the site until the switch and then forwards the visitors to the new server, as for any application. Do not deploy the site during the move: a deployment between the plan and the copy stops the move ("The static site was deployed again after the plan. Make a new plan.").
The move refuses a site with a file that it cannot copy (a device or a pipe, a name that is not UTF-8) or a link with an absolute path, a link that points outside the site, or a loop of links. In the hold the old copy is "the static site files on the load balancer": Roll back makes the load balancer serve them again, and Finish now removes them.
When a Server Does Not Answer¶
- Before the switch: when the move fails, Appliku removes the copy on the new server and starts the application on the cluster again. When Appliku cannot prove in 10 minutes that the copy on the new server stopped and a datastore stays on another server, you can click Start without the stop proof.
- After the switch: when the new server does not answer, you can Abandon the move. Then Start the old copy starts the stack and the datastores on the cluster again, or Remove the kept copy removes the stopped stack and the datastore folders. The move page lists the kept copies ("the stopped stack on the cluster", "the stopped datastore folders on the node").
CLI¶
The Appliku CLI 0.13.0 has the move from a cluster:
# The servers, each with "ok" or the reason.
appliku apps move targets --team my-team --app 42
# Plan the move of the cluster application to server 151 (ID or name).
appliku apps move plan --team my-team --app 42 --to 151 --wait
# Confirm, follow, finish or roll back, as for a move between servers.
appliku apps move confirm --team my-team --app 42 --name myapp
appliku apps move status --team my-team --app 42 --follow
appliku apps move finish --team my-team --app 42 --move 8
appliku apps move rollback --team my-team --app 42 --move 8 --accept-data-loss
API¶
POST /api/team/<team>/applications/<id>/moves with {"target_server": <server id>} for a cluster application starts a plan from the cluster. The move detail has kind (from_cluster) and source_cluster (the name and the load balancer IP). GET .../move-targets lists the servers with the refusals of this kind of move. The team has app_move_cluster_available.