Hey Cockpit team,
based on the experience on other CMS, I think Cockpit can benefit if provides a simple mechanism to export/import configurations (e.g. collection definitions, global settings) and contents (e.g. collection contents, user accounts, etc..).
For what I understood and it seems to work if I copy (in below example assuming that I am using sqlite):
config/config.yaml
storage/collections
storage/data
storage/uploads
I can basically copy all the configurations and contents to another instance of cockpit, however, I think that this process is not error proof (copy of storage/data must be performed when there are no sqlite accesses) and not user-friendly.
What do you think?
Thanks
Paulo
@pauloamgomes I think this is a great idea, do you want to step in and work on one?
Sure @aheinze
Great, thanks @pauloamgomes !
Hey @aheinze , as discussed I'm working on it, think I'll have a near-final version soon, I have only one doubt that maybe you can help. In the particular case (using sqlite) that we drop a collection:
$this->module("collections")->removeCollection($name);
then I recreate
$this->module("collections")->createCollection($name, $collection);
above works well, collections are recreated, but if in the same request if I try to save some entries:
$this->module('collections')->save($collection['name'], $entries);
it seems that the structure is not updated in the sqlite!! (I can also confirm that by accessing directly the sqlite file, the tables are not yet there, but after a new request, they are created)
Any ideas?
Thanks in advance
Paulo
btw, some examples how it looks now:
Backups page

Backup view

Restore view

Resuming a backup is a zip file organized using yaml and json files:

@pauloamgomes first let me thank you for your work on this add-on, looks great! As I undesrtand it right, you're creating an own meta backup format. why don't you just back up and restore the files, wouldn't it make things much easier?
Hey @aheinze , you mean by files the collections/regions/forms that are saved in form of php, right?
Question is that I wasn't sure if just restoring those files and then saving the entries it was enough, and instead of that I'm using your storage methods to delete and create definitions (colections, regions, forms) and add contents.
My intention is to have enough flexibility to support different scenarios, e.g.:
Right now I solved the issue that mentioned before by executing the restore functions in different ajax requests, so a backup/restore seems to work well, but happy to do any change based on your thoughts. I plan to release it soon so hope you can review it.
I see, looking forward to your final result!
Addon available at https://github.com/pauloamgomes/Cockpit-Backup-and-Restore

cool @pauloamgomes ! I'll take a look. Thanks for your work!
Most helpful comment
@pauloamgomes I think this is a great idea, do you want to step in and work on one?