diff --git a/README.md b/README.md index 67f791f..43e4221 100644 --- a/README.md +++ b/README.md @@ -39,14 +39,6 @@ make flash FLASH_DEVICE=/dev/serial/by-id/ If your Board can be flashed via SD-Card, you may want to omit `make flash` and retrieve the `klipper.bin` from the `out` directory that is created by `make`. Follow your boards instructions on how to proceed with flashing via SD-Card. ### Add your Configuration to docker-compose.override.yaml -Locate the ``klipper`` Service within ``docker-compose.override.yaml`` and update the ``device`` Section with the Serial Port of your Printer. -In this example, the Printer is using device ``/dev/ttymxc3``. -```yaml - klipper: - devices: - - /dev/ttymxc3:/dev/ttymxc3 -``` - Locate the ``webcam`` Service within ``docker-compose.override.yaml`` and update the ``device`` Section with the Device Name of your Webcam. In this example, the Webcam is using device ``/dev/video0``. Do not edit any other lines. ```yaml @@ -65,7 +57,7 @@ In this example, the Webcam is using device ``/dev/video0``. Do not edit any oth ### Configuring Klipper/Moonraker All Runtime Configs are stored within ``config`` of this Repo. -* Update config/printer.cfg with your Klipper config, make sure to not remove the existing Macros as they are required by fluidd/mainsail. See [Klipper3d Docs](https://www.klipper3d.org/Config_Reference.html) for Reference +* Update ``config/printer.cfg`` with your Klipper config, set the serial device and make sure to not remove the existing Macros as they are required by fluidd/mainsail. See [Klipper3d Docs](https://www.klipper3d.org/Config_Reference.html) for Reference * Make sure to update ``cors_domains`` and ``trusted_clients`` within ``moonraker.cfg`` to secure your moonraker api from unwanted access. See [Moonraker Docs](https://moonraker.readthedocs.io/en/latest/configuration/) for Reference ### Starting the stack diff --git a/config/printer.cfg b/config/printer.cfg index 44d739f..52908f1 100644 --- a/config/printer.cfg +++ b/config/printer.cfg @@ -2,7 +2,7 @@ # See https://github.com/Klipper3d/klipper/blob/master/docs/Config_Reference.md for a description of parameters. [mcu] -serial: /dev/ttymxc3 +serial: /dev/serial/by-id/ [printer] kinematics: cartesian diff --git a/custom/docker-compose.custom.multiple-printers.yaml b/custom/docker-compose.custom.multiple-printers.yaml index cace3e7..9ed3520 100644 --- a/custom/docker-compose.custom.multiple-printers.yaml +++ b/custom/docker-compose.custom.multiple-printers.yaml @@ -25,7 +25,7 @@ ## 5. Make sure each service has a unique 'command' and is referencing the files created by 2. ## 6. Add your printers config to their corresponding file ## 7. Set the correct klippy_uds_address in the corresponding *.moonraker.conf -## 8. Update the Devices used for klipper and the webcam services +## 8. Update the Devices used for the webcam services ## 9. Start the stack ## > docker compose up -d @@ -33,7 +33,9 @@ x-klipper-svc: &klipper-svc image: mkuf/klipper:latest restart: unless-stopped + privileged: true volumes: + - /dev:/dev - ./config:/opt/printer_data/config - run:/opt/printer_data/run - gcode:/opt/printer_data/gcodes @@ -63,8 +65,6 @@ services: printer1-klipper: <<: *klipper-svc command: -I printer_data/run/printer1.klipper.tty -a printer_data/run/printer1.klipper.sock printer_data/config/printer1.cfg -l printer_data/logs/printer1.klippy.log - devices: - - /dev/ttyUSB0:/dev/ttyUSB0 labels: org.prind.service: klipper org.prind.printer: printer1 @@ -91,8 +91,6 @@ services: printer2-klipper: <<: *klipper-svc command: -I printer_data/run/printer2.klipper.tty -a printer_data/run/printer2.klipper.sock printer_data/config/printer2.cfg -l printer_data/logs/printer2.klippy.log - devices: - - /dev/ttyUSB1:/dev/ttyUSB1 labels: org.prind.service: klipper org.prind.printer: printer2 diff --git a/custom/docker-compose.custom.portainer.yaml b/custom/docker-compose.custom.portainer.yaml index 718e0a6..af101bb 100644 --- a/custom/docker-compose.custom.portainer.yaml +++ b/custom/docker-compose.custom.portainer.yaml @@ -20,19 +20,19 @@ ## 4. Upload this file to portainer services: - klipper: + klipper: image: mkuf/klipper:latest restart: unless-stopped + privileged: true logging: driver: none depends_on: init: condition: service_completed_successfully command: -I printer_data/run/klipper.tty -a printer_data/run/klipper.sock printer_data/config/printer.cfg -l printer_data/logs/klippy.log - devices: - - /dev/ttyUSB0:/dev/ttyUSB0 volumes: - - /data/prind/config:/opt/printer_data/config + - /dev:/dev + - ./config:/opt/printer_data/config - run:/opt/printer_data/run - gcode:/opt/printer_data/gcodes - log:/opt/printer_data/logs diff --git a/custom/moonraker-timelapse/docker-compose.override.yaml b/custom/moonraker-timelapse/docker-compose.override.yaml index 010c9ef..d7cfe6e 100644 --- a/custom/moonraker-timelapse/docker-compose.override.yaml +++ b/custom/moonraker-timelapse/docker-compose.override.yaml @@ -6,10 +6,6 @@ x-ustreamer-svc: &ustreamer-svc ## Add your personal config here services: - klipper: - devices: - - /dev/ttymxc3:/dev/ttymxc3 - moonraker: image: moonraker:ffmpeg build: diff --git a/docker-compose.extra.simulavr.yaml b/docker-compose.extra.simulavr.yaml index b9df431..9043e77 100644 --- a/docker-compose.extra.simulavr.yaml +++ b/docker-compose.extra.simulavr.yaml @@ -1,18 +1,3 @@ -x-klipper-simulavr: &klipper-simulavr - depends_on: - init: - condition: service_completed_successfully - simulavr: - condition: service_started - privileged: true - command: -I printer_data/run/klipper.tty -a printer_data/run/klipper.sock printer_data/config/printer-simulavr.cfg -l printer_data/logs/klippy.log - volumes: - - ./config:/opt/printer_data/config - - run:/opt/printer_data/run - - gcode:/opt/printer_data/gcodes - - log:/opt/printer_data/logs - - /dev:/dev - services: ## simulavr simulavr: @@ -32,7 +17,9 @@ services: ## Reconfigure Klipper service for simulavr klipper: - <<: *klipper-simulavr - - klipper-priv: - <<: *klipper-simulavr + depends_on: + init: + condition: service_completed_successfully + simulavr: + condition: service_started + command: -I printer_data/run/klipper.tty -a printer_data/run/klipper.sock printer_data/config/printer-simulavr.cfg -l printer_data/logs/klippy.log \ No newline at end of file diff --git a/docker-compose.override.yaml b/docker-compose.override.yaml index 6b81129..6ccc66b 100644 --- a/docker-compose.override.yaml +++ b/docker-compose.override.yaml @@ -6,10 +6,6 @@ x-ustreamer-svc: &ustreamer-svc ## Add your personal config here services: - klipper: - devices: - - /dev/ttymxc3:/dev/ttymxc3 - webcam: <<: *ustreamer-svc devices: diff --git a/docker-compose.yaml b/docker-compose.yaml index c673a3c..d462a79 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,24 +1,20 @@ -## Common Templates -x-klipper-svc: &klipper-svc - image: mkuf/klipper:latest - restart: unless-stopped - logging: - driver: none - depends_on: - init: - condition: service_completed_successfully - command: -I printer_data/run/klipper.tty -a printer_data/run/klipper.sock printer_data/config/printer.cfg -l printer_data/logs/klippy.log - labels: - org.prind.service: klipper - ## Service Definitions services: ## Klippy Services ## klipper: - <<: *klipper-svc + image: mkuf/klipper:latest + restart: unless-stopped + privileged: true + logging: + driver: none + depends_on: + init: + condition: service_completed_successfully + command: -I printer_data/run/klipper.tty -a printer_data/run/klipper.sock printer_data/config/printer.cfg -l printer_data/logs/klippy.log volumes: + - /dev:/dev - ./config:/opt/printer_data/config - run:/opt/printer_data/run - gcode:/opt/printer_data/gcodes @@ -28,18 +24,10 @@ services: - mainsail - klipperscreen - moonraker-telegram-bot - - klipper-priv: - <<: *klipper-svc - privileged: true - volumes: - - /dev:/dev - - ./config:/opt/printer_data/config - - run:/opt/printer_data/run - - gcode:/opt/printer_data/gcodes - - log:/opt/printer_data/logs - profiles: + - mobileraker_companion - octoprint + labels: + org.prind.service: klipper ## WebApi ## diff --git a/docker/klipper/README.md b/docker/klipper/README.md index 4319d4d..85cddce 100644 --- a/docker/klipper/README.md +++ b/docker/klipper/README.md @@ -6,13 +6,14 @@ _via https://www.klipper3d.org/_ ## Usage -As Klipper is hardware dependent, there are considerations to make before deciding how to run the Container. +As Klipper needs access to your hosts devices, it is recommended to run it in privileged mode and mount your hosts `/dev` directory. +It is possible to run klipper in unprivileged mode but this will break as soon as your MCU resets and gets assigned a new Device name by your hosts OS. See [this issue](https://github.com/mkuf/prind/issues/77) for reference. + ### Standalone -If you intend to use Klipper in a Standalone configuration or with a GCODE-Sender that is dependent on a Serial connection (like Octoprint), it is necessary to start the container in privileged mode and allow access to `/dev`. Otherwise it would not be possible to use the emulated serial interface that is generated by klippy. -Point your GCODE-Sender to `klipper.tty` within the `run` directory. +Create a configfile `printer.cfg` and a directory `run`, then run the container. +Point your GCODE-Sender to `klipper.tty` within the `run` directory. #### Run -Create a configfile `printer.cfg` and a directory `run` and execute: ```bash docker run \ --privileged \ @@ -35,10 +36,7 @@ services: ``` ### With Moonraker -If you intend to use Klipper together with Moonraker, both Containers can be started in unprivileged mode. -As communication between both services is handled via a unix socket, they need to share a common directory in which the socket may be located. -To limit klippers access to system devices (`/dev`), the printers physical serial port is linked into the container. In this example, the printers serial port is `/dev/ttymc3`. - +If you intend to use Klipper together with Moonraker, they need to share a common directory in which the socket may be located. Further Info on how to use the Moonraker Image can be found in its [README.md](../moonraker/README.md) Create `moonraker.conf` and `printer.cfg` as well as the directories `run` and `gcode`, then run the containers. @@ -46,7 +44,8 @@ Create `moonraker.conf` and `printer.cfg` as well as the directories `run` and ` #### Run ```bash docker run \ - --device /dev/ttymxc3:/dev/ttymxc3 \ + --privileged \ + -v /dev:/dev -v $(pwd)/run:/opt/printer_data/run \ -v $(pwd)/gcode:/opt/printer_data/gcodes \ -v $(pwd)/printer.cfg:/opt/printer_data/config/printer.cfg \ @@ -65,9 +64,9 @@ docker run \ services: klipper: image: mkuf/klipper:latest - devices: - - /dev/ttymxc3:/dev/ttymxc3 + privileged: true volumes: + - /dev:/dev - ./printer.cfg:/opt/printer_data/config/printer.cfg - ./run:/opt/printer_data/run - ./gcode:/opt/printer_data/gcodes diff --git a/docker/moonraker/README.md b/docker/moonraker/README.md index 9eb245a..be1b5f5 100644 --- a/docker/moonraker/README.md +++ b/docker/moonraker/README.md @@ -14,7 +14,8 @@ Create `moonraker.conf` and `printer.cfg` as well as the directories `run` and ` #### Run ```bash docker run \ - --device /dev/ttymxc3:/dev/ttymxc3 \ + --privileged \ + -v /dev:/dev \ -v $(pwd)/run:/printer_data/run \ -v $(pwd)/gcode:/opt/printer_data/gcodes \ -v $(pwd)/printer.cfg:/opt/printer_data/config/printer.cfg \ @@ -33,9 +34,9 @@ docker run \ services: klipper: image: mkuf/klipper:latest - devices: - - /dev/ttymxc3:/dev/ttymxc3 + privileged: true volumes: + - /dev:/dev - ./printer.cfg:/opt/printer_data/conf/printer.cfg - ./run:/opt/printer_data/run - ./gcode:/opt/printer_data/gcodes