Skip to content

Commit

Permalink
[HOTFIX] Fix installation with python-xlib (#59)
Browse files Browse the repository at this point in the history
* [HOTFIX] Fix installation with python-xlib

* Polishing the documentation
  • Loading branch information
ehfd authored Sep 29, 2022
1 parent 5ac0ffc commit fe81be5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
7 changes: 4 additions & 3 deletions Dockerfile.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RUN \
python3-dev \
python3-gi \
python3-setuptools \
python3-tk \
python3-wheel \
tzdata \
sudo \
Expand Down Expand Up @@ -95,17 +96,17 @@ RUN \
-e "s|PWA_CACHE|${PWA_APP_SHORT_NAME}-webrtc-pwa|g" \
/opt/gst-web/sw.js

# Install selkies-gstreamer python app
# Install selkies-gstreamer Python app
ARG PYPI_PACKAGE=selkies_gstreamer
ARG PACKAGE_VERSION=1.0.0.dev0
COPY --from=selkies-build /opt/pypi/dist/${PYPI_PACKAGE}-${PACKAGE_VERSION}-py3-none-any.whl .
RUN pip3 install /opt/${PYPI_PACKAGE}-${PACKAGE_VERSION}-py3-none-any.whl

# TODO: required for remote-cursor support. Only works with python>3.7, no ubuntu18.04 support.
# Remove this and uncommend line in setup.cfg after this PR is merged and in release:
# Remove this and uncomment line in setup.cfg after this PR is merged and in release:
# https://github.com/python-xlib/python-xlib/pull/218
RUN if [ "${UBUNTU_RELEASE}" != "18.04" ] ; then \
pip3 install --upgrade --force-reinstall https://github.com/python-xlib/python-xlib/archive/master.zip ; fi
pip3 install --upgrade --force-reinstall https://github.com/python-xlib/python-xlib/archive/e8cf018.zip ; fi

# Setup global bashrc to configure gstreamer environment
RUN echo 'export DISPLAY=:0' \
Expand Down
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Repositories [`selkies-vdi`](https://github.com/selkies-project/selkies-vdi) or
1. Install the dependencies, for Ubuntu or Debian-based distros run this command:

```bash
sudo apt-get update && sudo apt-get install --no-install-recommends -y adwaita-icon-theme-full build-essential python3-pip python3-dev python3-gi python3-setuptools python3-wheel tzdata sudo udev xclip x11-utils xdotool wmctrl jq gdebi-core x11-xserver-utils xserver-xorg-core libopus0 libgdk-pixbuf2.0-0 libsrtp2-1 libxdamage1 libxml2-dev libwebrtc-audio-processing1 libcairo-gobject2 pulseaudio libpulse0 libpangocairo-1.0-0 libgirepository1.0-dev libjpeg-dev zlib1g-dev x264
sudo apt-get update && sudo apt-get install --no-install-recommends -y adwaita-icon-theme-full build-essential python3-pip python3-dev python3-gi python3-setuptools python3-tk python3-wheel tzdata sudo udev xclip x11-utils xdotool wmctrl jq gdebi-core x11-xserver-utils xserver-xorg-core libopus0 libgdk-pixbuf2.0-0 libsrtp2-1 libxdamage1 libxml2-dev libwebrtc-audio-processing1 libcairo-gobject2 pulseaudio libpulse0 libpangocairo-1.0-0 libgirepository1.0-dev libjpeg-dev zlib1g-dev x264
```

Additionally, install `xcvt` if using Ubuntu 22.04 or an equivalent version of another operating system:
Expand All @@ -67,21 +67,21 @@ sudo apt-get update && sudo apt-get install --no-install-recommends -y xcvt
2. Unpack the GStreamer components of `selkies-gstreamer` (fill in `SELKIES_VERSION` and `OS_VERSION`), using your own GStreamer build may work **as long as it is the most recent version**, but is not guaranteed:

```bash
cd /opt && curl -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-gstreamer-v${SELKIES_VERSION}-${OS_VERSION}.tgz" | sudo tar -zxf -
cd /opt && curl -fsSL https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-gstreamer-v${SELKIES_VERSION}-${OS_VERSION}.tgz | sudo tar -zxf -
```

This will install the GStreamer components to the default directory of `/opt/gstreamer`. If you are unpacking to a different directory, make sure to set the directory to the environment variable `GSTREAMER_PATH`.

3. Install the Python components of `selkies-gstreamer` (this component is pure Python and any operating system is compatible, fill in `SELKIES_VERSION`):

```bash
cd /tmp && curl -O -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl" && sudo pip3 install "selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl" && rm -f "selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl" && sudo pip3 install --upgrade --force-reinstall "https://github.com/python-xlib/python-xlib/archive/master.zip"
cd /tmp && curl -O -fsSL https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl && sudo pip3 install selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl && rm -f selkies_gstreamer-${SELKIES_VERSION}-py3-none-any.whl && sudo pip3 install --upgrade --force-reinstall https://github.com/python-xlib/python-xlib/archive/e8cf018.zip
```

4. Unpack the HTML5 components of `selkies-gstreamer`:

```bash
cd /opt && curl -fsSL "https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-gstreamer-web-v${SELKIES_VERSION}.tgz" | sudo tar -zxf -
cd /opt && curl -fsSL https://github.com/selkies-project/selkies-gstreamer/releases/download/v${SELKIES_VERSION}/selkies-gstreamer-web-v${SELKIES_VERSION}.tgz | sudo tar -zxf -
```

This will install the HTML5 components to the default directory of `/opt/gst-web`. If you are unpacking to a different directory, make sure to set the directory to the environment variable `WEB_ROOT` or add the command-line option `--web_root` to `selkies-gstreamer`.
Expand Down Expand Up @@ -143,7 +143,7 @@ Docker (or an equivalent) is required if you are to use builds from the latest c
1. Install the dependencies, for Ubuntu or Debian-based distros run this command:

```bash
sudo apt-get update && sudo apt-get install --no-install-recommends -y adwaita-icon-theme-full build-essential python3-pip python3-dev python3-gi python3-setuptools python3-wheel tzdata sudo udev xclip x11-utils xdotool wmctrl jq gdebi-core x11-xserver-utils xserver-xorg-core libopus0 libgdk-pixbuf2.0-0 libsrtp2-1 libxdamage1 libxml2-dev libwebrtc-audio-processing1 libcairo-gobject2 pulseaudio libpulse0 libpangocairo-1.0-0 libgirepository1.0-dev libjpeg-dev zlib1g-dev x264
sudo apt-get update && sudo apt-get install --no-install-recommends -y adwaita-icon-theme-full build-essential python3-pip python3-dev python3-gi python3-setuptools python3-tk python3-wheel tzdata sudo udev xclip x11-utils xdotool wmctrl jq gdebi-core x11-xserver-utils xserver-xorg-core libopus0 libgdk-pixbuf2.0-0 libsrtp2-1 libxdamage1 libxml2-dev libwebrtc-audio-processing1 libcairo-gobject2 pulseaudio libpulse0 libpangocairo-1.0-0 libgirepository1.0-dev libjpeg-dev zlib1g-dev x264
```

Additionally, install `xcvt` if using Ubuntu 22.04 or an equivalent version of another operating system:
Expand All @@ -170,6 +170,7 @@ docker create --name selkies-py ghcr.io/selkies-project/selkies-gstreamer/py-bui
docker cp selkies-py:/opt/pypi/dist/selkies_gstreamer_disla-1.0.0rc0-py3-none-any.whl /opt/selkies_gstreamer_disla-1.0.0rc0-py3-none-any.whl
docker rm selkies-py
python3 -m pip install /opt/selkies_gstreamer_disla-1.0.0rc0-py3-none-any.whl
python3 -m pip install --upgrade --force-reinstall https://github.com/python-xlib/python-xlib/archive/e8cf018.zip
```

4. Install the HTML5 components to the container image:
Expand Down Expand Up @@ -232,9 +233,9 @@ selkies-gstreamer &

### Usage

#### Locking the cursor
#### Locking the cursor and fullscreen mode

The cursor can be locked into the web interface using `Control + Shift + Left Click` in web browsers supporting the Pointer Lock API. This is useful for most games or graphics applications where the cursor must be confined to the remote screen.
The cursor can be locked into the web interface using `Control + Shift + Left Click` in web browsers supporting the Pointer Lock API. This is useful for most games or graphics applications where the cursor must be confined to the remote screen. The fullscreen mode is available with the shortcut `Control + Shift + F`.

#### Command-line options and environment variables

Expand Down Expand Up @@ -298,7 +299,7 @@ In most cases when either of your server or client does not have a restrictive f

An open-source TURN server for Linux or UNIX-like operating systems that may be used is [coTURN](https://github.com/coturn/coturn), available in major package repositories or as an example container [`coturn/coturn:latest`](https://hub.docker.com/r/coturn/coturn). Alternatively, the `selkies-gstreamer` [`coturn`](addons/coturn) and [`coturn-web`](addons/coturn-web) images [`ghcr.io/selkies-project/selkies-gstreamer/coturn`](https://github.com/selkies-project/selkies-gstreamer/pkgs/container/selkies-gstreamer%2Fcoturn) and [`ghcr.io/selkies-project/selkies-gstreamer/coturn-web`](https://github.com/selkies-project/selkies-gstreamer/pkgs/container/selkies-gstreamer%2Fcoturn-web) are also included in this repository, and may be used to host your own STUN/TURN infrastructure.

For all other major operating systems including Windows, [Pion TURN](https://github.com/pion/turn)'s `turn-server-simple` executable or [eturnal](https://eturnal.net) are recommended alternative TURN server implementations.
For all other major operating systems including Windows, [Pion TURN](https://github.com/pion/turn)'s `turn-server-simple` executable or [eturnal](https://eturnal.net) are recommended alternative TURN server implementations. [STUNner](https://github.com/l7mp/stunner) is a Kubernetes native STUN and TURN deployment if Helm is possible to be used.

#### Install and run coTURN on a standalone machine or cloud instance

Expand Down Expand Up @@ -328,6 +329,8 @@ More information available in the [coTURN container image](https://hub.docker.co

#### Deploy coTURN With Kubernetes

Before you read, [STUNner](https://github.com/l7mp/stunner) is a pretty good method to deploy a TURN or STUN server on Kubernetes if you are able to use Helm.

You are recommended to use a `ConfigMap` for creating the configuration file for coTURN. Use the [example coTURN configuration](https://github.com/coturn/coturn/blob/master/examples/etc/turnserver.conf) as a reference to create a `ConfigMap` which mounts to `/etc/turnserver.conf`. The only mandatory lines are either `use-auth-secret` and `static-auth-secret=(PUT RANDOM 64 BYTE BASE64 KEY HERE)` or `lt-cred-mech` and `user=yourusername:yourpassword`, but specifying `min-port=` and `max-port=` are strongly recommended to restrict the range of the relay ports.

Use `Deployment` or `DaemonSet` and use `containerPort` and `hostPort` under `ports:` to open the listening port 3478 (or any other port you set in `/etc/turnserver.conf` with `listening-port=`).
Expand Down Expand Up @@ -384,14 +387,14 @@ This step is required when you want to test your TURN server configured with a s
docker-compose run --service-ports test
```

2. From inside the test container, source the gst-env and call the `generate_rtc_config` method.
2. From inside the test container, source `gst-env` and call the `generate_rtc_config` method.

```bash
source /opt/gstreamer/gst-env

export TURN_HOST="your turn host"
export TURN_PORT="your turn port"
export TURN_SECRET="your shared secret"
export TURN_HOST="Your TURN Host"
export TURN_PORT="Your TURN Port"
export TURN_SECRET="Your Shared Secret"
export TURN_USER="user"

python3 -c 'import os;from selkies_gstreamer.signalling_web import generate_rtc_config; print(generate_rtc_config(os.environ["TURN_HOST"], os.environ["TURN_PORT"], os.environ["TURN_SECRET"], os.environ["TURN_USER"]))'
Expand Down

0 comments on commit fe81be5

Please sign in to comment.