summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xDockerfile59
-rwxr-xr-x[-rw-r--r--]README.md2
-rw-r--r--README_DOCKER.md38
-rwxr-xr-xdocker-ep.sh99
4 files changed, 197 insertions, 1 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100755
index 0000000..90cd4b3
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,59 @@
+## initial build:
+# docker build -t local/voctomix .
+## re-build:
+# docker tag local/voctomix:latest local/voctomix:old; docker build -t local/voctomix . && docker rmi local/voctomix:old
+#
+## run:
+# docker run -it --rm local/voctocore help
+#
+## core:
+# docker run -it --rm -v /some/dir:/video
+# -p 9999:9999 -p 10000:10000 -p 10001:10001 -p 10002:10002 -p 11000:11000 -p 12000:12000 \
+# -p 13000:13000 -p 13001:13001 -p 13002:13002 -p 14000:14000 -p 15000:15000 -p 16000:16000 \
+# -p 17000:17000 -p 17001:17001 -p 17002:17002 -p 18000:18000 --name=voctocore local/voctomix core
+#
+## test sources
+# docker run -it --rm --name=cam1 --link=voctocore:corehost local/voctomix gstreamer/source-videotestsrc-as-cam1.sh
+# docker run -it --rm --name=bg --link=voctocore:corehost local/voctomix gstreamer/source-videotestsrc-as-background-loop.sh#
+#
+## gui
+## gui will connect to "corehost": corehost is aliased to container "voctocore"
+# xhost +local:$(id -un)
+# docker run -it --rm --name=gui --env=gid=$(id -g) --env=uid=$(id -u) --env=DISPLAY=:0 --link=voctocore:corehost \
+# -v /tmp/vocto/configgui.ini:/opt/voctomix/voctogui/config.ini -v /tmp/.X11-unix:/tmp/.X11-unix -v /tmp/.docker.xauth:/tmp/.docker.xauth local/voctomix gui
+
+
+FROM ubuntu:wily
+
+MAINTAINER Bjoern Riemer <bjoern.riemer@web.de>
+
+ENV DEBIAN_FRONTEND noninteractive
+
+ENV uid 1000
+ENV gid 1000
+
+RUN useradd -m voc
+
+RUN apt-get update \
+ && apt-get install -y gstreamer1.0-plugins-good vim-tiny wget \
+ && apt-get install -y --no-install-recommends gstreamer1.0-tools libgstreamer1.0-0 python3 python3-gi gir1.2-gstreamer-1.0 gstreamer1.0-plugins-bad \
+ && apt-get install -y gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gir1.2-gtk-3.0 gstreamer1.0-x ffmpeg python3-gi-cairo \
+ && apt-get clean
+
+RUN wget -q https://github.com/tianon/gosu/releases/download/1.7/gosu-amd64 -O /bin/gosu && chmod +x /bin/gosu
+
+RUN mkdir -p /opt/voctomix
+
+EXPOSE 9998 9999 10000 10001 10002 11000 12000 13000 13001 13002 14000 15000 16000 17000 17001 17002 18000
+VOLUME /video
+
+WORKDIR /opt/voctomix
+COPY . /opt/voctomix/
+COPY docker-ep.sh /opt/voctomix/
+
+RUN sed -i 's/localhost/corehost/g' voctogui/default-config.ini ;\
+ sed -i 's/system=gl/system=xv/g' voctogui/default-config.ini ;\
+ find /opt/voctomix/example-scripts/ -type f -exec sed -i 's/localhost/corehost/g' {} \;
+
+ENTRYPOINT ["/opt/voctomix/docker-ep.sh"]
+CMD ["help"]
diff --git a/README.md b/README.md
index cefb549..eacceae 100644..100755
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ The Voctomix Project consists of three parts:
- Voctotools (tbd.), a Collection of Tools and Examples on how to talk to the core-process, feeding and receiving video-streams
## Installation
-Voctomix requires a fairly recent Version of GStreamer (at least 1.5, though we recommend 1.6 and later). This is natively present on [Debian Sid](https://packages.debian.org/sid/libgstreamer1.0-0) and [Ubuntu Wily](http://packages.ubuntu.com/wily/libgstreamer1.0-0). On these Systems it should run out of the Box and we recommend using one of them.
+Voctomix requires a fairly recent Version of GStreamer (at least 1.5, though we recommend 1.6 and later). This is natively present on [Debian Sid](https://packages.debian.org/sid/libgstreamer1.0-0) and [Ubuntu Wily](http://packages.ubuntu.com/wily/libgstreamer1.0-0). On these Systems it should run out of the Box and we recommend using one of them. A [Docker](http://www.docker.com) image that uses Ubuntu Wily as a base is bundled with Vocomix. Please refer to the seperate [readme](./README_DOCKER.md) how to use the Docker image.
Install the required Dependencies:
````
diff --git a/README_DOCKER.md b/README_DOCKER.md
new file mode 100644
index 0000000..e03e77b
--- /dev/null
+++ b/README_DOCKER.md
@@ -0,0 +1,38 @@
+# HowTo use the Docker version of Voctomix
+## build the docker container locally
+- checkout branch:
+```
+git checkout quickstart-docker
+```
+- build docker
+```
+docker build -t local/voctomix .
+```
+- rebuild docker after changes
+```
+docker tag local/voctomix:latest local/voctomix:old; \
+docker build -t local/voctomix . && docker rmi local/voctomix:old
+```
+
+## Test the docker
+the entrypoint script of the container provides some commands to ease the startup of the individual components. get a list by running
+```docker run --rm -it --name=voctocore local/voctomix core```
+
+## Run the components
+### CORE
+```
+docker run --rm -it --name=voctocore local/voctomix core
+```
+### Source example scripts
+```
+docker run -it --rm --name=cam1 --link=voctocore:corehost local/voctomix gstreamer/source-videotestsrc-as-cam1.sh
+docker run -it --rm --name=bg --link=voctocore:corehost local/voctomix gstreamer/source-videotestsrc-as-background-loop.sh
+```
+
+### GUI
+to run the GUI in a docker the docker user needs access to the local X server. This is done by sharing the ```/tmp/.X11-unix``` socket with the container. Depending on your X11 setup you have to allow access to the X-Server session by running: ```xhost +local:$(id -un)```
+The example below maps the local voctogui config file ```/tmp/vocto/configgui.ini``` into the container. Please create and change this file to change the voctogui configuration.
+```
+docker run -it --rm --name=gui --env=gid=$(id -g) --env=uid=$(id -u) --env=DISPLAY=:0 --link=voctocore:corehost \
+ -v /tmp/vocto/configgui.ini:/opt/voctomix/voctogui/config.ini -v /tmp/.X11-unix:/tmp/.X11-unix -v /tmp/.docker.xauth:/tmp/.docker.xauth local/voctomix gui
+```
diff --git a/docker-ep.sh b/docker-ep.sh
new file mode 100755
index 0000000..17b1ac4
--- /dev/null
+++ b/docker-ep.sh
@@ -0,0 +1,99 @@
+#!/bin/bash
+##
+## entrypoint for the docker images
+
+if [ ! -f /.dockerenv ] && [ ! -f /.dockerinit ]; then
+ echo "WARNING: this script should be only run inside docker!!"
+ exit 1
+fi
+
+if [ ! -z $gid ] && [ ! -z $uid ]; then
+ groupmod -g $gid voc
+ usermod -u $uid -g $gid voc
+
+ # check if homedir is mounted
+ if grep -q '/home/voc' /proc/mounts; then
+ # homedir is mounted into the docker so don't touch the ownership of the files
+ true
+ else
+ # fixup for changed uid and gid
+ chown -R voc:voc /home/voc
+ fi
+fi
+
+function startCore() {
+ echo "Starting Voctomix CORE"
+ if [ -x /bin/gosu ]; then
+ gosu voc /opt/voctomix/voctocore/voctocore.py -v
+ else
+ echo "no gosu found..."
+ exec su -l -c "/opt/voctomix/voctocore/voctocore.py -v" voc
+ fi
+}
+
+function isVideoMounted() {
+ return grep -q '/video' /proc/mounts
+}
+
+function startGui() {
+ echo "Starting Voctomix GUI..."
+ if [ -x /bin/gosu ]; then
+ gosu voc /opt/voctomix/voctogui/voctogui.py -v
+ else
+ echo "no gosu found..."
+ exec su -l -c "/opt/voctomix/voctogui/voctogui.py -v" voc
+ fi
+}
+
+function listExamples() {
+ cd example-scripts/
+ find -type f
+}
+
+function runExample() {
+ if [ -z $1 ]; then
+ echo "no valid example! "
+ fi
+ FILENAME="example-scripts/$1"
+ if [ -f ${FILENAME} ]; then
+ echo "Running: ${FILENAME}"
+ ${FILENAME}
+ fi
+}
+
+function usage() {
+ echo "Usage: $0 <cmd>"
+ echo "help - this text"
+ echo "core - starts voctomix gore"
+ echo "gui - starts the voctomix GUI"
+ echo "examples - lists the example scripts"
+ echo "bash - run interactive bash"
+ echo "scriptname.py - starts the example script named 'scriptname.py' "
+}
+
+if [ -z $1 ]; then
+ usage
+ exit
+fi
+
+case $1 in
+ help )
+ usage
+ ;;
+ examples )
+ listExamples
+ ;;
+ gui )
+ startGui
+ ;;
+ core )
+ startCore
+ ;;
+ bash )
+ shift
+ bash $@
+ ;;
+ * )
+ runExample $1
+ ;;
+esac