I've written a prototype of a Radicle backup tool, Radicle Backup
<https://gitlab.com/aknudsen/radicle-backup> (implemented in Rust), which
offers backing up Radicle projects to archives and also restoring from such
archives. Shortly put, in restoration mode the Git repo itself will be
restored, the linked list of Radicle state transition blocks added to IPLD
and the IPNS entry made to point to the latest block. You can get more
in-depth information on the tool's workings in the reference documentation
Basically, I'm asking for feedback on my tool. Does it currently make
sense? What is it missing? I'm pretty new to Radicle and not super familiar
with how it actually works, so I could use the help of the Radicle devs to
understand how to properly back up and restore a Radicle project.
This is really cool! It seems to make sense, though (leaving aside the
git ipns, which is not actually a machine) it seems like it's only
backing up the *specific* machine mentioned. In this case, the project.
But the project is one machine, whose sole purpose is to contain
pointers to other machines -- right now, 1) the issue machine, 2) the
patch machine, and 3) the git ipfs non-machine. It seems like 1 and 2
won't automatically be backed up by this tool.
Which I think is the *right* design. We're already working on more
machines, and many won't be listed under a project, so (assuming I've
understood things correctly) it's *more* useful this way since we can
then also back up those machines.
*But* if the purpose is to back up the project, it seems like you'd need
to do a little more leg work. You'd need to get the project machines (as you
do), and back that up. And then get the other machines (
`get-rsm-of-type!`, from prelude/machine, should help) and again use the
tool to back those up.
You can go either way in terms of which program calls which (though see
note  below), but here's an example of a Radicle program calling your
executable to backup all the machines:
(import prelude/machine :as 'machine)
(import prelude/io '[process!] :unqualified)
"Get all the machine for a project, including the project itself."
(filter (fn [x] (not (eq (lookup :type x) :rad-repo)))
"Backup the specified machine"
(process! "rad-backup" [machine] "")))
(def args (get-args!))
['proj] (map backup-machine (machines-to-backup proj))
'r (put-str! "expecting single argument: project id")
(Note - I haven't tested this code at all. I doubt event the parens
 Currently we have a bug where radicle outputs to /dev/tty instead of
stdout, so running a radicle script from rust and capturing the output
is a little annoying. This is bug #1 in the rad issues for Radicle
itself. From the issue itself:
Currently things like `rad issue list | wc -l` won't work, since we're outputting directly to tty. That sucks.
(As a note, in the meantime `script -q -c 'rad issue list'` can be used
I hope this makes sense. radicle-backup is way cool - if there's more I
can do to help let me know!
On Sun, Apr 21, 2019 at 08:59:37AM -0700, Arve Knudsen wrote: