Skip to content

Commit

Permalink
fix: add handling of dns multiaddrs + bootstrapping + CLI / Conn chan…
Browse files Browse the repository at this point in the history
…ges (#547)

fix: add handling of dns multiaddrs and added kad bootstrapping

Closes #545.
Closes #492. 

refactor: transport handling for ws & quic as fallback

Includes:
- dns fallback to cloudflare
- CLI: removal of -w for running workflows; it's now a positional
argument (the first one on run)
  * related to #489
- CLI: `node` command which showcases nodeinfo, e.g. peer_id and
listener addrs/connections
  * related to #489
- CLI: adds static/non-RPC `info` command showcasing version,
build-git-sha, and features built with. We can extend this later with
more build information.
- Closes #297
- Closes #497

---------

Signed-off-by: Zeeshan Lakhani <zeeshan.lakhani@gmail.com>
Co-authored-by: Brian Ginsburg <7957636+bgins@users.noreply.github.com>
  • Loading branch information
Zeeshan Lakhani and bgins committed Feb 5, 2024
1 parent d553832 commit e0bb469
Show file tree
Hide file tree
Showing 26 changed files with 809 additions and 121 deletions.
52 changes: 49 additions & 3 deletions .github/workflows/tests_and_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run-checks:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.examples == 'true' }}
if: ${{ needs.changes.outputs.rust == 'true' }}
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
env:
RUSTFLAGS: -Dwarnings -Ctarget-feature=+crt-static
RUSTFLAGS: -Dwarnings -Ctarget-feature=+crt-static
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -262,6 +262,9 @@ jobs:
run-cargo-tests:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
runs-on: ubuntu-latest
steps:
- name: Setup IPFS
Expand All @@ -283,11 +286,14 @@ jobs:
shared-key: test-all-stable-ubuntu-latest
save-if: ${{ github.event_name == 'push' }}

- name: Sccache
uses: mozilla-actions/sccache-action@v0.0.3

- name: Run Tests (all-features)
run: cargo test --workspace --all-features

run-docs:
needs: changes
needs: [changes]
if: ${{ needs.changes.outputs.rust == 'true' }}
env:
SCCACHE_GHA_ENABLED: "true"
Expand All @@ -306,6 +312,7 @@ jobs:
- name: Cache Project
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
shared-key: doc
save-if: ${{ github.event_name == 'push' }}

Expand All @@ -316,3 +323,42 @@ jobs:
env:
RUSTDOCFLAGS: -Dwarnings
run: cargo doc --workspace --document-private-items

build-and-run-examples:
needs: changes
if: ${{ needs.changes.outputs.examples == 'true' }}
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
runs-on: ubuntu-latest
steps:
- name: Setup IPFS
uses: ibnesayeed/setup-ipfs@master
with:
run_daemon: false

- name: Checkout Repository
uses: actions/checkout@v4

- name: Use mold-linker
uses: rui314/setup-mold@v1

- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Cache Project
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
shared-key: cargo-examples
save-if: ${{ github.event_name == 'push' }}

- name: Sccache
uses: mozilla-actions/sccache-action@v0.0.3

- name: Build example-websocket-relay
run: cargo build -p websocket-relay

- name: Run example-websocket-relay
shell: bash
run: timeout 10s cargo run -p websocket-relay || true
76 changes: 74 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 33 additions & 26 deletions examples/websocket-relay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ To get started, please install:

## Usage

1. Run `cargo run -- start` to start the runtime and an IPFS daemon as a
1. Run `cargo run` to start the runtime and an IPFS daemon as a
background process. This runtime includes ANSI-coded logging by default.

2. In a separate terminal window, run `npm install --prefix relay-app` to
Expand All @@ -61,38 +61,45 @@ if they've been previously run.

## Tips & Common Issues

On macOS, for example, a simple homebrew install would install everything you
need: `brew install rust npm ipfs`
- On macOS, for example, a simple homebrew install would install everything you
need: `brew install rust npm ipfs`.

We have packaged homestar binaries using brew, so
`brew install fission-codes/fission/homestar` will install everything you need,
including `ipfs`. You will still need `npm` to run this example. From this folder,
you can then run the example like this:
- Running `homestar` using `cargo run` requires a minimum Rust version of
`1.73.0`. If you've got an older version of rust, update it with
`rustup update`.

```
homestar start --db homestar.db
```
- You do not have to start Kubo (IPFS) on your own. The example will do this
for you, and use `examples/websocket-relay/tmp/.ipfs` as a local blockstore.
Feel free to discard it when you don't need it.

Running `homestar` via `cargo run` requires a minimum Rust version of
`1.73.0`. If you've got an older install of rust, update it with
`rustup update`.
- If you're already running an IPFS instance, for example [IPFS Desktop][ipfs-desktop],
the application will check for it and not start a new, local one.
However, the application expects a default IPFS host and port. The expected
IPFS `host` and `port` can be updated in the `homestar` network settings:

You do not have to start Kubo (IPFS) on your own. The example will do this
for you, and use `examples/websocket-relay/tmp/.ipfs` as a local blockstore.
Feel free to discard it when you don't need it.
``` toml
[node]

If you're already running an IPFS instance, for example [IPFS Desktop][ipfs-desktop],
the application will check for it and not start a new, local one.
However, the application expects a default IPFS host and port. The expected
IPFS `host` and `port` can be updated in the `homestar` network settings:
[node.network.ipfs]
host = "127.0.0.1"
port = 5001
```

``` toml
[node]
- We have officially packaged homestar binaries using brew, so
`brew install fission-codes/fission/homestar` will install mostly everything
you need, including `ipfs`. You will still need `npm` to run this example, and
you'll have to manually `ipfs add` the `synthcat.png` and `example_test.wasm`
files located in this directory. Then, from this folder, you can run the
example like this:

```
homestar start --db homestar.db
```

Afterward, run `npm install --prefix relay-app` to install dependencies
and `npm run --prefix relay-app dev` to start the relay web
application (UI) on `http://localhost:5173/` by default.

[node.network.ipfs]
host = "127.0.0.1"
port = 5001
```

[@fission-codes/homestar]: https://www.npmjs.com/package/@fission-codes/homestar
[install-ipfs]: https://docs.ipfs.tech/install/
Expand Down
Loading

0 comments on commit e0bb469

Please sign in to comment.