Skip to content

Move an Application from a Server to a Cluster

Appliku can move an application from a standalone server to a cluster of the same team. The move builds the application on the cluster, starts it there with the replicas that you select, and switches the traffic to the load balancer of the cluster. The application is down for a short time during the switch.

The application moves. Each datastore stays on the old server, or moves into the cluster when you select it. A datastore that stays is used over the network; then the old server stays the database server of the application: do not delete it. A datastore that moves goes to a database node of the cluster (see Datastores into the cluster). A datastore of the application on a third server stops the move.

After the switch the move is in its hold (7 days). The old copy stays stopped on the old server, and you can roll back. See Hold, finish and rollback.

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, the forwarders and the notifications work the same.

Availability

The move to a cluster is available to teams step by step. When it is not available for your team, the target list shows no clusters, and the API refuses a plan to a cluster with "Moving an application to or from a cluster is not available for this team." A move that is already in its switch or later continues, and you can still open it, finish it or roll it back. A move that is not in its switch yet waits before the switch (the application continues to run on the old server) until the move to a cluster is available again; you can cancel it.

Requirements

  • The application is in server mode on a standalone server, and it can move by the rules of Move to Another Server.
  • The cluster is a cluster of the same team, with exactly one ready primary manager and one ready load balancer. The nodes that can run the application are ready.
  • The build server of the cluster is ready.
  • The cluster has a login for the registry of the application image (Container Registry). A cluster with no registry is possible only when the primary manager is the build server and no other node can run the application (for example a cluster with no worker nodes).
  • All nodes and the build server of the cluster have the same CPU architecture as the old server. The primary manager, the load balancer and the nodes that can run the application have Docker Engine 20.10 or later.
  • The application has no Appliku volumes (the Volumes tab). A cluster does not support them. The volumes of a process are allowed; the plan shows a warning (see Warnings).
  • The old server needs the managed firewall when the move must add a firewall rule for a datastore port: when the port is not open yet, or when it is open and has your firewall rules.

A cluster can be the target of only one move at a time.

Refusals

The plan refuses the move for example when one of these is true. The text tells you what to do. The refusals of a move between servers about the old server (for example a running deployment) also apply.

Cause Text
The application has Appliku volumes "The application has Appliku volumes, which a cluster does not support. Delete them on the Volumes tab of the application first." The dashboard shows a link to the Volumes tab.
The application has enabled cron jobs, and cron jobs cannot run in this cluster now (also: a static site) "The application has enabled cron jobs, and cron jobs cannot run in this cluster now. Disable them, or try again later."
The move must add a firewall rule for a datastore port, and the old server has no managed firewall "The old server has no managed firewall. Turn on the Appliku firewall of the server first."
Appliku cannot check a datastore type from the cluster "Appliku cannot check datastore <name> from the cluster."
A plain environment variable has the private address of a datastore "Variable <name> uses the private address of datastore <name>. Use a FROM_DATABASE variable."
A plain environment variable has the IP address of the old server and the external port of a datastore "Variable <name> uses the address of the old server for datastore <name>. Use a FROM_DATABASE variable."
A datastore of the application is on a third server "Datastores on another server cannot move yet: <names>."
A process runs on every node (global mode) "Process <name> runs on every node. The move cannot plan it."
The old server uses the host nginx "The old server uses the host nginx. Move it to the Docker nginx first."
The application has no deployment that runs (or its newest running deployment has no full commit hash) "The application has no deployment that runs. Deploy it first."
A folder of the application is on the build server (or, for a static site, the load balancer) of the cluster "Folder /home/app/<name> exists on the <build server or load balancer> of the cluster. Remove it, then try again."
The application uses a docker-compose.override.yml on the cluster "The application uses a docker-compose.override.yml file. Turn this setting off, then try again."
The cluster has no ready primary manager or load balancer "The cluster has no ready primary manager or load balancer."
A node is not ready "Node <name> of the cluster is not ready."
The build server of the cluster is not ready "The build server of the cluster is not ready."
The cluster has no registry and other nodes can run the application "The cluster has no registry and has worker nodes."
The cluster has no login for the registry of the application image "The cluster has no login for registry <host>, the registry of the application image. Add it to the cluster, then try again."
Docker on a node is older than 20.10 "Docker on node <name> is too old for the move."
The nodes have different CPU architectures "The cluster has nodes with different CPU architectures."
Another CPU architecture "The cluster has another CPU architecture than the old server. This needs a later Appliku version."
A kept copy of an earlier move of this application is on the cluster "A kept copy of this application is on the cluster. Remove the kept copy first."

The target list shows the first checks of each cluster (for example "The cluster has no ready primary manager or load balancer."). The plan makes all the other checks.

Move an Application to a Cluster

  1. Open the application and go to Settings > Move to another server. When the move to a cluster is available for your team, the heading of the tab is Move to another server or a cluster.
  2. In New server or cluster, select the cluster in the Clusters group. A cluster that cannot be used is shown with the reason.
  3. Click Make a plan.

Select the cluster

Appliku reads the old server and the cluster. The plan changes nothing. The move page then shows the plan:

  • From and To: the old server and the cluster, and the new address: the IP address of the load balancer of the cluster.
  • Fix these and make a new plan: the refusals.
  • Warnings: see Warnings.
  • Database access: one row for each datastore that stays on the old server: its port, whether the move turns its external connections on, and whether the move adds a firewall rule for the cluster nodes. See Database access.
  • What changes in the cluster: the replicas of each process. See Replicas.
  • Estimate: the downtime.

The plan of a move to a cluster

Then click Confirm the move, type the name of the application, and click Move now, as for a move between servers.

Replicas

Replicas are for applications that run containers; a static site has none. On the old server, each process ran one container. On the cluster, each process that runs gets 1 replica; a process with 0 stays 0. To change the replicas before the move, type the new numbers (0 to 100) in What changes in the cluster and click Make a new plan with these replicas. Appliku then makes a new plan; you confirm the new plan. While the numbers in the form differ from the plan, you cannot confirm.

You can also change the replicas after the move, as for every cluster application. A change of the replicas in the hold does not stop the rollback; the rollback sets the replicas back to the values from before the move.

Datastores into the Cluster

In the plan, the section Datastores lists each datastore of the application with its place after the move: Stays on <server> (the default) or Moves into the cluster. For a PostgreSQL or MySQL datastore that moves you also select the method: Copy of the data folder (the default) or Dump and restore (see Move to Another Server). A change makes a new plan (Make a new plan with these datastores); you confirm the new plan.

  • All datastores that move go to one database node of the cluster: a node with the database label (see Clusters), ready, with the most free memory. A cluster with no such node refuses the plan: "The cluster has no database node."
  • The data is copied while the application runs; at the switch the datastore stops, the last changes are copied, and the datastore starts on the node. The downtime estimate of the plan includes this. A longer measured downtime asks for a second confirm, as for a move between servers.
  • After the move the datastore runs in the cluster: the application uses its private address in the cluster network. The external address (when external connections are on) is the IP address of the node, with the same port. Your firewall rules for that port on the old server are copied as rules of the cluster.
  • The user app can have another uid on the node than on the old server (for example a server of another provider). The configuration files of the datastore get the owner of the node; the database files keep their owners. A file that the move cannot map safely stops the plan (app_uid_ambiguous).
  • Backups of the moved datastore: a backup that uses the private URL and ran on the old server runs from the node after the move; a backup with the external URL keeps its server and gets the node address; a backup with a custom URL keeps its URL and its server, and a backup with its own private URL keeps that URL (its server can move to the node): check them after the move. The local backup files of the datastore stay on the old server; the finish lists them.
  • A datastore that moves needs no firewall rule on the old server and its traffic does not leave the cluster.

Database Access

This section is about the datastores that stay on the old server.

The application on the cluster reaches each datastore on the old server through its external address (the datastore's external URL). At the switch, the move changes each FROM_DATABASE environment variable of the application that uses the private URL of its datastore to the external URL. Other variables do not change. A rollback changes them back.

  • The port of a datastore is not open yet. The move first adds a firewall rule on the old server that allows the port only from the nodes of the cluster ("Added by the move of <application> to cluster <cluster>"). Then it turns on the external connections of the datastore. The datastore restarts for some seconds. This happens before the downtime, while the application still runs on the old server.
  • The port is open, and it has your firewall rules. The move adds the rule for the cluster nodes next to your rules.
  • The port is open to all (no rule). The move adds nothing.

Before the downtime, the move checks from every node of the cluster that each datastore answers (a short protocol check, not a login).

At the finish, the firewall rule for the cluster stays: the application needs it. From then on it is a normal rule of the old server, and you can change it.

After a rollback, the external connections of the datastore and the firewall rule for the cluster also stay (other applications can use the port now). You own them: turn the external connections off or delete the rule when nothing needs them.

Database traffic is not encrypted

The traffic between the cluster and the old server goes over the network and is not encrypted.

Warnings

The plan shows the warnings that apply to the application, for example:

  • The replicas on the cluster, when they differ from the old server.
  • On the cluster a cron job runs one run at a time, and its time limit is enforced.
  • The primary manager has another UTC offset than the old server: cron schedules use the time of the primary manager.
  • The cluster does not use the setting Allow HTTP access.
  • Database traffic between the cluster and the old server is not encrypted.
  • The old server stays the database server of the application. Do not delete it.
  • The move checks that each node reaches each datastore; it does not check the database login.
  • A datastore restarts for some seconds: its external connections are turned on.
  • The application is built again on the cluster from the commit of the newest deployment that runs. The build is not bit-identical.
  • Custom domains need a DNS change to the load balancer IP address.
  • A process has its own volumes (volumes of the process): "Process <name> has its own volumes. On a cluster they are on the node where a task runs: a folder must exist on each node that can run the process, each node has its own data, and the move does not copy it." See Process volumes.
  • A process mounts a folder of the old server that has files: "Process <name> mounts <path> from the old server, and the folder has files. The move does not copy them." The files stay on the old server.

Static Sites

A static site can move to a cluster. The site is built and served on the load balancer of the cluster.

No rollback for a static site

After the move, a rollback of this static site is not possible. You can only finish the move.

The plan and the confirm dialog show this warning before you confirm.

The plan of a static site, with the warning

Hold, Finish and Rollback

The hold works as for a move between servers: the move finishes by itself at the end of the hold, or when you click Finish now. At the finish, Appliku removes the old copy on the old server, also the old data folders of the datastores that moved into the cluster. The datastores that you did not select stay there, and the local backup files stay too.

Roll back stops the application on the cluster and starts the old copy on the old server again. When all datastores stayed on the old server, the two copies use the same datastores, no data of the datastores is lost, and the rollback has no tick box for lost data. When datastores moved into the cluster, they start again on the old server with their data of the time of the switch: the data written on the cluster since then is lost, and you tick "The data written on the new server since the move is lost." (CLI: --accept-data-loss). When you added a domain in the hold, you tick that the domain has no certificate on the old server (CLI: --accept-new-domains). The old copy runs the code of the time of the move.

The rollback is not possible for example when, in the hold:

  • an environment variable of the application changed,
  • a process changed (a change of its replicas is allowed),
  • a datastore of the application changed or is not on the old server,
  • a deployment built new images,
  • the primary manager or the load balancer of the cluster changed,
  • the application is a static site (see Static sites).

After a rollback, the stopped copy on the cluster is removed at the end of the hold, or now with Remove the old copy now.

When the Cluster Does Not Answer

  • Before the switch: when a move fails, Appliku first stops the copy on the cluster, then starts the application on the old server again. When Appliku cannot prove in 10 minutes that the copy on the cluster stopped (the primary manager or a node does not answer), the move waits with "Appliku cannot prove that the application stopped on the cluster." Then you can click Start without the stop proof and tick "The copy on the cluster can still run and use the same databases until Appliku can stop it." Appliku starts the application on the old server and stops the copy on the cluster when the cluster answers again.
  • A new plan after a failed or cancelled move: when the failed move copied datastores into the cluster, their staged folders on the database node stay for 7 days, and a new plan with the same node is refused ("Node … already has the folder …: the staged copy of move N"). The refusal text says when Appliku removes them and, when it is possible now, names Remove the old copy now on the page of that move. Make the new plan after the removal (the cleanup items on that page are empty).
  • After the switch: when the cluster does not answer, you can Abandon the move, and then Start the old copy on the old server. This needs two ticks: the files that the copy on the cluster wrote outside the datastores are lost, and the copy on the cluster can still run and use the same databases until Appliku can stop it. Start the old copy is not possible when the cluster answers again, for a static site, when an environment variable, a process (not its replicas) or a datastore of the application changed after the move, when a newer move of the application exists, or when the old copy was removed. The button shows the reason.

CLI

The Appliku CLI 0.11.0 or later has the move to a cluster:

# The servers and the clusters, each with "ok" or the reason.
appliku apps move targets --team my-team --app 42

# Plan the move to cluster 37 (ID or name), with 2 replicas of "web".
appliku apps move plan --team my-team --app 42 --to-cluster 37 --scale web=2 --wait

# CLI 0.13.0: datastore 5 moves into the cluster (copy), datastore 6 by dump and restore.
appliku apps move plan --team my-team --app 42 --to-cluster 37 \
  --move-datastore 5 --move-datastore 6:dump --wait

# Confirm and follow, 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

# In the hold: finish or roll back (--accept-data-loss only when datastores moved into the cluster).
appliku apps move finish   --team my-team --app 42 --move 8
appliku apps move rollback --team my-team --app 42 --move 8

# When Appliku cannot prove that the application stopped on the cluster.
appliku apps move recover-without-stop-proof --team my-team --app 42 --move 8

The plan output shows the new address, the database access, the replicas, the warnings and, for a static site, "No rollback: After the move, a rollback of this static site is not possible. You can only finish the move."

API

POST /api/team/<team>/applications/<id>/moves with {"target_cluster": <cluster id>, "scales": {"web": 2}} starts a plan to a cluster (scales is optional). move_datastores (a list of datastore IDs) moves these datastores into the cluster; dump_restore (a subset of it) selects dump and restore. Give exactly one of target_server and target_cluster. The move detail has kind (to_cluster), target_cluster (the name and the load balancer IP), rollback_supported and rollback_refusal (the static-site warning). GET .../move-targets lists the clusters in clusters, each with ok and refusal.