Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/downloader-next
Browse files Browse the repository at this point in the history
  • Loading branch information
Frando committed Apr 19, 2024
2 parents a9572fc + 5873a55 commit d57325b
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 20 deletions.
8 changes: 4 additions & 4 deletions .github/ansible/redeploy-relay.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
tasks:
- name: Fetch iroh-relay binary
get_url:
url: https://vorc.s3.us-east-2.amazonaws.com/derper-linux-amd64-{{ derper_version }}
url: https://vorc.s3.us-east-2.amazonaws.com/iroh-relay-linux-amd64-{{ relay_version }}
mode: '0755'
force: yes
dest: /usr/local/bin/derper
dest: /usr/local/bin/iroh-relay
- name: Allow ports
shell:
cmd: sudo setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/derper
cmd: sudo setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/iroh-relay
- name: Make sure iroh-relay is started
ansible.builtin.systemd:
state: restarted
enabled: yes
name: derper
name: iroh-relay
5 changes: 5 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

<!-- A summary of what this pull request achieves and a rough list of changes. -->

## Breaking Changes

<!-- Optional, if there are any breaking changes document them, including how to migrate older code. -->

## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the PR. -->
Expand All @@ -11,3 +15,4 @@
- [ ] Self-review.
- [ ] Documentation updates if relevant.
- [ ] Tests if relevant.
- [ ] All breaking changes documented.
35 changes: 33 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,37 @@ jobs:
env:
RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG' }}


check_semver:
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "on"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.4

- name: Setup Environment (PR)
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
echo "HEAD_COMMIT_SHA=$(git rev-parse origin/${{ github.base_ref }})" >> ${GITHUB_ENV}
- name: Setup Environment (Push)
if: ${{ github.event_name == 'push' || github.event_name == 'merge_group' }}
shell: bash
run: |
echo "HEAD_COMMIT_SHA=$(git rev-parse origin/main" >> ${GITHUB_ENV}
- name: Check semver
# uses: obi1kenobi/cargo-semver-checks-action@v2
uses: n0-computer/cargo-semver-checks-action@feat-baseline
with:
package: iroh, iroh-base, iroh-bytes, iroh-cli, iroh-dns-server, iroh-gossip, iroh-metrics, iroh-net, iroh-sync
baseline-rev: ${{ env.HEAD_COMMIT_SHA }}
use-cache: false

check_fmt_and_docs:
timeout-minutes: 30
name: Checking fmt and docs
Expand Down Expand Up @@ -192,7 +223,7 @@ jobs:
- name: Copy binaries to right location
run: |
cp target/release/iroh ../chuck/netsim/bins/iroh
cp target/release/iroh-relay ../chuck/netsim/bins/derper
cp target/release/iroh-relay ../chuck/netsim/bins/iroh-relay
cp ../chuck/target/release/chuck ../chuck/netsim/bins/chuck
- name: Run tests
Expand All @@ -204,7 +235,7 @@ jobs:
sudo python3 main.py ${{ runner.debug && '--debug' || ''}} --integration sims/integration
- name: Cleanup
run: |
sudo kill -9 $(pgrep derper) || true
sudo kill -9 $(pgrep iroh-relay) || true
sudo kill -9 $(pgrep iroh) || true
sudo kill -9 $(pgrep ovs) || true
sudo mn --clean || true
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ jobs:
- name: check-for-cc
id: check-for-cc
uses: agenthunt/conventional-commit-checker-action@v1.0.0
with:
pr-title-regex: "^(.+)(?:(([^)s]+)))?!?: (.+)"
4 changes: 2 additions & 2 deletions .github/workflows/netsim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
- name: Copy binaries to right location
run: |
cp target/optimized-release/iroh ../chuck/netsim/bins/iroh
cp target/optimized-release/iroh-relay ../chuck/netsim/bins/derper
cp target/optimized-release/iroh-relay ../chuck/netsim/bins/iroh-relay
cp ../chuck/target/release/chuck ../chuck/netsim/bins/chuck
- name: Detect comment commands
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
- name: Cleanup
run: |
sudo kill -9 $(pgrep derper) || true
sudo kill -9 $(pgrep iroh-relay) || true
sudo kill -9 $(pgrep iroh) || true
sudo kill -9 $(pgrep ovs) || true
sudo mn --clean || true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ jobs:
if: matrix.os != 'windows-latest'
run: |
aws s3 cp ./target/optimized-release/iroh s3://vorc/iroh-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
aws s3 cp ./target/optimized-release/iroh-relay s3://vorc/derper-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
aws s3 cp ./target/optimized-release/iroh-relay s3://vorc/iroh-relay-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
aws s3 cp ./target/optimized-release/iroh-dns-server s3://vorc/iroh-dns-server-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
- name: push release latest
if: matrix.os != 'windows-latest'
run: |
aws s3 cp ./target/optimized-release/iroh s3://vorc/iroh-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
aws s3 cp ./target/optimized-release/iroh-relay s3://vorc/derper-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
aws s3 cp ./target/optimized-release/iroh-relay s3://vorc/iroh-relay-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
aws s3 cp ./target/optimized-release/iroh-dns-server s3://vorc/iroh-dns-server-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
4 changes: 2 additions & 2 deletions .github/workflows/test_relay_server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: push release
run: |
aws s3 cp ./target/release/iroh-relay s3://vorc/derper-linux-amd64-${GITHUB_SHA::7} --no-progress
aws s3 cp ./target/release/iroh-relay s3://vorc/iroh-relay-linux-amd64-${GITHUB_SHA::7} --no-progress
- name: Set iroh-relay tag
id: set_tag
Expand All @@ -72,4 +72,4 @@ jobs:
key: ${{ secrets.TEST_DERPER_SSH_PKEY }}
inventory: ${{ secrets.TEST_DERPER_INVENTORY }}
known_hosts: ${{ secrets.TEST_DERPER_KNOWN_HOSTS }}
options: --extra-vars ansible_ssh_user=root --extra-vars derper_version=${{ needs.build_derper.outputs.set_tag.tag }}
options: --extra-vars ansible_ssh_user=root --extra-vars relay_version=${{ needs.build_relay_server.outputs.set_tag.tag }}
15 changes: 11 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Here are some of the ways in which you can contribute:

## Discussions

If you want to ask a question to understand a concept regarding Iroh, or need help working with Iroh, please check the [Discussions][discussions]. If you don't find a thread that fits your needs, feel free to create a new one.
If you want to ask a question to understand a concept regarding Iroh, or need help working with Iroh, please check the [Discussions][discussions]. If you don't find a thread that fits your needs, feel free to create a new one.

## Issues

Expand All @@ -21,7 +21,7 @@ If you would like to suggest a new feature in Iroh, [create a new issue][newissu
Code contributions to Iroh are greatly appreciated. Here is the general workflow you should follow:

1. **State in the associated issue your desire to work on it**

If there is no issue for the work you would like to do, please open one. This helps reduce duplicated efforts and give contributors the help and guidance they might need.

2. **Write some code!**
Expand All @@ -38,7 +38,7 @@ Code contributions to Iroh are greatly appreciated. Here is the general workflow
- Comment your code. It will be useful for your reviewer and future contributors.

- **Pull request titles**

- Iroh pull requests titles look like this: `type(crate): description`

| **`type`** | **When to use** |
Expand All @@ -52,11 +52,13 @@ Code contributions to Iroh are greatly appreciated. Here is the general workflow
| `deps` | Dependency only updates |
| `chore` | Changes to the build process or auxiliary tools and libraries |


**`crate`** is the rust crate containing your changes.

**`description`** is a short sentence that summarizes your changes.

If there is a breaking change please use a `!` in the commit message to denote this, eg. `feat(iroh)!: break the world`.

- **Pull request descriptions**

Once you open a pull request, you will be prompted to follow a template with three simple parts:
Expand All @@ -65,6 +67,10 @@ Code contributions to Iroh are greatly appreciated. Here is the general workflow

A summary of what your pull request achieves and a rough list of changes.

- **Breaking Changes**

Optional, if there are any breaking changes document them, including how to migrate older code.

- **Notes & open questions**

Notes, open questions and remarks about your changes.
Expand All @@ -74,6 +80,7 @@ Code contributions to Iroh are greatly appreciated. Here is the general workflow
- **Self review**: We ask you to thoroughly review your changes until you are happy with them. This helps speed up the review process.
- **Add documentation**: If your change requires documentation updates, make sure they are properly added.
- **Tests**: If your code creates a new feature, when possible add tests for this. If they fix a bug, a regression test is recommended as well.
- **Breaking Changes**: All breaking changes need to be documented.


4. **Review process**
Expand Down
5 changes: 4 additions & 1 deletion iroh-bytes/src/downloader/test.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#![cfg(test)]
use anyhow::anyhow;
use futures::FutureExt;
use std::{sync::atomic::AtomicUsize, time::{Duration, Instant}};
use std::{
sync::atomic::AtomicUsize,
time::{Duration, Instant},
};

use iroh_net::key::SecretKey;

Expand Down
16 changes: 13 additions & 3 deletions iroh-net/src/discovery/pkarr_publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use tokio::{
task::JoinHandle,
time::{Duration, Instant},
};
use tracing::{debug, info, warn};
use tracing::{debug, error_span, info, warn, Instrument};
use url::Url;
use watchable::{Watchable, Watcher};

Expand Down Expand Up @@ -69,7 +69,11 @@ impl PkarrPublisher {
pkarr_client,
republish_interval,
};
let join_handle = tokio::task::spawn(service.run());
let join_handle = tokio::task::spawn(
service
.run()
.instrument(error_span!("pkarr_publish", me=%node_id.fmt_short())),
);
Self {
watchable,
node_id,
Expand Down Expand Up @@ -153,7 +157,13 @@ impl PublisherService {
}

async fn publish_current(&self, info: NodeInfo) -> Result<()> {
info!("Publish node info to pkarr");
info!(
relay_url = ?info
.relay_url
.as_ref()
.map(|s| s.as_str()),
"Publish node info to pkarr"
);
let signed_packet = info.to_pkarr_signed_packet(&self.secret_key, self.ttl)?;
self.pkarr_client.publish(&signed_packet).await?;
Ok(())
Expand Down

0 comments on commit d57325b

Please sign in to comment.