From 5a513afec26c7cf2ddb0fbb718bee483938c3f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20K=C3=BCffner?= Date: Mon, 24 Jul 2023 16:56:13 +0200 Subject: [PATCH] custom: simplify moonraker-timelapse setup --- ...e.custom.moonraker-timelapse.override.yaml | 72 +++++++++++++++++++ .../Dockerfile.moonraker.ffmpeg | 8 --- custom/moonraker-timelapse/README.md | 28 -------- .../docker-compose.override.yaml | 38 ---------- 4 files changed, 72 insertions(+), 74 deletions(-) create mode 100644 custom/docker-compose.custom.moonraker-timelapse.override.yaml delete mode 100644 custom/moonraker-timelapse/Dockerfile.moonraker.ffmpeg delete mode 100644 custom/moonraker-timelapse/README.md delete mode 100644 custom/moonraker-timelapse/docker-compose.override.yaml diff --git a/custom/docker-compose.custom.moonraker-timelapse.override.yaml b/custom/docker-compose.custom.moonraker-timelapse.override.yaml new file mode 100644 index 0000000..460c1cc --- /dev/null +++ b/custom/docker-compose.custom.moonraker-timelapse.override.yaml @@ -0,0 +1,72 @@ +## Moonraker Timelapse in Docker +## +## Usecase: Create timelapses via moonraker plugin +## Issue: https://github.com/mkuf/prind/issues/46 +## +## Assumptions: +## * I use a profile that requires moonraker +## * I have a webcam +## * I want to create timelapses +## +## About this setup: +## * this file replaces the main docker-compose.override.yaml +## * moonraker image is built at stack startup +## * timelapses will be saved to `/opt/timelapse` on the host machine +## +## Setup +## 1. Check out the timelapse code to `../` relative to the root of this repository +## ``` +## git clone https://github.com/mainsail-crew/moonraker-timelapse ../moonraker-timelapse +## ``` +## 2. Add the gcode macros provided by moonraker-timelapse to your printers configuration file https://github.com/mainsail-crew/moonraker-timelapse/blob/main/klipper_macro/timelapse.cfg +## 3. Add the following to your moonraker.conf +## ``` +## [timelapse] +## output_path: /opt/timelapse/ +## ``` +## 4. Add your personal config to this file and copy it to the root of the repository, overwriting the existing docker-compose.override.yaml +## 5. start the stack as described in the main readme using mainsail or fluidd as profile + +## Ustreamer base Service +x-ustreamer-svc: &ustreamer-svc + image: mkuf/ustreamer:latest + restart: unless-stopped + command: --host=0.0.0.0 --port=8080 --slowdown --device=/dev/webcam --resolution=1280x960 --format=MJPEG --desired-fps=30 + +## Add your personal config here +services: + moonraker: + image: moonraker:ffmpeg + build: + dockerfile_inline: | + FROM mkuf/moonraker:latest + USER root + RUN apt update \ + && apt install -y ffmpeg \ + && apt clean + USER moonraker + volumes: + - /opt/moonraker-timelapse/component/timelapse.py:/opt/moonraker/moonraker/components/timelapse.py + - /opt/timelapse:/opt/timelapse + - /dev/null:/opt/klipper/config/null + - /dev/null:/opt/klipper/docs/null + - /run/dbus:/run/dbus + - /run/systemd:/run/systemd + - run:/opt/printer_data/run + - gcode:/opt/printer_data/gcodes + - log:/opt/printer_data/logs + - moonraker-db:/opt/printer_data/database + - ./config:/opt/printer_data/config + + webcam: + <<: *ustreamer-svc + devices: + - /dev/video0:/dev/webcam + labels: + org.prind.service: webcam + traefik.enable: true + traefik.http.services.webcam.loadbalancer.server.port: 8080 + traefik.http.routers.webcam.rule: PathPrefix(`/webcam`) + traefik.http.routers.webcam.entrypoints: web + traefik.http.middlewares.webcam.stripprefix.prefixes: /webcam + traefik.http.routers.webcam.middlewares: webcam \ No newline at end of file diff --git a/custom/moonraker-timelapse/Dockerfile.moonraker.ffmpeg b/custom/moonraker-timelapse/Dockerfile.moonraker.ffmpeg deleted file mode 100644 index e22c1e0..0000000 --- a/custom/moonraker-timelapse/Dockerfile.moonraker.ffmpeg +++ /dev/null @@ -1,8 +0,0 @@ -FROM mkuf/moonraker:latest - -USER root -RUN apt update \ - && apt install -y ffmpeg \ - && apt clean - -USER moonraker \ No newline at end of file diff --git a/custom/moonraker-timelapse/README.md b/custom/moonraker-timelapse/README.md deleted file mode 100644 index 8c0c7e0..0000000 --- a/custom/moonraker-timelapse/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# Moonraker Timelapse in Docker - -> **Usecase**: Create timelapses via moonraker plugin -> **Issue**: https://github.com/mkuf/prind/issues/46 -> -> **Assumptions**: -> * I use a profile that requires moonraker -> * I have a webcam -> * I want to create timelapses -> -> About this setup: -> * moonraker image is built at stack startup -> * timelapses will be saved to `/opt/timelapse` on the host machine - -## Setup -1. Copy the file `Docker.moonraker.ffmpeg` into the `docker/moonraker/` directory -2. Check out the timelapse code to `../` relative to the root of this repository -``` -git clone https://github.com/mainsail-crew/moonraker-timelapse ../moonraker-timelapse -``` -3. Add the gcode macros provided by moonraker-timelapse to your printers configuration file https://github.com/mainsail-crew/moonraker-timelapse/blob/main/klipper_macro/timelapse.cfg -4. Add the following to your moonraker.conf -``` -[timelapse] -output_path: /opt/timelapse/ -``` -5. Add your personal config to `docker-compose.override.yaml` and copy it to the root of the repository, overwriting the existing one -6. start the stack as described in the main readme using mainsail or fluidd as profile \ No newline at end of file diff --git a/custom/moonraker-timelapse/docker-compose.override.yaml b/custom/moonraker-timelapse/docker-compose.override.yaml deleted file mode 100644 index d7cfe6e..0000000 --- a/custom/moonraker-timelapse/docker-compose.override.yaml +++ /dev/null @@ -1,38 +0,0 @@ -## Ustreamer base Service -x-ustreamer-svc: &ustreamer-svc - image: mkuf/ustreamer:latest - restart: unless-stopped - command: --host=0.0.0.0 --port=8080 --slowdown --device=/dev/webcam --resolution=1280x960 --format=MJPEG --desired-fps=30 - -## Add your personal config here -services: - moonraker: - image: moonraker:ffmpeg - build: - context: docker/moonraker - dockerfile: Dockerfile.moonraker.ffmpeg - volumes: - - /opt/moonraker-timelapse/component/timelapse.py:/opt/moonraker/moonraker/components/timelapse.py - - /opt/timelapse:/opt/timelapse - - /dev/null:/opt/klipper/config/null - - /dev/null:/opt/klipper/docs/null - - /run/dbus:/run/dbus - - /run/systemd:/run/systemd - - run:/opt/printer_data/run - - gcode:/opt/printer_data/gcodes - - log:/opt/printer_data/logs - - moonraker-db:/opt/printer_data/database - - ./config:/opt/printer_data/config - - webcam: - <<: *ustreamer-svc - devices: - - /dev/video0:/dev/webcam - labels: - org.prind.service: webcam - traefik.enable: true - traefik.http.services.webcam.loadbalancer.server.port: 8080 - traefik.http.routers.webcam.rule: PathPrefix(`/webcam`) - traefik.http.routers.webcam.entrypoints: web - traefik.http.middlewares.webcam.stripprefix.prefixes: /webcam - traefik.http.routers.webcam.middlewares: webcam \ No newline at end of file