platformOS Community

Clarity on (over) copy instance

Rich - One Orange Cow Jan 12 2021 at 03:02

Just wanted clarity on copying an instance. While I understand this is designed for fresh instances (cloning), you can copy over existing instances. I wanted to find out what happens in this case.

Does it:

  • Delete the target instance and copy over the with the source?
  • Copy over all existing files (modules / app) etc?
  • Copy some? If so what?
  • Data models? How is this handled?
  • Users? If they already exist or perhaps their profile data has changed?
  • some combination of the above?

If we could get some info here that would be great.

Maciej.Krajowski Jan 18 2021 at 09:55

Instance Copy is a shortcut for:

  • exporting the code from one Instance (but because it's done server-side, we do include all private files as well, because those are never exposed)
  • exporting all the data from the source instance (Users, Records etc)
  • importing those files to the new instance (and it works the same way as a regular deploy, so non-existing Pages, Partials and all other resources are removed using the same rules as for a regular deploy)
  • importing them to the target Instance (and rules here are the same as with regular data import, so nothing gets deleted, only inserted/updated).
  • assets copy (no assets are physically removed from S3 during this operation - only insert/update. You won't be able to access non-existing Assets though via asset_url if they are not part of assets manifest - again, same as with regular deploy)
Dean Jan 12 2021 at 07:40

In my experience it makes an exact replica of fhe source on the target. Removing all previous data from target

matt Jan 26 2021 at 15:56

Dean and I have since noted that it doesn't wipe the target instance.

This raises the question of what happens if there's an issue with the copy caused by this.

If the target has a model named 'model_1' and the source also has the same model, but with different properties, what happens to the target and source items? Which wins?

We've seen some copies fail before due to issues with the source instance, but never the target instance.

  • Pawel Jan 27 2021 at 14:02
    I think you cant change (add/remove) properties in a model until you cleared records from that table. So it will probably throw an error prompting to clear the table before doing any changes to the schema. This is my guess from the memory :)
Please sign in or fill up your profile to answer a question