This is a set of scripts for playing with the binaries in radicle-link
.
The scripts here are all designed to work with a local checkout of
radicle-link
. In particular all invocations of the lnk
and linkd
binaries
are made using cargo run
- this means that the binaries will be recompiled on
any change to the codebase. To specify the location of your checkout of
radicle-link
you’ll need to modify the env
file.
We’re going to simulate two maintainers trying to collaborate via a seed node.
The first maintainer will create a project and push it to their local monorepo
via a running gitd
. The gitd
will then push the new changes to the seed.
Finally the second maintainer will pull the changes from the seed to their local
monorepo and checkout a working copy using lnk clone
.
We must create three profiles in separate LNK_HOMEs, one for each of the maintainers and one for the seed. This script will prompt you for a passphrase for the profile you are creating three times. I just use "1" in each case.
./create-lnk-homes.sh
Add the ssh keys for each profile to the ssh-agent, this will prompt you for your passphrases again.
./add-ssh-keys.sh
This effectively runs lnk identities person create
followed by lnk
identities local set --urn <the urn we just created>
./create-identity.sh
We create a working copy which we’re going to add to the local monorepo.
./create-repo.sh
This will output some JSON including the URN of the project, make a note of the URN.
First get the seed peer ID.
LNK_HOME=/tmp/seed-home ./lnk.sh profile peer
Then add the seed to the seed configs for the local peers
echo <peerid>@127.0.0.1:8799 | tee /tmp/link-local-1/<profile id>/seeds /tmp/link-local-2/<profile id>/seeds
In a fresh terminal:
./start-git-server-1.sh
Note that this script actually runs systemd-socket-activate
to simulate a
socket activated connection to the gitd
. This means that the process will
terminate once there are no more connections to service so you’ll need to run
this script again each time you want to communicate with the gitd
.
The URN here is the URN output by the create-repo.sh script. You can also find
it in the git config. There will be a remote called rad
with a URL of the form
rad://<URN>
.
git remote add linkd 'ssh://rad@127.0.0.1:9876/<URN>'
First get the peer ID of the first peer
LNK_HOME=/tmp/link-local-1 ./lnk.sh profile peer
LNK_HOME=/tmp/link-local-2 ./lnk.sh lnk clone \
--urn <project URN>\
--path theproject2\
--peer <first peer ID>
This should now show the repository in the theproject2
directory.