# How to Migrate Paperclip to xCloud (Hostinger or Any Server)

> Migrate Paperclip to xCloud from a Hostinger VPS or any server: deploy a fresh Paperclip, back up the old one with its own command and restore it on xCloud.

You can migrate Paperclip to xCloud from any server in about 20 minutes. **Deploy a fresh Paperclip on xCloud, back up the old one with Paperclip's own `paperclipai db:backup` command, copy the backup and the instance folder to xCloud, and restore them there.** Your companies, agents, issues and secrets come over, and xCloud keeps running Paperclip with its own domain, Basic Auth and AI provider.

This works wherever you run Paperclip today: a Hostinger VPS, another VPS or a machine at home. The old Paperclip is only read, never changed, so nothing is lost if you stop halfway. Moving a Hermes Agent or OpenClaw instead? See [How to Migrate Hermes Agent to xCloud](/docs/migrate-hermes-agent-to-xcloud/) or [How to Migrate OpenClaw to xCloud](/docs/migrate-openclaw-to-xcloud/).

## What moves and what doesn't

| Moves to xCloud | Stays as xCloud set it up |
|---|---|
| Companies, agents, projects, issues, comments, routines and budgets (the database) | The Paperclip program and its version |
| Stored secrets, plus the `secrets/master.key` file that unlocks them | Paperclip's settings file `config.json` (port, allowed hostnames, database connection) |
| Uploaded files and attachments (`data/storage`) and company files | The AI provider and key you chose on xCloud, in `/root/.paperclip/.env` |
| | The `paperclip` service, PostgreSQL database, dashboard domain and Basic Auth |

On xCloud, Paperclip runs as `root`, keeps its data in `/root/.paperclip/instances/default`, stores everything else in the PostgreSQL database `paperclip` and runs as the systemd service `paperclip`.

## What you need

- Your current Paperclip, and a terminal on its server (SSH or your host's web terminal)
- The Linux user that runs Paperclip there, and where its data is (usually `~/.paperclip/instances/default` in that user's home)
- An old server that can reach your xCloud server on SSH port 22, with `tar`, `ssh` and `scp`
- An xCloud account

If your old Paperclip runs in Docker, run the old-server commands below inside its container (`docker exec -it <container> bash`) and use the paths of that container.

## Step 1: Deploy a fresh Paperclip on xCloud

Create a new Paperclip server by following [How to Deploy Paperclip with xCloud](/docs/how-to-deploy-paperclip-with-xcloud/). Choose the AI provider your agents use, and add its key or connect your subscription.

When the server is ready, check the Paperclip version on both servers with `paperclipai --version`. The xCloud server must run the same version or a newer one: Paperclip upgrades an older database by itself when it starts, but it can't read a database from a newer version. xCloud installs the latest Paperclip release when it creates the server.

## Step 2: Create an SSH key on the old server

Log in to the old server as the user that runs Paperclip and create a key for the move:

```bash
ssh-keygen -t ed25519 -N "" -f ~/.ssh/paperclip_migration
cat ~/.ssh/paperclip_migration.pub
```

Copy the line that starts with `ssh-ed25519`. Never share the private key (the file without `.pub`).

## Step 3: Give the key root access to the xCloud server

1. Open the new server in xCloud and go to **Settings → Sudo Users**.
2. Click **Add Sudo User**.
3. Enter `root` in **Sudo User Name**. A root user needs no password.
4. Click **Add SSH Key**, give it a name such as `paperclip-migration`, paste the public key from Step 2 under **Public Key**, and click **Add SSH Key**. The new key is ticked.
5. Optional: tick **Temporary**, so xCloud removes the key by itself within 12 hours. If `root` is already in the **Sudo Users** list, leave **Temporary** unticked: xCloud doesn't allow a temporary key on a `root` user that already has permanent access. Edit `root` instead, tick the `paperclip-migration` key and remove it in Step 8.
6. Click **Save**.

![Enter root as the Sudo User Name and tick the paperclip-migration SSH key in xCloud's Add Sudo User form](/_landing/docs/migrate-paperclip-to-xcloud-image-1.png)

xCloud adds the key for `root` in a few seconds. You'll find the server's IP address on the server's overview in xCloud. Test the login from the old server:

```bash
ssh -i ~/.ssh/paperclip_migration root@SERVER_IP "paperclipai --version && systemctl is-active paperclip"
```

It prints the version and `active`.

## Step 4: Back up the old Paperclip

On the old server, as the user that runs Paperclip, make a database backup and pack the instance folder:

```bash
mkdir -p /tmp/paperclip-migration
paperclipai db:backup --dir /tmp/paperclip-migration
tar -czf /tmp/paperclip-migration/paperclip-files.tar.gz \
  -C ~/.paperclip/instances/default \
  --exclude=./db --exclude=./logs --exclude=./data/backups \
  --exclude=./config.json --exclude=./.env --exclude=./runtime-info.json .
ls -la /tmp/paperclip-migration
```

`db:backup` works with Paperclip's built-in database and with an external PostgreSQL. It saves one file named like `paperclip-20261204-201545.sql.gz`. The `tar` file holds `secrets/master.key`, `data/storage` and your company files; the database folder, logs and settings stay behind on purpose. Both files hold keys, so treat them as secrets.

## Step 5: Copy the backup to xCloud and stop the old Paperclip

Copy both files to the xCloud server. Replace `SERVER_IP` with its IP address:

```bash
scp -i ~/.ssh/paperclip_migration /tmp/paperclip-migration/paperclip-*.sql.gz root@SERVER_IP:/root/paperclip-migration.sql.gz
scp -i ~/.ssh/paperclip_migration /tmp/paperclip-migration/paperclip-files.tar.gz root@SERVER_IP:/root/paperclip-migration-files.tar.gz
```

Then stop the old Paperclip, so your agents don't run on two servers at once. Use the way you started it: `systemctl stop <service>` for a systemd service, `docker stop <container>` for Docker, or Ctrl+C in the terminal where `paperclipai run` or `paperclipai onboard` runs. Anything you change in the old Paperclip after the backup in Step 4 doesn't move, so don't work in it during the move.

## Step 6: Restore on the xCloud server

Log in to the xCloud server (`ssh -i ~/.ssh/paperclip_migration root@SERVER_IP`) and run these commands in order:

```bash
# 1. Stop Paperclip and keep a safety copy of the fresh install
systemctl stop paperclip
sudo -u postgres pg_dump paperclip | gzip > /root/paperclip-before-migration.sql.gz
tar -czf /root/paperclip-before-migration.tar.gz -C /root .paperclip

# 2. Replace the empty database with your backup
sudo -u postgres dropdb paperclip
sudo -u postgres createdb -O paperclip paperclip
sudo -u postgres psql -c 'ALTER USER paperclip WITH SUPERUSER'
set -a; . /root/.paperclip/.env; set +a
gunzip -c /root/paperclip-migration.sql.gz | psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -q
sudo -u postgres psql -c 'ALTER USER paperclip WITH NOSUPERUSER'

# 3. Bring in the secrets key, files and company folders
tar -xzf /root/paperclip-migration-files.tar.gz -C /root/.paperclip/instances/default
chown -R root:root /root/.paperclip/instances/default

# 4. Start Paperclip and check it
systemctl start paperclip
sleep 20; systemctl is-active paperclip
paperclipai company list
```

What the commands make sure of:

- **The safety copies** `/root/paperclip-before-migration.sql.gz` and `/root/paperclip-before-migration.tar.gz` let you put the fresh xCloud install back.
- **The `paperclip` database user is a superuser only during the restore.** Paperclip's backup needs it, and the next line takes it away again, so your tables stay owned by `paperclip`.
- **`chown`** matters: Paperclip refuses to start when its `secrets` folder belongs to another user, which happens when the old server ran Paperclip as a different user.

When `paperclipai company list` shows your companies, the restore is done. Delete the two migration files: `rm /root/paperclip-migration.sql.gz /root/paperclip-migration-files.tar.gz`.

## Step 7: Check your Paperclip on xCloud

1. In xCloud, open the server and go to **Paperclip → Status**.
2. Open the **Dashboard URL** and sign in with the **Dashboard Basic Auth** username and password shown there.
3. Open your company and check your agents, issues and projects. Run one agent heartbeat to see that it reaches your AI provider.

If an agent used the old server's AI login, it now uses the provider you set on xCloud. To change it, go to **Paperclip → Providers**, choose the provider, add its credential and click **Save Changes**.

## Step 8: Clean up

1. In xCloud, go to **Settings → Sudo Users**. If the migration key is the only key on `root`, delete the `root` entry: for `root`, xCloud removes only its SSH keys, never the user. If `root` has other keys you use, edit it and untick only `paperclip-migration`. A **Temporary** key is removed by itself within 12 hours.
2. On the old server, delete `/tmp/paperclip-migration` and the `~/.ssh/paperclip_migration` key files.
3. Keep the old Paperclip stopped for a few days. Once you are sure everything is on xCloud, cancel the old server or plan.
4. When you no longer need them, delete the two `/root/paperclip-before-migration.*` files on the xCloud server.

![The root entry in xCloud's Sudo Users list, where you remove the migration key after the move](/_landing/docs/migrate-paperclip-to-xcloud-image-2.png)

## Troubleshooting

### The restore stops with "permission denied" or "must be superuser"

The `ALTER USER paperclip WITH SUPERUSER` line didn't run. Run the commands of part 2 again from `dropdb`, in order.

### Paperclip doesn't start after the restore

Check its log with `journalctl -u paperclip -n 50`. "Decision signing secrets directory … must be owned by the Paperclip process user" means the `chown` line was skipped: run `chown -R root:root /root/.paperclip/instances/default` and `systemctl restart paperclip`. You can also open **Paperclip → Status**, tick **Repair Paperclip Service** under **Rescue Site** and click **Run Now**. It rewrites the service and folders, not your data.

### The xCloud version is older than the old one

Paperclip can't read a database from a newer version. Restore the safety copies (below), keep using the old Paperclip for now, and contact our [support team](/docs/access-built-in-support-portal-in-xcloud/) for help. Then run Steps 4 to 6 again.

### Stored secrets don't work on xCloud

The secrets need the `master.key` from the old server. Check that `/root/.paperclip/instances/default/secrets/master.key` came over with the `tar` file in Step 4, then restart Paperclip.

### You want to undo the migration

On the xCloud server, run `systemctl stop paperclip`, recreate the database (`sudo -u postgres dropdb paperclip && sudo -u postgres createdb -O paperclip paperclip`), restore it with `gunzip -c /root/paperclip-before-migration.sql.gz | sudo -u postgres psql -q paperclip`, put the folder back with `rm -rf /root/.paperclip && tar -xzf /root/paperclip-before-migration.tar.gz -C /root`, and start Paperclip again. Your old Paperclip was never changed, so you can also simply start it again.

## Frequently asked questions

### Can I migrate Paperclip from any host?

Yes. The migration uses Paperclip's own backup command (paperclipai db:backup) and a copy of its instance folder, so it works wherever Paperclip runs: a Hostinger VPS, another VPS or your own machine. You only need a terminal on the old server where paperclipai, tar and scp work, and the old server must reach your xCloud server on SSH port 22.

### What moves to xCloud?

Everything stored in Paperclip's database: your companies, agents, projects, issues, comments, routines, budgets and stored secrets. The instance folder adds the secrets key that unlocks those secrets, uploaded files and attachments, and company files. The Paperclip program, its settings file and your AI provider on xCloud stay as xCloud set them up.

### Do my agents run twice during the move?

Not if you follow the order in this guide. You stop the old Paperclip before you start the restored one on xCloud, so only one copy runs your agents' heartbeats and routines at any time.

### Can I go back if something is wrong?

Yes. Before the restore you save the fresh xCloud database and folder as /root/paperclip-before-migration.sql.gz and /root/paperclip-before-migration.tar.gz, and the old server is never changed. You can restore the safety copies on xCloud or simply start the old Paperclip again.

If you run into any issues during the migration, feel free to reach out to our [support team](/docs/access-built-in-support-portal-in-xcloud/).
