~radicle-link/dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
6 2

[PATCH v2 0/3] lil gitd fixes

Details
Message ID
<20220623095452.9234-1-alex@memoryandthought.me>
DKIM signature
missing
Download raw message
Changes from v1

* Moved example config files to bins/example-systemd-config

Published-At: rad:git:hnrkxafojjsz4m55qxbwigh1z8sdt7mai81gy on 
    seed: hydtac74mgo8xeh34cy7tmzzfejcybmxgfyawhnb4zj8wxxo4qckgh@seed.lnk.network:8799
    peer ID: hydjhd8q9nkoxzkpddhcuue9xzpfr4bn6d44fo1f4q1japwm4brhh6
Published-At: https://github.com/alexjg/radicle-link/tree/patches/lil-gitd-fixes/v2

Alex Good (3):
  Make lnk home argument for gitd optional
  Add logging to `lnk-exe`
  Add examples of systemd config

 bins/Cargo.lock                              |  1 +
 bins/example-systemd-config/README.md        | 68 ++++++++++++++++++++
 bins/example-systemd-config/lnk-gitd.service |  6 ++
 bins/example-systemd-config/lnk-gitd.socket  |  6 ++
 cli/gitd-lib/src/args.rs                     |  6 +-
 cli/lnk-exe/Cargo.toml                       |  6 +-
 cli/lnk-exe/src/cli/main.rs                  |  2 +
 7 files changed, 91 insertions(+), 4 deletions(-)
 create mode 100644 bins/example-systemd-config/README.md
 create mode 100644 bins/example-systemd-config/lnk-gitd.service
 create mode 100644 bins/example-systemd-config/lnk-gitd.socket

-- 
2.36.1

[PATCH v2 1/3] Make lnk home argument for gitd optional

Details
Message ID
<20220623095452.9234-2-alex@memoryandthought.me>
In-Reply-To
<20220623095452.9234-1-alex@memoryandthought.me> (view parent)
DKIM signature
missing
Download raw message
Patch: +3 -3
Make the lnk-home argument optional so that by default lnk-gitd uses
the `LnkHome::ProjectDirs`.

Signed-off-by: Alex Good <alex@memoryandthought.me>
---
 cli/gitd-lib/src/args.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cli/gitd-lib/src/args.rs b/cli/gitd-lib/src/args.rs
index 705debb0..2ec4d966 100644
--- a/cli/gitd-lib/src/args.rs
+++ b/cli/gitd-lib/src/args.rs
@@ -19,8 +19,8 @@ use crate::{

#[derive(Debug, Parser)]
pub struct Args {
    /// The path to use `LNK_HOME`.
    pub lnk_home: PathBuf,
    /// The path to use as `LNK_HOME`, if not set defaults to ProjectDirs.
    pub lnk_home: Option<PathBuf>,
    #[clap(short)]
    /// The socket address to start the gitd server on.
    pub addr: Option<SocketAddr>,
@@ -61,7 +61,7 @@ impl Args {
        self,
        spawner: Arc<link_async::Spawner>,
    ) -> Result<Config<BoxedSigner>, Error> {
        let home = LnkHome::Root(self.lnk_home);
        let home = self.lnk_home.map(LnkHome::Root).unwrap_or(LnkHome::ProjectDirs);
        let profile = Profile::from_home(&home, None)?;
        let signer = spawner
            .blocking({
-- 
2.36.1

[PATCH v2 2/3] Add logging to `lnk-exe`

Details
Message ID
<20220623095452.9234-3-alex@memoryandthought.me>
In-Reply-To
<20220623095452.9234-1-alex@memoryandthought.me> (view parent)
DKIM signature
missing
Download raw message
Patch: +8 -1
Signed-off-by: Alex Good <alex@memoryandthought.me>
---
 bins/Cargo.lock             | 1 +
 cli/lnk-exe/Cargo.toml      | 6 +++++-
 cli/lnk-exe/src/cli/main.rs | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/bins/Cargo.lock b/bins/Cargo.lock
index 97d715ef..6ab3de18 100644
--- a/bins/Cargo.lock
@@ -2302,6 +2302,7 @@ dependencies = [
 "lnk-sync",
 "lnk-thrussh-agent",
 "tokio",
 "tracing-subscriber",
]

[[package]]
diff --git a/cli/lnk-exe/Cargo.toml b/cli/lnk-exe/Cargo.toml
index c974c895..76849293 100644
--- a/cli/lnk-exe/Cargo.toml
+++ b/cli/lnk-exe/Cargo.toml
@@ -37,4 +37,8 @@ default-features = false

[dependencies.tokio]
version = "1.17"
features = ["rt"]
\ No newline at end of file
features = ["rt"]

[dependencies.tracing-subscriber]
version = "0.3.0"
features = ["std", "env-filter", "fmt"]
diff --git a/cli/lnk-exe/src/cli/main.rs b/cli/lnk-exe/src/cli/main.rs
index 05c8e95b..c64580ab 100644
--- a/cli/lnk-exe/src/cli/main.rs
+++ b/cli/lnk-exe/src/cli/main.rs
@@ -10,6 +10,8 @@ use super::args::{self, Args};
pub fn main() -> anyhow::Result<()> {
    let Args { global, command } = Args::parse();

    tracing_subscriber::fmt::init();

    // TODO: provide Runtime trait in lnk-clib to allow different runtimes
    let runtime = tokio::runtime::Builder::new_current_thread()
        .thread_name("lnk")
-- 
2.36.1

[PATCH v2 3/3] Add examples of systemd config

Details
Message ID
<20220623095452.9234-4-alex@memoryandthought.me>
In-Reply-To
<20220623095452.9234-1-alex@memoryandthought.me> (view parent)
DKIM signature
missing
Download raw message
Patch: +80 -0
Add some very simple example unit files and a README explaining how to
use them.

Signed-off-by: Alex Good <alex@memoryandthought.me>
---
 bins/example-systemd-config/README.md        | 68 ++++++++++++++++++++
 bins/example-systemd-config/lnk-gitd.service |  6 ++
 bins/example-systemd-config/lnk-gitd.socket  |  6 ++
 3 files changed, 80 insertions(+)
 create mode 100644 bins/example-systemd-config/README.md
 create mode 100644 bins/example-systemd-config/lnk-gitd.service
 create mode 100644 bins/example-systemd-config/lnk-gitd.socket

diff --git a/bins/example-systemd-config/README.md b/bins/example-systemd-config/README.md
new file mode 100644
index 00000000..e16f34a6
--- /dev/null
@@ -0,0 +1,68 @@
Here's how to get a simple lnk setup up and running on linux using systemd.

## Build and install the CLI tools

```
cd bins
cargo install --path lnk-gitd
cargo install --path lnk
```

## Setup your local identity

```
# create a profile
lnk profile create
# create your person identity, record the `urn` field of the resulting JSON
lnk identities person create --payload '{"name": "<your display name>"}'
lnk identities local set --urn <the urn from above>
```

## Add your seeds

Modify `$XDG_CONFIG_DIR/.radicle-link/<profile ID>/seeds`, add the following
line:

```
<your seed peer ID>@<address>:<port>
```

Note that the active profile can be found with `lnk profile get`


## Create the unit files

Copy `example-systemd-config/lnk-gitd.service` to `$XDG_CONFIG_DIR/user`. Modify
it so that the `<your lnk-gitd>` points at the location of the `lnk-gitd` you
installed above (probably `$HOME/.cargo/bin/lnk-gitd`).

Copy `example-systemd-config/lnk-gitd.socket` to `$XDG_CONFIG_DIR/user`, modify
the port in `ListenStream` to be wherever you want the git server to run.

Finally, enable the socket with `systemctl --user enable lnk-gitd.socket`


## Clone a project and mess around and add remote config

```
lnk clone --urn <some project>
cd <project name>
```

You'll need to update the project config to point `rad://` urls at `lnk-gitd`.
Put the following lines in `.git/config`

```
[url "ssh://127.0.0.1:9987/rad:git:"]
    insteadOf = "rad://"
```

Note that you can't currently put this in `~/.gitconfig` as it messes up `lnk
clone`.


## Off you go

Now you can push and pull from your monorepo via `git push rad`. Currently you
will need to add remotes for each other peer you want to work, this will be
fixed once we have updated `lnk sync` to update include files.
diff --git a/bins/example-systemd-config/lnk-gitd.service b/bins/example-systemd-config/lnk-gitd.service
new file mode 100644
index 00000000..eb9999ec
--- /dev/null
@@ -0,0 +1,6 @@
[Unit]
Description=lnk git daemon

[Service]
ExecStart=<your lnk-gitd> --linger-timeout 10000 --push-seeds --fetch-seeds
Environment=RUST_LOG=info
diff --git a/bins/example-systemd-config/lnk-gitd.socket b/bins/example-systemd-config/lnk-gitd.socket
new file mode 100644
index 00000000..dca23f54
--- /dev/null
@@ -0,0 +1,6 @@
[Socket]
ListenStream=127.0.0.1:9987
FileDescriptorName=ssh

[Install]
WantedBy=sockets.target
-- 
2.36.1

Re: [PATCH v2 2/3] Add logging to `lnk-exe`

Details
Message ID
<CKXGTECVGOH5.12SZM5U3HSHTN@haptop>
In-Reply-To
<20220623095452.9234-3-alex@memoryandthought.me> (view parent)
DKIM signature
pass
Download raw message
On Thu Jun 23, 2022 at 10:54 AM IST, Alex Good wrote:
> Signed-off-by: Alex Good <alex@memoryandthought.me>
> ---
>  bins/Cargo.lock             | 1 +
>  cli/lnk-exe/Cargo.toml      | 6 +++++-
>  cli/lnk-exe/src/cli/main.rs | 2 ++
>  3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/bins/Cargo.lock b/bins/Cargo.lock
> index 97d715ef..6ab3de18 100644
> --- a/bins/Cargo.lock
> +++ b/bins/Cargo.lock
> @@ -2302,6 +2302,7 @@ dependencies = [
>   "lnk-sync",
>   "lnk-thrussh-agent",
>   "tokio",
> + "tracing-subscriber",
>  ]
>  
>  [[package]]
> diff --git a/cli/lnk-exe/Cargo.toml b/cli/lnk-exe/Cargo.toml
> index c974c895..76849293 100644
> --- a/cli/lnk-exe/Cargo.toml
> +++ b/cli/lnk-exe/Cargo.toml
> @@ -37,4 +37,8 @@ default-features = false
>  
>  [dependencies.tokio]
>  version = "1.17"
> -features = ["rt"]
> \ No newline at end of file
> +features = ["rt"]
> +
> +[dependencies.tracing-subscriber]
> +version = "0.3.0"
> +features = ["std", "env-filter", "fmt"]
> diff --git a/cli/lnk-exe/src/cli/main.rs b/cli/lnk-exe/src/cli/main.rs
> index 05c8e95b..c64580ab 100644
> --- a/cli/lnk-exe/src/cli/main.rs
> +++ b/cli/lnk-exe/src/cli/main.rs
> @@ -10,6 +10,8 @@ use super::args::{self, Args};
>  pub fn main() -> anyhow::Result<()> {
>      let Args { global, command } = Args::parse();
>  
> +    tracing_subscriber::fmt::init();
> +

Doesn't need to be done now, but we should link this up with
`--verbose`/`--quiet` configurations.

>      // TODO: provide Runtime trait in lnk-clib to allow different runtimes
>      let runtime = tokio::runtime::Builder::new_current_thread()
>          .thread_name("lnk")
> -- 
> 2.36.1
Details
Message ID
<CKXGUBRT96L5.2X8W9X8FDOCZ3@haptop>
In-Reply-To
<20220623095452.9234-1-alex@memoryandthought.me> (view parent)
DKIM signature
pass
Download raw message
LGTM
Details
Message ID
<CAH_DpYR3foSEgKNacFBYc-Mi8JVrzDwmRPDB343sx2S1taXTvg@mail.gmail.com>
In-Reply-To
<20220623095452.9234-1-alex@memoryandthought.me> (view parent)
DKIM signature
missing
Download raw message
Merged to master

Master-At: b5e739276d7561e959cc6fe38ca2fc16a106fc4f
Reply to thread Export thread (mbox)