-
Notifications
You must be signed in to change notification settings - Fork 509
Docker compose for recording server #9177
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
Merged
danxuliu
merged 3 commits into
nextcloud:master
from
mishamosher:docker-compose-recording
Aug 29, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| FROM ubuntu:20.04 | ||
|
|
||
| ENV DEBIAN_FRONTEND noninteractive | ||
|
|
||
| RUN apt-get --assume-yes update | ||
| RUN apt-get --assume-yes upgrade | ||
|
|
||
| # Common dependencies | ||
| RUN apt-get --assume-yes install software-properties-common | ||
|
|
||
| # spreed-recording dependencies | ||
| RUN apt-get --assume-yes install ffmpeg pulseaudio python3-pip xvfb | ||
| RUN pip3 install --upgrade requests | ||
|
|
||
| # firefox | ||
| RUN apt-get --assume-yes install firefox firefox-geckodriver | ||
|
|
||
| # chromium | ||
| # The phd/chromium repository for Ubuntu is used because since Ubuntu 20.04 | ||
| # Chromium is provided as a snap package, and the equivalent PPA has been | ||
| # discontinued. | ||
| RUN echo "deb https://freeshell.de/phd/chromium/focal /" > /etc/apt/sources.list.d/phd-chromium.list | ||
| RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 869689FE09306074 | ||
| RUN apt-get update | ||
| RUN apt-get --assume-yes install chromium | ||
|
|
||
| COPY ./docker-compose/wrap_chromium_binary /opt/bin/wrap_chromium_binary | ||
| RUN /opt/bin/wrap_chromium_binary | ||
|
|
||
| # spreed-recording config | ||
| RUN useradd --create-home recording | ||
| COPY server.conf.in /etc/nextcloud-talk-recording/server.conf | ||
| RUN sed --in-place 's/#listen =.*/listen = 0.0.0.0:8000/' /etc/nextcloud-talk-recording/server.conf | ||
|
|
||
| # Deploy recording server | ||
| RUN mkdir --parents /tmp/recording | ||
| COPY src /tmp/recording/ | ||
| COPY pyproject.toml /tmp/recording/ | ||
| RUN python3 -m pip install /tmp/recording/ | ||
|
|
||
| # Cleanup | ||
| RUN apt-get clean && rm --recursive --force /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
| RUN rm --recursive --force /tmp/recording | ||
|
|
||
| # Switch user and start the recording server | ||
| WORKDIR "/home/recording/" | ||
| USER "recording" | ||
danxuliu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| CMD ["python3", "-m", "nextcloud.talk.recording", "--config", "/etc/nextcloud-talk-recording/server.conf"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| version: "3.9" | ||
|
|
||
| services: | ||
|
|
||
| nextcloud-talk-recording: | ||
| build: | ||
| context: .. | ||
| dockerfile: ./docker-compose/Dockerfile | ||
| init: true | ||
| shm_size: '2gb' | ||
danxuliu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| restart: on-failure | ||
| # By default the recording server is reachable through the network "nextcloud-talk-recording" | ||
| # Depending on your setup (if you need to reach the recording server externally for example) you might need | ||
| # to expose the used ports to the host machine, e.g.: | ||
| #ports: | ||
| # - "8000:8000" | ||
| networks: | ||
| - nextcloud-talk-recording | ||
|
|
||
| networks: | ||
| nextcloud-talk-recording: | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Originally adjusted from https://github.com/SeleniumHQ/docker-selenium/blob/c6df1ab8dc6a5aca05c163c429a062ada1d79c51/NodeChrome/wrap_chrome_binary | ||
| # which is licensed under the Apache license 2.0 (https://github.com/SeleniumHQ/docker-selenium/blob/c6df1ab8dc6a5aca05c163c429a062ada1d79c51/LICENSE.md) | ||
|
|
||
| WRAPPER_PATH=$(readlink -f /usr/bin/chromium) | ||
| BASE_PATH="$WRAPPER_PATH-base" | ||
| mv "$WRAPPER_PATH" "$BASE_PATH" | ||
|
|
||
| cat > "$WRAPPER_PATH" <<_EOF | ||
| #!/bin/bash | ||
|
|
||
| # umask 002 ensures default permissions of files are 664 (rw-rw-r--) and directories are 775 (rwxrwxr-x). | ||
| umask 002 | ||
|
|
||
| # Debian/Ubuntu seems to not respect --lang, it instead needs to be a LANGUAGE environment var | ||
| # See: https://stackoverflow.com/a/41893197/359999 | ||
| for var in "\$@"; do | ||
| if [[ \$var == --lang=* ]]; then | ||
| LANGUAGE=\${var//--lang=} | ||
| fi | ||
| done | ||
|
|
||
| # Set language environment variable | ||
| export LANGUAGE="\$LANGUAGE" | ||
|
|
||
| # Note: exec -a below is a bashism. | ||
| exec -a "\$0" "$BASE_PATH" --no-sandbox "\$@" | ||
| _EOF | ||
| chmod +x "$WRAPPER_PATH" | ||
|
|
||
| # Also add the executable name expected by Selenium Manager | ||
| ln --symbolic "$WRAPPER_PATH" /usr/bin/chrome |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be needed, as the package will be updated if needed when running
python3 -m pip install /tmp/recording/There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command
python3 -m pip install /tmp/recording/updates the locally installed package, andpip3 install --upgrade requestsupdates the globally installed package. Something akin to/usr/binand/usr/local/bin.Even though it works, on a default Ubuntu 20.04 Docker image there are warnings about version mismatches between the locally and globally installed requests package. Updating the globally installed
requestspackage takes care of the warnings.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically, this is what I get:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok, it seems that I did not get the error because the branch was rooted on 9aed218, so the pull request that added
requests-toolbeltas dependency had not been merged yet. Now I see them as well :-)I would have expected
python3 -m pip install /tmp/recording/to anyway update the dependencies as needed in/usr/localand use them overriding the ones from/usr/, but if it does not work that way and an explicit upgrade is needed... so be it 👍