platformsh / cli

The unified tool for managing your Platform.sh services from the command line.
https://docs.platform.sh/administration/cli.html
MIT License
16 stars 6 forks source link

Restore backup without the resources on Upsun #190

Open nicogommen opened 1 week ago

nicogommen commented 1 week ago

Context

With Git 27 (not yet released but coming soon), when you restore a backup on Upsun, we are by default restoring the resources to their state when the backup was taken. This applies mainly for when you restore a backup to an existing environment. In this case, the containers are (probably) still running on this environment, so when you restore the backup, the resources of these containers are by default set back to what they were when the backup was taken. It's a bit different for new containers, where the resources initialization strategy (--resources-init option) is used to initialize the resources of these new containers. Knowing that there are only 2 cases when new containers are initialized => 1) when you restore to a new environment, in that case, all containers are new, or 2) when you restore to an environment where you have removed some containers since the backup was taken, in that case, these removed containers will be restored using the resource initialization strategy.

Description of the changes to be made

1- Just like we have a --no-code option to not restore the code, we would like to add a --no-resources option to not restore the resources. With git 27 (https://api.platform.sh/docs/#tag/Environment-Backups/operation/restore-backup), the API will have a restore_resources key in its payload, similar to the restore_code one.

2- In the help text of the --resources-init option (upsun backup:restore --help), update the default when the option is not set to backup instead of parent.

pjcdawkins commented 1 week ago

Like this? ^

nicogommen commented 1 week ago

Like this? ^

Yes, that looks good 🙂