Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add handling of dns multiaddrs + bootstrapping + CLI / Conn changes #547

Merged
merged 6 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/[email protected]

- 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/[email protected]

- 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 `https://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
Loading