streamlit-webrtc icon indicating copy to clipboard operation
streamlit-webrtc copied to clipboard

Support docker

Open whitphx opened this issue 4 years ago • 4 comments

It seems aiortc currently does not support port range configuration because aioice, aiortc's dependency, lacks that fucntionality: https://github.com/aiortc/aioice/blob/ed002999545cb1fee35eb372cb3df64c24652c9d/src/aioice/ice.py#L789

whitphx avatar Jan 10 '21 17:01 whitphx

https://github.com/aiortc/aioice/issues/2

whitphx avatar Jan 12 '21 14:01 whitphx

For docker you can use sysctl tcp port range:

    sysctls:
      net.ipv4.ip_local_port_range: "40000 40010"

stalkerg avatar Dec 28 '21 04:12 stalkerg

Thank you, this must be helpful info!

whitphx avatar Feb 13 '22 08:02 whitphx

The app seems to work on Docker in my env (m1 mac) wIthout configuring net.ipv4.ip_local_port_range... 🤔

Docker command to run:

	docker run \
		--rm \
		-it \
		-p 8501:8501 \
		-v `pwd`:/srv \
		streamlit-webrtc \
		poetry run streamlit run app.py

The log which shows the port 55453, which is not bound to the container, is used for signaling.

[2022-03-28 14:24:41,560]   DEBUG from streamlit_webrtc.webrtc in /srv/streamlit_webrtc/webrtc.py:407: _process_offer_thread_impl starts
[2022-03-28 14:24:42,660]    INFO from streamlit_webrtc.webrtc in /srv/streamlit_webrtc/webrtc.py:94: Track video received
[2022-03-28 14:24:42,661]    INFO from streamlit_webrtc.webrtc in /srv/streamlit_webrtc/webrtc.py:134: Set <aiortc.rtcrtpreceiver.RemoteStreamTrack object at 0x407dbcf730> as an input video track with video_processor <class 'streamlit_webrtc.process.AsyncVideoProcessTrack'>
[2022-03-28 14:24:42,662]    INFO from streamlit_webrtc.webrtc in /srv/streamlit_webrtc/webrtc.py:149: Add a track <streamlit_webrtc.process.AsyncVideoProcessTrack object at 0x407dbcd160> of kind video to <aiortc.rtcpeerconnection.RTCPeerConnection object at 0x40320ae7c0>
[2022-03-28 14:24:42,687]    INFO from aioice.ice in /root/.cache/pypoetry/virtualenvs/streamlit-webrtc-o9msT97p-py3.9/lib/python3.9/site-packages/aioice/ice.py:1061: Connection(1) Check CandidatePair(('172.17.0.2', 55453) -> ('192.168.3.3', 57620)) State.FROZEN -> State.WAITING
[2022-03-28 14:24:42,687]    INFO from aioice.ice in /root/.cache/pypoetry/virtualenvs/streamlit-webrtc-o9msT97p-py3.9/lib/python3.9/site-packages/aioice/ice.py:1061: Connection(1) Check CandidatePair(('172.17.0.2', 55453) -> ('192.168.3.8', 57781)) State.FROZEN -> State.WAITING
[2022-03-28 14:24:42,766]    INFO from streamlit_webrtc.webrtc in /srv/streamlit_webrtc/webrtc.py:472: ICE connection state is checking
[2022-03-28 14:24:42,767]    INFO from aioice.ice in /root/.cache/pypoetry/virtualenvs/streamlit-webrtc-o9msT97p-py3.9/lib/python3.9/site-packages/aioice/ice.py:1061: Connection(1) Check CandidatePair(('172.17.0.2', 55453) -> ('192.168.3.3', 57620)) State.WAITING -> State.IN_PROGRESS
[2022-03-28 14:24:43,923]    INFO from aioice.ice in /root/.cache/pypoetry/virtualenvs/streamlit-webrtc-o9msT97p-py3.9/lib/python3.9/site-packages/aioice/ice.py:1061: Connection(1) Check CandidatePair(('172.17.0.2', 55453) -> ('192.168.3.8', 57781)) State.WAITING -> State.IN_PROGRESS
[2022-03-28 14:24:43,924]    INFO from aioice.ice in /root/.cache/pypoetry/virtualenvs/streamlit-webrtc-o9msT97p-py3.9/lib/python3.9/site-packages/aioice/ice.py:1061: Connection(1) Check CandidatePair(('172.17.0.2', 55453) -> ('192.168.3.3', 57620)) State.IN_PROGRESS -> State.SUCCEEDED
[2022-03-28 14:24:43,924]    INFO from aioice.ice in /root/.cache/pypoetry/virtualenvs/streamlit-webrtc-o9msT97p-py3.9/lib/python3.9/site-packages/aioice/ice.py:1061: Connection(1) Check CandidatePair(('172.17.0.2', 55453) -> ('my.global.ip.address', 57620)) State.FROZEN -> State.WAITING
[2022-03-28 14:24:43,925]    INFO from aioice.ice in /root/.cache/pypoetry/virtualenvs/streamlit-webrtc-o9msT97p-py3.9/lib/python3.9/site-packages/aioice/ice.py:1061: Connection(1) Check CandidatePair(('172.17.0.2', 55453) -> ('my.global.ip.address', 57781)) State.FROZEN -> State.WAITING
[2022-03-28 14:24:43,929]    INFO from aioice.ice in /root/.cache/pypoetry/virtualenvs/streamlit-webrtc-o9msT97p-py3.9/lib/python3.9/site-packages/aioice/ice.py:1061: Connection(1) Check CandidatePair(('172.17.0.2', 55453) -> ('192.168.3.8', 57781)) State.IN_PROGRESS -> State.SUCCEEDED
[2022-03-28 14:24:43,945]    INFO from aioice.ice in /root/.cache/pypoetry/virtualenvs/streamlit-webrtc-o9msT97p-py3.9/lib/python3.9/site-packages/aioice/ice.py:1061: Connection(1) Check CandidatePair(('172.17.0.2', 55453) -> ('my.global.ip.address', 57620)) State.WAITING -> State.IN_PROGRESS
[2022-03-28 14:24:43,972]    INFO from aioice.ice in /root/.cache/pypoetry/virtualenvs/streamlit-webrtc-o9msT97p-py3.9/lib/python3.9/site-packages/aioice/ice.py:1061: Connection(1) Check CandidatePair(('172.17.0.2', 55453) -> ('my.global.ip.address', 57781)) State.WAITING -> State.IN_PROGRESS
[2022-03-28 14:24:43,977]    INFO from aioice.ice in /root/.cache/pypoetry/virtualenvs/streamlit-webrtc-o9msT97p-py3.9/lib/python3.9/site-packages/aioice/ice.py:1061: Connection(1) ICE completed
[2022-03-28 14:24:44,037]    INFO from streamlit_webrtc.webrtc in /srv/streamlit_webrtc/webrtc.py:472: ICE connection state is completed

whitphx avatar Mar 28 '22 14:03 whitphx