From 5af6182cbd8216b55f125a37387df613953837cc Mon Sep 17 00:00:00 2001 From: Fredrik Baberg Date: Thu, 16 Mar 2023 12:02:45 +0100 Subject: [PATCH] Prepare for test on device --- camera-ustreamer/Dockerfile | 8 ++-- camera-ustreamer/build.yaml | 7 ++++ camera-ustreamer/config.yaml | 22 +++++----- camera-ustreamer/rootfs/etc/caddy/Caddyfile | 18 ++++++--- .../rootfs/etc/cont-init.d/proxy.sh | 40 +++++++++---------- .../rootfs/etc/services.d/janus/run | 2 +- .../rootfs/etc/services.d/ustreamer/run | 2 +- 7 files changed, 57 insertions(+), 42 deletions(-) create mode 100644 camera-ustreamer/build.yaml diff --git a/camera-ustreamer/Dockerfile b/camera-ustreamer/Dockerfile index be2a709..9cf43fe 100644 --- a/camera-ustreamer/Dockerfile +++ b/camera-ustreamer/Dockerfile @@ -81,12 +81,14 @@ RUN apk add -U \ opus \ speexdsp \ zlib \ - caddy + caddy \ + vim \ + screen COPY rootfs/ / WORKDIR / # # Make files executable -# # RUN chmod +x /etc/cont-init.d/*.sh -# # RUN chmod +x /etc/services.d/*/* +# RUN chmod +x /etc/cont-init.d/*.sh +# RUN chmod +x /etc/services.d/*/* diff --git a/camera-ustreamer/build.yaml b/camera-ustreamer/build.yaml new file mode 100644 index 0000000..5f575c8 --- /dev/null +++ b/camera-ustreamer/build.yaml @@ -0,0 +1,7 @@ +labels: + org.opencontainers.image.title: "Home Assistant Add-on: Camera-ustreamer" + org.opencontainers.image.description: "ustreamer addon for Home-Assistant." + org.opencontainers.image.source: "https://github.com/fredrikbaberg/ha-3dprinter-addons" +args: + JANUS_GATEWAY_VERSION: "1.1.3" + USTREAMER_VERSION: "5.38" \ No newline at end of file diff --git a/camera-ustreamer/config.yaml b/camera-ustreamer/config.yaml index 7bc9e7f..d62d002 100644 --- a/camera-ustreamer/config.yaml +++ b/camera-ustreamer/config.yaml @@ -1,12 +1,12 @@ -name: "Camera-mjpg-streamer" -version: "2022.7.0" -slug: "camera-mjpg-streamer" -description: "Camera streaming addon for Home Assistant, based on mjpg-streamer." -url: "https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/camera-mjpg-streamer" +name: "Camera-ustreamer" +version: "2023.3.0-rc0" +slug: "camera-ustreamer" +description: "Camera streaming addon for Home Assistant, based on ustreamer." +url: "https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/camera-ustreamer" ingress: true ingress_stream: true panel_icon: mdi:camera -panel_title: mjpg-streamer +panel_title: ustreamer arch: - armv7 - amd64 @@ -21,8 +21,8 @@ ports: 80/tcp: null ports_description: 80/tcp: Web-based interface (Not required for Ingress) -options: - mjpg_input: "input_uvc.so -n" -schema: - mjpg_input: "str" -image: ghcr.io/fredrikbaberg/ha-addon-camera-mjpg-streamer-{arch} +# options: +# mjpg_input: "input_uvc.so -n" +# schema: +# mjpg_input: "str" +# image: ghcr.io/fredrikbaberg/ha-addon-camera-ustreamer-{arch} diff --git a/camera-ustreamer/rootfs/etc/caddy/Caddyfile b/camera-ustreamer/rootfs/etc/caddy/Caddyfile index eaa6af7..e2d3284 100644 --- a/camera-ustreamer/rootfs/etc/caddy/Caddyfile +++ b/camera-ustreamer/rootfs/etc/caddy/Caddyfile @@ -1,12 +1,18 @@ # Ingress :8099 { - @blocked not remote_ip 172.30.32.2 - respond @blocked "This is only for access through Ingress" 403 - reverse_proxy 127.0.0.1:8080 + # @blocked not remote_ip 172.30.32.2 + # respond @blocked "This is only for access through Ingress" 403 + handle_path /janus/* { + reverse_proxy localhost:8188 # Janus API + } + reverse_proxy 127.0.0.1:8080 # ustreamer } # External access -:8080 { - root * /opt/janus/share/janus/demos - file_server +:80 { + root * /opt/janus/share/janus/demos + handle_path /janus/* { + reverse_proxy localhost:8188 # Janus API + } + file_server # Janus demo } diff --git a/camera-ustreamer/rootfs/etc/cont-init.d/proxy.sh b/camera-ustreamer/rootfs/etc/cont-init.d/proxy.sh index c84e750..880841e 100644 --- a/camera-ustreamer/rootfs/etc/cont-init.d/proxy.sh +++ b/camera-ustreamer/rootfs/etc/cont-init.d/proxy.sh @@ -1,22 +1,22 @@ -#!/usr/bin/with-contenv bashio -# ============================================================================== -# Add-on: aiortc -# Configures NGINX for use with aiortc -# ============================================================================== +# #!/usr/bin/with-contenv bashio +# # ============================================================================== +# # Add-on: aiortc +# # Configures NGINX for use with aiortc +# # ============================================================================== -# Generate Ingress configuration -bashio::var.json \ - interface "$(bashio::addon.ip_address)" \ - port "^$(bashio::addon.ingress_port)" \ - | tempio \ - -template /etc/nginx/templates/ingress.gtpl \ - -out /etc/nginx/servers/ingress.conf +# # Generate Ingress configuration +# bashio::var.json \ +# interface "$(bashio::addon.ip_address)" \ +# port "^$(bashio::addon.ingress_port)" \ +# | tempio \ +# -template /etc/nginx/templates/ingress.gtpl \ +# -out /etc/nginx/servers/ingress.conf -# Generate direct access configuration, if enabled. -if bashio::var.has_value "$(bashio::addon.port 80)"; then - bashio::var.json \ - port "^$(bashio::addon.port 80)" \ - | tempio \ - -template /etc/nginx/templates/direct.gtpl \ - -out /etc/nginx/servers/direct.conf -fi +# # Generate direct access configuration, if enabled. +# if bashio::var.has_value "$(bashio::addon.port 80)"; then +# bashio::var.json \ +# port "^$(bashio::addon.port 80)" \ +# | tempio \ +# -template /etc/nginx/templates/direct.gtpl \ +# -out /etc/nginx/servers/direct.conf +# fi diff --git a/camera-ustreamer/rootfs/etc/services.d/janus/run b/camera-ustreamer/rootfs/etc/services.d/janus/run index fd58df9..f7aa02d 100644 --- a/camera-ustreamer/rootfs/etc/services.d/janus/run +++ b/camera-ustreamer/rootfs/etc/services.d/janus/run @@ -6,4 +6,4 @@ bashio::log.info "Starting janus.." -exec /opt/janus/bin/janus \ No newline at end of file +exec /opt/janus/bin/janus --configs-folder /opt/janus/etc/janus/ --plugins-folder /opt/janus/lib/janus/plugins/ diff --git a/camera-ustreamer/rootfs/etc/services.d/ustreamer/run b/camera-ustreamer/rootfs/etc/services.d/ustreamer/run index ff07ea4..1e2d900 100644 --- a/camera-ustreamer/rootfs/etc/services.d/ustreamer/run +++ b/camera-ustreamer/rootfs/etc/services.d/ustreamer/run @@ -7,4 +7,4 @@ bashio::log.info "Starting mjpg-streamer.." # mjpg_streamer -i "$(bashio::config 'mjpg_input')" -o "output_http.so -w /www_mjpg -p 80" -exec ustreamer --host=127.0.0.1 --port=80 \ No newline at end of file +exec ustreamer --host=127.0.0.1 --h264-sink demo::ustreamer::h264 --h264-sink-mode 660 --h264-sink-rm \ No newline at end of file