# Move an app to another server

You can move an app to another server in the same team. Coresmith copies any data the app keeps, deploys its live commit on the new server, then sends visitors there. An app without data keeps answering on its old server the whole time. The app keeps its name, its variables and its deploy history.

## Before you start

- Owners and admins can move any app. Developers can move the apps they added.
- One move runs at a time for an app, and a move can't start while a deploy is running.
- While an app is moving, Coresmith turns down deploys and rollbacks for it and says why.

## Move an app

1. Open the app's page and go to **Danger zone**.
2. Choose **Move to another server**.
3. Coresmith checks what the app keeps on its server, then lists the team's other servers. Pick one.
4. Read what moves, then choose **Move to** and the server's name.

The app's page then opens on the new server and shows the move's progress at the top.

An app that hasn't been deployed yet moves at once, since nothing is running, unless it has databases Coresmith made. Those are copied first.

## Pick a server

Every other active server in the team that you can see is listed. A server that can't take the app is greyed out with the reason, such as a server that isn't answering, or one that already has a database with the same name as one of the app's.

If the app has an address under your [default domain](/docs/apps/default-domain) and the domain's wildcard record doesn't reach the server you pick, the server says so: that address stops working there, and you can give the app a domain of its own after the move. With a Cloudflare token, Coresmith moves the address's records for you, so this doesn't come up.

## Apps that keep data

The dialog lists what Coresmith copies:

- Files the app keeps on its server, like uploads and SQLite files. Caches, sessions, compiled views and logs stay behind.
- Databases Coresmith made, under the same name, user and password, so the app's variables still work.
- A Redis instance of the app's own, with everything in it.

While Coresmith copies the data and deploys on the new server, visitors see the maintenance page on the old server, so nothing is written there in the meantime. How long that takes depends on how much the app keeps.

The shared Redis isn't copied, since other apps' keys are in it too. The app starts with an empty one on the new server.

If the app's variables point at a database or Redis on its server that Coresmith didn't make, the move can't start. Connect a database Coresmith made, or point the variables somewhere else, then move the app.

## Follow the move

The banner at the top of the app's page says where the move is:

- **Copying** the app's data, for apps that keep data.
- **Moving**, while Coresmith deploys the app on the new server. **View the deploy** opens its log.
- **Answers on** the new server, once the deploy is live and visitors are switched over.

If the deploy on the new server fails, the app stays on its old server, and the banner says why with a link to the log. If copying the data fails, the app stays there too, and the banner says what went wrong. An app that showed the maintenance page during the move starts again on its old server.

## How each domain moves

When the app is live on the new server, Coresmith switches visitors over:

- **Records Coresmith made**, like the app's default address with a Cloudflare token, move to the new server.
- **Domains a Cloudflare tunnel or another server's front door carried** move in Cloudflare.
- **Records you made yourself** stay as they are. The app's **Domains** card shows each one still pointing at the old server, with the record to change. Change it where you manage the domain's DNS.

Coresmith copies the app's certificates before the move, so the new server answers over HTTPS as soon as DNS reaches it. If the old server doesn't answer, the new server asks for its own certificates once the domain points at it.

If the app has a tailnet or preview address, Coresmith sets it up again on the new server, and the address changes.

## Cancel a move

Choose **Cancel the move** on the banner, any time before visitors are switched over. The app stays on its old server, and Coresmith removes what it set up on the new one. If Coresmith is in the middle of copying, it stops once the current step ends. If the deploy on the new server has already started changing things, it has to finish first.

After visitors are switched over, the move can't be cancelled. Move the app back instead.

## Remove the old copy

At the switch, the old copy stops its cron jobs and workers, so scheduled work doesn't run twice. Visitors whose DNS hasn't caught up yet still reach it: an app without data keeps answering them, and an app that keeps data shows them the maintenance page. Coresmith removes the old copy once every domain points at the new server, or after 24 hours.

To remove it sooner, choose **Remove the old copy** on the banner. Visitors whose DNS still points at the old server get an error once it's gone.

If the old server doesn't answer, Coresmith tries again every hour for a week, then leaves a note on the app's page that the old copy is still there.

## After the move

- Releases built on the old server read **built on** with the old server's name. You can't roll back to them, but **Deploy this commit** deploys the same commit on the new server.
- Databases Coresmith copied stay on the old server too, so nothing is lost. Remove them from the old server's **Databases** tab once you're sure the copy has everything.
- Links to the app's page on its old server lead to its new one.
