CorefinityCorefinityDocs
Open the Control PanelControl Panel
Environments and copies · 3 of 3

Clone an environment

Copy one environment's files, database or both onto another environment of the same site.

On this page

Before you start

  • You can open the site in Managed Websites. Anyone who can open a site can clone its environments.
  • The copy goes onto an environment of the same site: an existing one, whose contents are replaced, or a new one.
  • To replace Production with a staging environment, choose Production (push to live) as the target, then Continue to push to live. The next step shows what changes and asks you to type the site's domain.

Clone onto another environment

  1. Open the Clone dialog

    Go to Managed Websites, choose the site, then Environments under Code & backups. Choose Clone….

  2. Choose the source and the target

    Under From, choose the environment to copy. Under Target, choose An existing environment and pick it, or A new environment to go on in the Create environment dialog.

  3. Choose what to copy

    What to copyResult on the target
    Files and databaseEverything on the disk and the database is replaced.
    Database onlyIts files stay as they are.
    Files onlyIt keeps its database.

    A target that deploys from Git keeps its code and configuration. Files and database then replaces its database and shared folders, such as uploads, and Files only its shared folders alone.

  4. Keep the safety backup

    Leave Take a safety snapshot of the target first ticked. If the copy fails, the target is restored from it, and it stays in the target's backups as Before clone.

  5. Confirm

    Type the target environment's name, then choose the Clone to button.

Environments shows the progress until the clone finishes. The target does not answer visitors for a few minutes while the data is copied.

What changes on the target

  • Addresses in the copy are rewritten to the target's hostname.
  • On a staging target, outgoing email goes to Mailpit and search engines are told not to index it. Production keeps its scheduled tasks, its email and its own search engine setting.
  • A staging target's scheduled tasks are switched off.
  • The target's hostname, SSH port and password protection stay as they were.
  • On WordPress, a clone that copies the database resets the admin password, shown once when the clone finishes.

Automate this

Clone an environment

Copies {site} onto another environment of its website, or onto production (push to live), replacing what is there; quote the preview_token of previewSiteClone.

POST/api/corestack/sites/{site}/clone
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/clone \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "confirm_name": "Staging",
    "preview_token": "cp_Xq7mR2vK9sLp4TzW8nBd",
    "safety_first": true,
    "scope": "files_db",
    "target": {
      "environment_id": 1043,
      "type": "environment"
    }
  }'
Was this helpful?
Open in ClaudeOpen in ChatGPT