Request for Comments: Anytype backup tool

Like a lot of other folks, I wanted a way to automatically backup Anytype data on a schedule. The more I thought about it, in terms of a mission-critical tool, I realized there are several must-have and should-have features, like incremental backups, selective restore, and encryption. I’m a believer in open source and collaboration and thought it would be interesting to post a Draft PRD and solicit feedback from other Anytypers. If I don’t run into any unforeseen hiccups, I’d like to have v1 later this month.

The problem is, that something like a backup function simply doesn’t exist! :frowning:
– n export is not equal to a real backup. Because the act to import such a file, overwrites some metadata. For example Creation Date and Added Date and Origin become overwritten.
As a consequence, Views that filter (or sort) for such properties, don’t work anymore! :frowning:
This is a real big problem!

If you plan to program a time-controlled backup function, or something in this direction, then I believe you have no chance to do that, before the devs implement the missing basic functions for backups.

The dates I’ve been looking at are createdDate and lastModifiedDate. Fortunately, the devs already gave us what we need in the gRPC apis. If you create an object and export it, then import it, both createdDate and lastModifiedDate are preserved and equal to the values in the source object. If you had a view filter or sort based on those properties, it should sort the same way after a restore.

I’m not sure I understand your setup. Which date field is used in the view filter? Was it createdDate or lastModifiedDate? (in the REST api they are called created_date and last_modified_date). How were the objects exported and imported? Was it with the gRPC api?

I’ve talked not about the export alone. The export contains the correct Creation Date, Added Date, etc. (at least I strongly believe so).
BUT in the moment you IMPORT a previously exported file, these (and some other) Property values become overwritten with the actual date of the import!
Suddenly have all images lost their original Added Date and they all have the same origin (imported file).

I didn’t use programming or external tools. I simply used the normal export/import function that Anytype offers.
I exported the whole Space into a single ZIP file: Protobuf, AnyBlock, files included.

Here the whole story:

@code-jack In my testing so far, lastModifiedDate and createdDate are restored when restoring from a backup, using my tooling, which uses the gRPC api. Your earlier post confirms that of 608 images, most of them did get the correct date on import. I could speculate on why 100+ images did not get the right dates, but I’ll leave that to the Anytype team to diagnose.
Thanks for the info. I’ll make sure to test date restores thoroughly.

Thanks for putting this together and sharing the draft. I’ll make sure the relevant folks on our side take a look.

@Filip Awesome! I have a working version and am running fuzz tests on it.

Please show this to the team - somebody may find it useful.

Sure, forwarded. :slightly_smiling_face:

@Filip
I filed four github PRs today to fix bugs found while testing anyback. Hopefully somebody can review these soon. :folded_hands:

  • and this issue reported here. no git issue or pr filed, but it prevents doing backups to a remote server.

@Code-Jack - Pretty sure I found the problem that caused your images to lose their original dates when importing from backup. In my earlier message when I said dates were getting restored in my tests - that was for objects, not files. Dates were definitely not restored when importing files. There’s at least one code path where dates are retained- when there are duplicates. Were some of your images dups of images that were already in the space?

For anyone interested, pre-release coming soon. If you’d like to test an alpha release, let me know (or build from github )

Along with the backup and restore, I made a TUI for inspecting archives. Here are a couple screenshots:

archive-inspector (screenshot 1)

archive inspector - markdown preview

Highly unlikely.
But meanwhile it has become hard to investigate. We are some versions further and I’ve already spent some time to clean up the mess.

In any case: many thanks for thinking about my issue! :+1: :pink_heart:

Hi!
I got some good feedback on the backup RFC and implemented several of the suggestions, such as exporting an entire space to markdown (with the caveat that it loses some anytype detail, but might be the right thing if you want to import into another tool).

It’s also possible to do a “lossless” protobuf export, and then use the inspector tool to search for a specific document and export it to markdown - that use case might be more applicable to recovery or selective export.

If you previously installed anyback, there’s an update! It’s part of the anyr cli and can be invoked with anyr backup.

Links: