--- title: "Cloning an Application" description: "Copy an application with its settings, add-ons and cron jobs - and, for PostgreSQL, its data - to test against real conditions." --- Cloning creates a new application from an existing one. Use it to stand up a staging copy of production, try a risky change against real data, or move an application to another resource. ## Cloning from the dashboard Open the application and choose **Clone** from its actions. Give the copy a label and a codename, pick the project and where it runs, and tick what to bring along under **Settings**, **Addons** and **Cronjobs**. ## What can be copied The copy always gets the source's application settings, apart from health checks. Everything else is opt-in: | Option | What it copies | |---|---| | Environment variables | The source's variables | | Secret files | The source's [secret files](/deployments/using-secrets) | | Scaling settings | Replicas and autoscaling configuration | | Health checks | Health check configuration | | Security | Allowed connections and basic auth | | Add-ons | Each add-on you pick, with or without its data | | Cron jobs | Each [cron job](/deployments/cron-jobs) you pick | ### Copying data An add-on can be cloned empty or with its data, for example a PostgreSQL database with its contents. Data is not copied in these cases: - MySQL and Valkey add-ons. - Shared add-ons. Shared storage can also only be cloned to the same resource and project. - A copy that runs in a different region from the source. ## Where the copy runs The copy runs on a resource you choose. When the resource is assigned to projects, the copy's project has to be one of them. It can also run on [Usage Billing](/pricing/usage-billing) instead of a resource. It then keeps the source's CPU and RAM unless you give it another size, and the source's region unless you pick another one. ## What the copy deploys A copy does not inherit the source's deployment source. Either connect one to it - a [GitHub repository](/deployments/github-integration), [Git push](/deployments/git-push-to-builder) or a [container registry](/deployments/container-registry) - or follow the source's image: - **Use Parent Image** runs the copy on the source application's image, while still letting you deploy other code to it by hand. - **Enable Auto-Sync** also redeploys the copy every time the source's image is updated, which suits a staging copy that should always run what production runs. Manual deployments are turned off while it is on. Both are available only when the copy runs in the same region as the source. ## Cloning over the API ```bash curl -X POST "https://app.miget.com/api/v1/apps/{uuid}/clone" \ -H "Authorization: Bearer $MIGET_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "label": "Shop staging", "name": "shop-staging", "project_id": "{project_uuid}", "resource_id": "{resource_uuid}", "clone_variables": true, "clone_secret_files": true, "addons": [{ "uuid": "{postgres_addon_uuid}", "clone_data": true }], "cronjobs": ["{cronjob_uuid}"] }' ``` To run the copy on Usage Billing, send `"billing": "pay_per_use"` instead of `resource_id`, with an optional `region_code` and `size`. The full list of fields is in the [API reference](/api-reference/introduction).