mirror of
https://github.com/mkuf/prind.git
synced 2025-10-26 07:46:19 +01:00
Always run klipper in privileged mode to allow device name change
This commit is contained in:
committed by
Markus Küffner
parent
e72a848f2a
commit
e0bb8426bf
10
README.md
10
README.md
@@ -39,14 +39,6 @@ make flash FLASH_DEVICE=/dev/serial/by-id/<my printer>
|
||||
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
|
||||
|
||||
@@ -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/<klpper-device>
|
||||
|
||||
[printer]
|
||||
kinematics: cartesian
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
##
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user