sipsorcery / webrtc-echoes

Simple useful interoperability tests for WebRTC libraries. If you are a WebRTC library developer we'd love to include you!
173 stars 17 forks source link

[webrtc-rs] add webrtc-rs echo client/server #41

Closed rainliu closed 3 years ago

rainliu commented 3 years ago

https://webrtc.rs/ is a pure Rust implementation of WebRTC stack, which rewrites Pion WebRTC stack in Rust.

Now webrtc-rs is very close to reach its first v0.1.0 release. We'd like to join the interop tests with other implmementation.

This PR is to add webrtc-rs echo client/server. I have verified the interop test with Pion's echo client/server locally.

But I have no idea how to write docker file to test with other webrtc implementation. Help needed.

Thanks.

sipsorcery commented 3 years ago

If you can give me the steps to build the webrtc-rs/client I can put together a docker file using the rust image.

Am I correct in thinking that once built rust executables are the same as C & C++ and don't require any runtime? The rust docker image is 1.25GB so ideally it gets used for the build but then the image that runs the resultant binary can be a much smaller ubuntu image.

rainliu commented 3 years ago

If you can give me the steps to build the webrtc-rs/client I can put together a docker file using the rust image.

Am I correct in thinking that once built rust executables are the same as C & C++ and don't require any runtime? The rust docker image is 1.25GB so ideally it gets used for the build but then the image that runs the resultant binary can be a much smaller ubuntu image.

The client/server build step are provided in the files of commit: webrtc-rs/client/README.md webrtc-rs/server/README.md

rainliu commented 3 years ago

Am I correct in thinking that once built rust executables are the same as C & C++ and don't require any runtime? The rust docker image is 1.25GB so ideally it gets used for the build but then the image that runs the resultant binary can be a much smaller ubuntu image.

yes, rust executable shouldn't require any runtime.

rainliu commented 3 years ago

by the way, why all Github Actions failed? This PR doesn't touch other files.

sipsorcery commented 3 years ago

A suggested dockerfile is:

FROM rust:latest AS build
WORKDIR /src
COPY ["webrtc-rs", ""]
RUN cd /src/server; cargo build
RUN cd /src/client; cargo build

FROM ubuntu:latest AS final
WORKDIR /app
EXPOSE 8080
COPY ["html", "../html/"]
COPY ["./webrtc-rs/client.sh", "/client.sh"]
RUN chmod +x /client.sh
COPY --from=build /src/client/target/debug/client .
COPY --from=build /src/server/target/debug/server .
ENTRYPOINT ["./server"]

I did a quick test of the resulting image with my sipsorcery client and it worked;

docker run --rm -it -p 8080:8080 webrtc-rs:0.1
Listening on 0.0.0.0:8080...
Signaling state PeerConnection-1632660068237171400 has changed to have-remote-offer.
Signaling state PeerConnection-1632660068237171400 has changed to stable.
ICE connection PeerConnection-1632660068237171400 state has changed to checking.
ICE connection PeerConnection-1632660068237171400 state has changed to connected.
Peer connection PeerConnection-1632660068237171400 state has changed to connected.
ICE connection PeerConnection-1632660068237171400 state has changed to disconnected.
Peer connection PeerConnection-1632660068237171400 state has changed to disconnected.
ICE connection PeerConnection-1632660068237171400 state has changed to failed.
Peer connection PeerConnection-1632660068237171400 state has changed to failed.
Peer Connection PeerConnection-1632660068237171400 is closing
ICE connection PeerConnection-1632660068237171400 state has changed to closed.
Peer connection PeerConnection-1632660068237171400 state has changed to closed.
Peer Connection PeerConnection-1632660068237171400 is closed
Peer Connection PeerConnection-1632660068237171400 is removed from PCS

I don't mind adding the dockerfile if you don't want to. I can do so once you merge your PR.

rainliu commented 3 years ago

A suggested dockerfile is:

FROM rust:latest AS build
WORKDIR /src
COPY ["webrtc-rs", ""]
RUN cd /src/server; cargo build
RUN cd /src/client; cargo build

FROM ubuntu:latest AS final
WORKDIR /app
EXPOSE 8080
COPY ["html", "../html/"]
COPY ["./webrtc-rs/client.sh", "/client.sh"]
RUN chmod +x /client.sh
COPY --from=build /src/client/target/debug/client .
COPY --from=build /src/server/target/debug/server .
ENTRYPOINT ["./server"]

I did a quick test of the resulting image with my sipsorcery client and it worked;

docker run --rm -it -p 8080:8080 webrtc-rs:0.1
Listening on 0.0.0.0:8080...
Signaling state PeerConnection-1632660068237171400 has changed to have-remote-offer.
Signaling state PeerConnection-1632660068237171400 has changed to stable.
ICE connection PeerConnection-1632660068237171400 state has changed to checking.
ICE connection PeerConnection-1632660068237171400 state has changed to connected.
Peer connection PeerConnection-1632660068237171400 state has changed to connected.
ICE connection PeerConnection-1632660068237171400 state has changed to disconnected.
Peer connection PeerConnection-1632660068237171400 state has changed to disconnected.
ICE connection PeerConnection-1632660068237171400 state has changed to failed.
Peer connection PeerConnection-1632660068237171400 state has changed to failed.
Peer Connection PeerConnection-1632660068237171400 is closing
ICE connection PeerConnection-1632660068237171400 state has changed to closed.
Peer connection PeerConnection-1632660068237171400 state has changed to closed.
Peer Connection PeerConnection-1632660068237171400 is closed
Peer Connection PeerConnection-1632660068237171400 is removed from PCS

I don't mind adding the dockerfile if you don't want to. I can do so once you merge your PR.

Thank you for your help. Could you please add docerfile for webrtc-rs and also add it for auto-interop tests?