Giter Club home page Giter Club logo

prind's Introduction

prind

Build and Publish Images

prind allows you to run the Software for your 3D Printer in Docker containers.
With a single Command, you can start up klipper and choose between multiple Frontends.

Currently supported Frontends:

Depending on which Frontend you've chosen, moonraker will also be deployed.

Getting started

The following Guide requires docker and docker compose on your machine.
Follow the official Guides on how to get them up and running.

Build the MCU Code

Before using Klipper, you'll have to build and flash the microcontroller-code for your printers mainboard.
As this can be accomplished via docker, we can create an alias that replaces make with the appropriate docker compose command. After setting this alias, follow the Instructions on finding your printer, building and flashing the microcontroller found in the Klipper Docs.

Adapted from the official Docs, a generic Build would look like this.

alias make="docker compose -f docker-compose.extra.make.yaml run --rm make"

make menuconfig
make
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 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.

  webcam:
    <<: *ustreamer-svc
    devices:
      - /dev/video0:/dev/webcam
    labels:
      - "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"

Configuring Klipper/Moonraker

All Runtime Configs are stored within config of this Repo.

  • 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 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 for Reference

Starting the stack

There are currently 3 frontend Profiles to choose from, depending on the Web Frontend you'd like to use.

  • fluidd
  • mainsail
  • octoprint

Starting the stack comes down to:

docker compose --profile <profile> up -d

e.g.

docker compose --profile fluidd up -d

Switching between profiles requires the whole stack to be torn down before starting another Frontend.
Running two Frontends at the same time is currently not supported. Switching from fluidd to mainsail would look like this:

docker compose --profile fluidd down
docker compose --profile mainsail up -d

Additional Profiles

Docker compose allows for multiple profiles to be started at once.
You may combine any of the above frontend profiles with any number of the following additional profiles.

Be sure to always use the same set of profiles when updating the stack, otherwise services may be orphaned or the stack is behaving in an unpredictable way.

hostmcu

The hostmcu profile enables you to use your host as secondary mcu for klipper.
See the Klipper Docs for more information on this Topic.

Uncomment the following lines in printer.cfg

[mcu host]
serial: /opt/printer_data/run/klipper_host_mcu.tty

then start the stack with

docker compose --profile mainsail --profile hostmcu up -d

After the hostmcu container is started, you may check for available gpio chips with

docker compose exec -it hostmcu gpiodetect

and check the pin number and pin availability with

docker compose exec -it hostmcu gpioinfo

KlipperScreen

KlipperScreen by jordanruthe can be enabled via the klipperscreen Profile.

It requires a X11 Server on your machine that the Container can connect to.
Locate the setup Script for X11 within scripts/ and run it from the root directory of this repository as user root. It creates a User, installs and configures X11 and creates a Systemd Service for xinit.

cd prind/
./scripts/setup-X11.sh

The Prind Logo should now be displayed on your screen.
If this is not the case, check the scripts output for errors.
Otherwise, proceed to start/update the Stack.

docker compose --profile fluidd --profile klipperscreen up -d

Moonraker-Telegram-Bot

moonraker-telegram-bot by nlef can be enabled via the moonraker-telegram-bot Profile

Add your bot_token and chat_id to config/telegram.conf.
See the configuration reference for further configuration Options.

docker compose --profile mainsail --profile moonraker-telegram-bot up -d

mobileraker_companion

mobileraker_companion by Clon1998 can be enabled via the mobileraker_companion Profile.

The default configuration provided with this repository contains everything needed to start the service and receive notifications via the Mobileraker App. See the configuration reference for further configuration Options.

docker compose --profile mainsail --profile mobileraker_companion up -d

moonraker-obico

This profile is incompatible with OctoPrint, choose Fluidd or Mainsail instead.

moonraker-obico by TheSpaghettiDetective can be enabled via the moonraker-obico Profile.

The default configuration provided with this repository contains everything needed to access the webcam and use the tunnel with obico Cloud. This requires an account at https://obico.io.
If you use a self hosted instance of obico-server, you'll have to change the [server].url at config/moonraker-obico.cfg.

For further configuration options, see the Official Documentation.

Follow these steps to link your printer and start the profile:

  1. Add a new Klipper-Type Printer via the Webinterface
  2. Klick Next when prompted to Install Obico for Klipper, not executing the shown Commands
  3. Change to the root of the prind repository and start the linking process
docker compose -f docker-compose.extra.link-obico.yaml run --rm link-obico
  1. Enter the 6-digit verification code
  2. Check if [server].auth_token is set in config/mooonraker-obico.cfg
  3. Start the stack
docker compose --profile mainsail --profile moonraker-obico up -d

Spoolman

Spoolman by Donkie can be enabled via the spoolman Profile.

Uncomment the spoolman section in moonraker.conf and add your printers Hostname or IP to the server URL.
The stack can then be started by specifying the spoolman profile.

docker compose --profile fluidd --profile spoolman up -d

Navigate to http://<yourprinter>:8000 to access the spool manager webinterface.

Updating

Images are built daily and tagged with latest and the git description of the remote repo. Example:

  • mkuf/klipper:latest
  • mkuf/klipper:v0.12.0-114-ga77d0790

The latest Tag will point to a new Image within 24h.
The descriptive Tag v0.12.0-114-ga77d0790 will remain and refers to Klipper3d/klipper:v0.12.0-114-ga77d0790

Updating can be handled via docker-compose.
docker-compose.yaml uses latest tags for all Images contained in this Repository.
Compose will download all current Images and replace them when starting the stack again.
Make sure to include all profiles that you specified at stack startup when pulling images.

docker compose --profile <profile> pull
docker compose --profile <profile> up -d

Advanced Topics

Serial device permissions

It may be necessary to change the permissions of your printers serial device.
This is usually the case when you're on a non debian based distro which uses a different numerical groupid for the dialout group.

Serial devices passed into the klipper container should be assigned to groupid 20 for the permissions to work within it.

This may be done by creating a udev rule on your host machine for your specific device, read up on how to do this on your specific OS.
Usually you'll have to create a *.rules file in /etc/udev/rules.d and add a single line like this to it.
Be sure to use your devices specific idVendor and idProduct, which can be found via lsusb.

ACTION=="add",SUBSYSTEM=="tty",ATTRS{idVendor}=="0000",ATTRS{idProduct}=="0000",GROUP="20"

Input Shaper Calibration

Using input shaper requires an accelerometer.
If you choose to connect this to your hosts GPIO pins, make sure to enable the hostmcu profile described in the Additional Profiles section above.

Follow the Docs on Measuring Resonances, to set up your Printer.

After running TEST_RESONANCES or SHAPER_CALIBRATE, Klipper generates csv output in /tmp. To further analyze this data, it has to be extracted from the running klipper container.

mkdir ./resonances

docker compose exec klipper ls /tmp
  resonances_x_20220708_124515.csv  resonances_y_20220708_125150.csv

docker compose cp klipper:/tmp/resonances_x_20220708_124515.csv ./resonances/
docker compose cp klipper:/tmp/resonances_y_20220708_125150.csv ./resonances/

docker-compose.extra.calibrate-shaper.yaml is set up to run calibrate_shaper.py, so any options supported by the script can also be used with the container. Set an alias to save yourself from typing the the docker compose command multiple times. The generated Images are located besides the csv files in ./resonances

alias calibrate_shaper="docker compose -f docker-compose.extra.calibrate-shaper.yaml run --rm calibrate_shaper"

calibrate_shaper resonances_x_20220708_124515.csv -o cal_x.png
  [...]
  Recommended shaper is ei @ 90.2 Hz

calibrate_shaper resonances_y_20220708_125150.csv -o cal_y.png
  [...]
  Recommended shaper is mzv @ 48.2 Hz

Use CANBUS

CAN Devices are network devices in the Hosts network namespace. Granting access for containers requires running them in host network mode.
Add the following snippet to your docker-compose.override.yaml and restart the stack.
Any further configuration has to be done in klipper, see the official Klipper Docs

services:
  klipper:
    network_mode: host

Change Execution Options

The Entrypoint for all Docker Images within this Repo are the actual Applications, which are run at container execution time.
This makes it possible to set command line Arguments for the Apps as Docker Command.
Within docker-compose.yaml commands are already set, you may override them within docker-compose.override.yaml to fit your needs. Example from service Klipper:

  command:
    - "-I"
    - "run/klipper.tty"
    - "-a"
    - "run/klipper.sock"
    - "cfg/printer.cfg"

Multiple Webcams

The Ustreamer Service is already templated to be easily reused for multi-webcam Setups.
To add a new Ustreamer Service, simply add the following snippet to docker-compose.override.yaml.
Notice, that all service names, container names and traefik labels need to be unique while the right side of the passed Device (:/dev/webcam) always stays the same. Hence replace webcam2 with webcam3 and so on for every webcam you add and update the physical device that gets passed to the container.

  webcam2:
    <<: *ustreamer-svc
    devices:
      - /dev/video1:/dev/webcam
    labels:
      org.prind.service: webcam2
      traefik.enable: true
      traefik.http.services.webcam2.loadbalancer.server.port: 8080
      traefik.http.routers.webcam2.rule: PathPrefix(`/webcam2`)
      traefik.http.routers.webcam2.entrypoints: web
      traefik.http.middlewares.webcam2.stripprefix.prefixes: /webcam2
      traefik.http.routers.webcam2.middlewares: webcam2

Building Docker images locally

If you'd like to customize the provided Docker Images, you may edit the Dockerfiles within the docker/<service> Directory.
Images are build in multiple stages, the final stage is called run. Based on this, you can update Service definitions within docker-compose.override.yaml to build Images locally.

Example: Build Moonraker
Update the image: name and add a build config:

  moonraker:
    image: moonraker:latest
    build:
      context: docker/moonraker
      target: run

Enable Mainsail remoteMode

In case Moonraker is not situated on the same Host as Mainsail, you'll have to enable remoteMode in Mainsail to set up a remote Printer. This mirrors the behaviour of https://my.mainsail.xyz.

  1. Create config/mainsail.json with the following Contents
{
    "remoteMode":true
}
  1. Add the newly created File as a Volume to the mainsail Service
  mainsail:
    volumes:
      - ./config/mainsail.json:/usr/share/nginx/html/config.json

Debugging the Stack

Debugging the Stack without printer hardware is challenging, as klipper requires a mcu to operate.
For this purpose, you can build a service that emulates a mcu with simulavr, as suggested by the Klipper Docs.

The simulavr Image is part of the Dockerfile for Klipper but is not pushed to any registry, so it needs to be built when needed.

Locate the docker-compose.extra.simulavr.yaml in the repository and set the VERSION Build-Arg to any Git Reference from Klipper3d/klipper that you would like the mcu code to be compatible with.

This example builds the mcu code from Klipper3d/klipper:d75154d

    build:
      context: docker/klipper
      target: build-simulavr
      args: 
        VERSION: d75154d695efb1338cbfff061d226c4f384d127b

Then start the Stack

docker compose \
  --profile mainsail \
  -f docker-compose.yaml \
  -f docker-compose.extra.simulavr.yaml \
  up -d

prind's People

Contributors

geoff-coppertop avatar hz61p1 avatar kerta1n avatar mkuf avatar pedrolamas avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prind's Issues

Component 'dbus_manager' failed to load

Hi,

Just getting started on all this.

  1. I built the firmware and flashed the printer. The screen is frozen on Crealty so not sure if there is an issue there or not.
  2. updated all the configs per the readme here. I do not have a webcam.
  3. started the containers with the Fluidd profile.

Now I get the following error:

Moonraker has failed plugins, please check your logs, update your configuration and restart moonraker.

dbus_manager

Moonraker warnings found.

Component 'dbus_manager' failed to load with error:

Not sure if I have not mapped the USB device properly or there is another issue.
prind-info-20092022-142440.tar.gz

ubuntu@ender3v2:~/prind$ cat docker-compose.override.yaml
## 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:
  klipper:
    devices:
      - /dev/ttyUSB1:/dev/ttymxc3

        #  webcam:
        #    <<: *ustreamer-svc
        #    devices:
        #      - /dev/video0:/dev/webcam
        #    labels:
        #      - "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"

ability to build klipper firmware

I'm super excited to see this project leveraging docker. I'm only staring with klipper and just managed to use klipper image found here to run ./scripts/debian-install.sh - I think it may be worth to support optional pre-built image, or at least to install sudo and systemd required by make process.

folder permissions set by the `init` container don't always match the user's gid

Just a heads up, it's not guaranteed that the permissions set by the init container to the config folder and inner files (1000:1000) will always match the user's pid:gid combo. An example is a raspberry-pi 3B+ running Ubuntu Server 22.04, which has the following ids

uid=1000(pi) gid=1003(pi) groups=1003(pi),4(adm),5(tty),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),105(input),108(render),116(netdev),999(docker),1000(gpio),1001(spi),1002(i2c)

You can see that the init container would set the pi:gpio permissions instead of pi:pi. It shouldn't be a big issue but it's useful to keep in mind

Serial device not found on restarting printer in some time

Thank you for setting this up. I had been running my own docker with kiauh before but this is much better and maintained 😁 .

My printer is connected to workstation running Klipper. Whenever I turn on my printer, I have to restart the Klipper container to avoid this error. /dev/ttyACM0 does exist. I have tried restarting from Mainsail but don't see moonraker log getting updated.

crw-rw---- 1 root    dialout 166, 1 Sep  3 01:01 ttyACM0

klipper@b22f08cdf8ee:/opt$ tail -f log/klippy.log
=======================
bed_mesh: bicubic interpolation with a probe_count of less than 4 points detected.  Forcing lagrange interpolation. Configured Probe Count: 3, 3
Extruder max_extrude_ratio=0.266081
mcu 'mcu': Starting serial connect
mcu 'mcu': Unable to open serial port: [Errno 6] could not open port /dev/ttyACM0: [Errno 6] No such device or address: '/dev/ttyACM0'
webhooks client 139812987472144: New connection
webhooks client 139812987472144: Client info {'program': 'Moonraker', 'version': '?'}
mcu 'mcu': Unable to open serial port: [Errno 6] could not open port /dev/ttyACM0: [Errno 6] No such device or address: '/dev/ttyACM0'

I want use CAN bus as device connect how to update yaml config?

this is Serial Port config at docker-compose.override.yaml

klipper:
  devices:
    - /dev/serial/by-id/xxx-example:/dev/serial/by-id/xxx-example

when i use can bus,
the printer.cfg will change to this, and how to update docker-compose.override.yaml?

[mcu]
#serial: /dev/serial/by-id/xxx-example
canbus_uuid: 9999c29dd86f
canbus_interface: can0

Please check option "config_path" in the [file_manager] section of the Moonraker configuration.

Installed the prind stack with mainsail.

In the UI I have the following error:

Screenshot 2022-10-18 at 07 49 38

I couldn't understand this error because there is the following in the moonraker config:

[file_manager]
config_path: /opt/cfg

When reading the docs: https://moonraker.readthedocs.io/en/latest/configuration/
There is the following quote:

!!! Note: Previously the [file_manager] section contained config_path and log_path options. These options are now deprecated, as both locations are determined by the data path configured on the command line.

The command line usage now shows: (from https://moonraker.readthedocs.io/en/latest/installation/ )

usage: moonraker.py [-h]p [-d ] [-c ] [-l ] [-n]

Moonraker - Klipper API Server

options:
-h, --help show this help message and exit
-d , --datapath
Location of Moonraker Data File Path
-c , --configfile
Location of moonraker configuration file

It looks like we going to need a few changes.

ps. I am still brand new to klipper and prind, this just looked liked the most appropriate setup method for what I have available (no raspberry pi available to me)

Moonraker restart loop

Hi all,

Firstly, congrats on this promising initiative.

I'm trying to get the prind stack up but the moonraker container starts in a restart loop.

docker logs shows:

prind-moonraker-1  | [utils.py:setup_logging()] - config_file: cfg/moonraker.cfg
prind-moonraker-1  | [utils.py:setup_logging()] - startup_warnings: []
prind-moonraker-1  | [utils.py:setup_logging()] - log_file: /tmp/moonraker.log
prind-moonraker-1  | [utils.py:setup_logging()] - software_version: ?
prind-moonraker-1  | [utils.py:setup_logging()] - python_version: 3.10.7 (main, Sep 13 2022, 03:02:33) [GCC 10.2.1 20210110]
prind-moonraker-1  | [moonraker.py:main()] - Server Config Error
prind-moonraker-1  | Traceback (most recent call last):
prind-moonraker-1  |   File "/opt/moonraker/moonraker/confighelper.py", line 924, in _parse_file
prind-moonraker-1  |     stat = file_path.stat()
prind-moonraker-1  |   File "/usr/local/lib/python3.10/pathlib.py", line 1097, in stat
prind-moonraker-1  |     return self._accessor.stat(self, follow_symlinks=follow_symlinks)
prind-moonraker-1  | FileNotFoundError: [Errno 2] No such file or directory: '/opt/cfg/moonraker.cfg'
prind-moonraker-1  | 
prind-moonraker-1  | The above exception was the direct cause of the following exception:
prind-moonraker-1  | 
prind-moonraker-1  | Traceback (most recent call last):
prind-moonraker-1  |   File "/opt/moonraker/moonraker/moonraker.py", line 460, in main
prind-moonraker-1  |     server = Server(app_args, file_logger, event_loop)
prind-moonraker-1  |   File "/opt/moonraker/moonraker/moonraker.py", line 67, in __init__
prind-moonraker-1  |     self.config = config = self._parse_config()
prind-moonraker-1  |   File "/opt/moonraker/moonraker/moonraker.py", line 129, in _parse_config
prind-moonraker-1  |     config = confighelper.get_configuration(self, self.app_args)
prind-moonraker-1  |   File "/opt/moonraker/moonraker/confighelper.py", line 1040, in get_configuration
prind-moonraker-1  |     source.read_file(start_path)
prind-moonraker-1  |   File "/opt/moonraker/moonraker/confighelper.py", line 1028, in read_file
prind-moonraker-1  |     self._parse_file(main_conf, [])
prind-moonraker-1  |   File "/opt/moonraker/moonraker/confighelper.py", line 1013, in _parse_file
prind-moonraker-1  |     raise ConfigError(
prind-moonraker-1  | confighelper.ConfigError: Configuration File Not Found: '/opt/cfg/moonraker.cfg''
prind-moonraker-1  | [moonraker.py:main()] - Server Shutdown
prind-moonraker-1 exited with code 1

Howerver I didn't made any change in prind file structure, moonraker.cfg is located at config/ directory and I can see the volume mappings in docker-compose.yml.

Any clues?

404 on klippy.log

In fluidd or mainsail I can't download the klippy.log file, I received a 404 error.

2021-11-25 04:28:49,537 [app.py:log_request()] - 404 GET /server/files/klippy.log?token=Q2KBS22TXR46W3O4EADRPI63NCAZQCND&date=1637814525084 (192.168.2.13) [TRUSTED_USER] 1.49ms

Device share between containers

Hi,

I'm trying to use Octoprint frontend with Klipper.
I can connect with Klipper container to my printer, but Octoprint container can't because USB device is busy.
And if I connect Octoprint container with USB device then Klipper container is unable to connect.

So my question is:
How to connect Klipper container with printer and use this connection in Octoprint container.

Ensure minimal ressources for klipper (and moonraker)

I enjoy this project because it allows me to easily drive my 3D printer on my home server (which is not a dedicated raspberry pi).

However, the Klipper documentation makes clear that this setup has it's drawbacks:

If you are looking to run the Klipper host software on a shared general-purpose desktop or server class machine, then note that Klipper has some real-time scheduling requirements. If, during a print, the host computer also performs an intensive general-purpose computing task (such as defragmenting a hard drive, 3d rendering, heavy swapping, etc.), then it may cause Klipper to report print errors.

https://www.klipper3d.org/FAQ.html#can-i-run-klipper-on-something-other-than-a-raspberry-pi-3

A way to overcome this issue could be to guarantee a reasonable amount of resources to the klipper container (and maybe also to the moonraker container?)

This could possibly be achieved by reserving cpu shares and memory by adding

cpu_shares: 2048
mem_reservation: 256m

to the services klipper (and moonraker). See https://docs.docker.com/compose/compose-file/compose-file-v2/#cpu-and-other-resources

I apology if this is not a useful idea - I used klipper with octopi for a long time on my raspberry pi and I just start moving things to my home server.

Klipppy logs state that serial device can't be found

Here is the klippy.log:

Starting Klippy...
Args: ['klipper/klippy/klippy.py', '-I', 'run/klipper.tty', '-a', 'run/klipper.sock', 'cfg/printer.cfg', '-l', 'log/klippy.log']
Git version: '?'
CPU: 4 core Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz
Python: '2.7.18 (default, Apr 20 2020, 19:34:11) \n[GCC 8.3.0]'
Start printer at Wed Aug 31 01:51:26 2022 (1661910686.5 8174.5)
===== Config file =====
[mcu]
serial = /dev/ttymxc3

[printer]
kinematics = cartesian
max_velocity = 500
max_accel = 3000
max_z_velocity = 25
max_z_accel = 30

[virtual_sdcard]
path = /opt/gcode

[display_status]

[pause_resume]

[gcode_macro PAUSE]
description = Pause the actual running print
rename_existing = PAUSE_BASE
variable_extrude = 1.0
gcode = 
	{% set E = printer["gcode_macro PAUSE"].extrude|float %}
	{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
	{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
	{% set max_z = printer.toolhead.axis_maximum.z|float %}
	{% set act_z = printer.toolhead.position.z|float %}
	{% if act_z < (max_z - 2.0) %}
	{% set z_safe = 2.0 %}
	{% else %}
	{% set z_safe = max_z - act_z %}
	{% endif %}
	PAUSE_BASE
	G91
	{% if printer.extruder.can_extrude|lower == 'true' %}
	G1 E-{E} F2100
	{% else %}
	{action_respond_info("Extruder not hot enough")}
	{% endif %}
	{% if "xyz" in printer.toolhead.homed_axes %}
	G1 Z{z_safe} F900
	G90
	G1 X{x_park} Y{y_park} F6000
	{% else %}
	{action_respond_info("Printer not homed")}
	{% endif %}

[gcode_macro RESUME]
description = Resume the actual running print
rename_existing = RESUME_BASE
gcode = 
	{% set E = printer["gcode_macro PAUSE"].extrude|float %}
	{% if 'VELOCITY' in params|upper %}
	{% set get_params = ('VELOCITY=' + params.VELOCITY)  %}
	{%else %}
	{% set get_params = "" %}
	{% endif %}
	{% if printer.extruder.can_extrude|lower == 'true' %}
	G91
	G1 E{E} F2100
	{% else %}
	{action_respond_info("Extruder not hot enough")}
	{% endif %}
	RESUME_BASE {get_params}

[gcode_macro CANCEL_PRINT]
description = Cancel the actual running print
rename_existing = CANCEL_PRINT_BASE
gcode = 
	TURN_OFF_HEATERS
	CANCEL_PRINT_BASE
=======================
Config error
Traceback (most recent call last):
  File "klipper/klippy/klippy.py", line 175, in _connect
    self._read_config()
  File "klipper/klippy/klippy.py", line 143, in _read_config
    m.add_printer_objects(config)
  File "/opt/klipper/klippy/toolhead.py", line 599, in add_printer_objects
    config.get_printer().add_object('toolhead', ToolHead(config))
  File "/opt/klipper/klippy/toolhead.py", line 256, in __init__
    self.kin = mod.load_kinematics(self, config)
  File "/opt/klipper/klippy/kinematics/cartesian.py", line 142, in load_kinematics
    return CartKinematics(toolhead, config)
  File "/opt/klipper/klippy/kinematics/cartesian.py", line 16, in __init__
    for n in 'xyz']
  File "/opt/klipper/klippy/stepper.py", line 422, in LookupMultiRail
    default_position_endstop, units_in_radians)
  File "/opt/klipper/klippy/stepper.py", line 302, in __init__
    self.add_extra_stepper(config)
  File "/opt/klipper/klippy/stepper.py", line 372, in add_extra_stepper
    stepper = PrinterStepper(config, self.stepper_units_in_radians)
  File "/opt/klipper/klippy/stepper.py", line 238, in PrinterStepper
    step_pin = config.get('step_pin')
  File "/opt/klipper/klippy/configfile.py", line 58, in get
    note_valid=note_valid)
  File "/opt/klipper/klippy/configfile.py", line 33, in _get_wrapper
    % (option, self.section))
Error: Option 'step_pin' in section 'stepper_x' must be specified
webhooks client 139881473585632: New connection
webhooks client 139881473585632: Client info {'program': 'Moonraker', 'version': '?'}
webhooks client 139881473585632: Disconnected
Restarting printer
Start printer at Wed Aug 31 01:51:56 2022 (1661910716.6 8204.6)
===== Config file =====
[stepper_x]
step_pin = PC2
dir_pin = PB9
enable_pin = !PC3
microsteps = 16
rotation_distance = 40
endstop_pin = ^PA5
position_endstop = 0
position_max = 235
homing_speed = 50

[stepper_y]
step_pin = PB8
dir_pin = PB7
enable_pin = !PC3
microsteps = 16
rotation_distance = 40
endstop_pin = ^PA6
position_endstop = 0
position_max = 235
homing_speed = 50

[stepper_z]
step_pin = PB6
dir_pin = !PB5
enable_pin = !PC3
microsteps = 16
rotation_distance = 8
endstop_pin = probe:z_virtual_endstop
position_max = 250

[extruder]
max_extrude_only_distance = 100.0
step_pin = PB4
dir_pin = PB3
enable_pin = !PC3
microsteps = 16
rotation_distance = 32.8542094456
nozzle_diameter = 0.400
filament_diameter = 1.750
heater_pin = PA1
sensor_type = EPCOS 100K B57560G104F
sensor_pin = PC5
control = pid
pid_kp = 21.527
pid_ki = 1.063
pid_kd = 108.982
min_temp = 0
max_temp = 250

[heater_bed]
heater_pin = PA2
sensor_type = EPCOS 100K B57560G104F
sensor_pin = PC4
control = pid
pid_kp = 54.027
pid_ki = 0.770
pid_kd = 948.182
min_temp = 0
max_temp = 130

[fan]
pin = PA0

[mcu]
serial = /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
restart_method = command

[printer]
kinematics = cartesian
max_velocity = 300
max_accel = 3000
max_z_velocity = 5
max_z_accel = 100

[respond]
default_type = command

[pause_resume]
recover_velocity = 50

[bltouch]
sensor_pin = ^PB1
control_pin = PB0
x_offset = -40.5
y_offset = -13.7
z_offset = 1.59

[safe_z_home]
home_xy_position = 117.5,117.5
z_hop = 10

[bed_mesh]
speed = 120
horizontal_move_z = 5
mesh_min = 15, 15
mesh_max = 205, 205
probe_count = 5,3
algorithm = bicubic
fade_start = 1
fade_end = 10
fade_target = 0

[screws_tilt_adjust]
screw1 = 70.5,37.5
screw1_name = front left screw
screw2 = 240,37.5
screw2_name = front right screw
screw3 = 240,207.5
screw3_name = rear right screw
screw4 = 70.5,207.5
screw4_name = rear left screw
horizontal_move_z = 10
speed = 50
screw_thread = CW-M4
=======================
bed_mesh: bicubic interpolation with a probe_count of less than 4 points detected.  Forcing lagrange interpolation. Configured Probe Count: 5, 3
Extruder max_extrude_ratio=0.266081
mcu 'mcu': Starting serial connect
mcu 'mcu': Unable to open serial port: [Errno 2] could not open port /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0: [Errno 2] No such file or directory: '/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0'
webhooks client 139881472119984: New connection
webhooks client 139881472119984: Client info {'program': 'Moonraker', 'version': '?'}
mcu 'mcu': Unable to open serial port: [Errno 2] could not open port /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0: [Errno 2] No such file or directory: '/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0'

As you can see it is referencing a /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0 device. In the overrides file I specified - "/dev/ttyUSB0:/dev/ttymxc3" so I'm not even sure where the firmware got that value from. Read the host's serial connections in /dev/ maybe?

Anyway I was also able to confirm that the device it says it cannot find does actually exist in /dev/serial/by-id/ so I'm not sure why it can't seem to find it.

Suggestions?

Multiple Printers

Hi Mkuf, I am using Fluidd of your repo.
Since It is run by docker so I am going to use two Fluidd docker images connecting two my printers.
I managed to run those at 2 different ports (port 80 and port 4040) and different names.
Does your repo support it?
Since I have no luck on this, if I run one printer, it worked fine but the second docker always got "gateway timeout" when accessing, this is my docker ps:

CONTAINER ID   IMAGE                    COMMAND                  CREATED              STATUS              PORTS                  NAMES
70d6ea3415aa   mkuf/moonraker:nightly   "/opt/venv/bin/pytho…"   39 seconds ago       Up 29 seconds       7125/tcp               moonraker
7a94c3d27ea3   mkuf/klipper:nightly     "/opt/venv/bin/pytho…"   41 seconds ago       Up 32 seconds                              klipper
96924e337fe9   cadriel/fluidd:latest    "/docker-entrypoint.…"   About a minute ago   Up About a minute   80/tcp                 fluidd
bd613ee549d5   traefik:v2.5             "/entrypoint.sh --ac…"   About a minute ago   Up About a minute   0.0.0.0:80->80/tcp     traefik
2803c1001972   mkuf/ustreamer:nightly   "/opt/ustreamer/ustr…"   About a minute ago   Up About a minute   8080/tcp               webcam
0f484b960720   mkuf/moonraker:nightly   "/opt/venv/bin/pytho…"   6 minutes ago        Up 5 minutes        7125/tcp               moonraker2
5c2b161da6a4   mkuf/klipper:nightly     "/opt/venv/bin/pytho…"   6 minutes ago        Up 5 minutes                               klipper2
8965501a7d74   cadriel/fluidd:latest    "/docker-entrypoint.…"   6 minutes ago        Up 5 minutes        80/tcp                 fluidd2
ec11cc5c878b   mkuf/ustreamer:nightly   "/opt/ustreamer/ustr…"   6 minutes ago        Up 6 minutes        8080/tcp               webcam2
24cea8ee0cdd   traefik:v2.5             "/entrypoint.sh --ac…"   6 minutes ago        Up 5 minutes        0.0.0.0:4040->80/tcp   traefik2

Could you give me some advice? Thanks in advance.

Need extra permissions set in init

Thank you for the fix for #40 but I seem to still run into an issue with moonraker.

root@trex:~/prind# docker compose run moonraker
[+] Running 4/4
 ⠿ Network prind_default        Created                                                                                                                                                                                                0.3s
 ⠿ Volume "prind_moonraker-db"  Created                                                                                                                                                                                                0.0s
 ⠿ Container prind-init-1       Created                                                                                                                                                                                                0.2s
 ⠿ Container prind-klipper-1    Created                                                                                                                                                                                                0.2s
[+] Running 2/2
 ⠿ Container prind-init-1     Exited                                                                                                                                                                                                   2.0s
 ⠿ Container prind-klipper-1  Started                                                                                                                                                                                                  1.5s
[utils.py:setup_logging()] - data_path: /opt/printer_data
[utils.py:setup_logging()] - is_default_data_path: False
[utils.py:setup_logging()] - config_file: /opt/printer_data/config/moonraker.conf
[utils.py:setup_logging()] - startup_warnings: []
[utils.py:setup_logging()] - verbose: False
[utils.py:setup_logging()] - debug: False
[utils.py:setup_logging()] - asyncio_debug: False
[utils.py:setup_logging()] - log_file: /opt/printer_data/logs/moonraker.log
[utils.py:setup_logging()] - software_version: ?
[utils.py:setup_logging()] - python_version: 3.10.8 (main, Oct 13 2022, 22:47:45) [GCC 10.2.1 20210110]
[confighelper.py:read_file()] - Configuration File '/opt/printer_data/config/moonraker.conf' parsed, total size: 240 B
[moonraker.py:add_log_rollover_item()] -
#################### Moonraker Configuration ####################

[server]
host = 0.0.0.0
port = 7125
klippy_uds_address = /opt/printer_data/run/klipper.sock

[machine]
provider = systemd_cli
validate_service = False

[authorization]
trusted_clients =
	0.0.0.0/0
cors_domains =
	*

[octoprint_compat]

[history]

#################################################################
All Configuration Files:
/opt/printer_data/config/moonraker.conf
#################################################################
[app.py:register_local_handler()] - Registering HTTP Endpoint: (GET) /server/info
[websockets.py:register_api_handler()] - Registering Websocket JSON-RPC methods: server.info
[app.py:register_local_handler()] - Registering HTTP Endpoint: (GET) /server/config
[websockets.py:register_api_handler()] - Registering Websocket JSON-RPC methods: server.config
[app.py:register_local_handler()] - Registering HTTP Endpoint: (POST) /server/restart
[websockets.py:register_api_handler()] - Registering Websocket JSON-RPC methods: server.restart
[moonraker.py:load_component()] - Component (dbus_manager) loaded
[moonraker.py:load_component()] - Unable to load component: (database)
Traceback (most recent call last):
  File "/opt/moonraker/moonraker/moonraker.py", line 250, in load_component
    component = load_func(config)
  File "/opt/moonraker/moonraker/components/database.py", line 944, in load_component
    return MoonrakerDatabase(config)
  File "/opt/moonraker/moonraker/components/database.py", line 103, in __init__
    self.lmdb_env = lmdb.open(self.database_path, map_size=MAX_DB_SIZE,
lmdb.ReadonlyError: /opt/printer_data/database: Permission denied
[moonraker.py:main()] - Moonraker Error
Traceback (most recent call last):
  File "/opt/moonraker/moonraker/moonraker.py", line 250, in load_component
    component = load_func(config)
  File "/opt/moonraker/moonraker/components/database.py", line 944, in load_component
    return MoonrakerDatabase(config)
  File "/opt/moonraker/moonraker/components/database.py", line 103, in __init__
    self.lmdb_env = lmdb.open(self.database_path, map_size=MAX_DB_SIZE,
lmdb.ReadonlyError: /opt/printer_data/database: Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/moonraker/moonraker/moonraker.py", line 497, in main
    server.load_components()
  File "/opt/moonraker/moonraker/moonraker.py", line 227, in load_components
    self.load_component(config, component)
  File "/opt/moonraker/moonraker/moonraker.py", line 257, in load_component
    raise ServerError(msg)
utils.ServerError: Unable to load component: (database)
[moonraker.py:main()] - Server Shutdown

Ok so lets override the entry point to see what is going on.

~/prind# docker compose run --entrypoint="bash" moonraker
moonraker@f52f5db8f1e2:/opt$ ls -lsah printer_data/
total 20K
4.0K drwxr-xr-x 7 moonraker moonraker 4.0K Oct 19 09:33 .
4.0K drwxr-xr-x 1 root      root      4.0K Oct 19 09:33 ..
4.0K drwxr-xr-x 2 moonraker moonraker 4.0K Oct 19 05:53 config
4.0K drwxr-xr-x 2 root      root      4.0K Oct 19 09:25 database
4.0K drwxr-xr-x 2 root      root      4.0K Oct 19 09:25 gcodes
   0 drwxrwxrwt 2 root      root        80 Oct 19 09:26 logs
   0 drwxrwxrwt 2 root      root        80 Oct 19 09:25 run

Ok so you already have the init container/service which I believe can fix this.

So after changing it to:

  init:
    image: busybox:latest
    command: chown -R 1000:1000 /prind/config /opt/gcodes /opt/database
    volumes:
      - .:/prind
      - gcode:/opt/gcodes
      - moonraker-db:/opt/database

I was able to get moonraker finally to run.

How can I setup so that there is a live video, without delays?

Host PC:
GA-3000-BASE
Intel Celeron
WI-FI 5G: 6.0 Mbit/s, 20 MHz, 54.0 Mbit/s, 40 MHz, VHT-MCS 3, VHT-NSS 1
Ubuntu latest
Klipper and Moonraker latest
Webcam Logitech C-270 1290x960 30 c/sec
Ustreamer start with ustreamer.service:
[Unit]
Description=uStreamer service
After=network.target
[Service]
User=ustreamer
ExecStart=/usr/local/bin/ustreamer --process-name-prefix ustreamer-0 --log-level 0 --device=/dev/video0 --device-timeout=8 --resolution=1280x960 --desired-fps=20 --format=MJPEG --encoder=NOOP --quality=100 --host=0.0.0.0 --port=8080 --workers=1 --static /var/www/html/ustreamer-0/
[Install]
WantedBy=multi-user.target

But FPS very slow (1-15)
And very large image delays 20-30 s

How can I set it up so that there is a live video, without delays?

Upstream Adoption

This Issue is intended to track the Progress of migrating the Dockerfiles of this repository into their respective upstream Repositories.

Application Upstream Pullrequest Status
Klipper Klipper3d/klipper#4844 No feedback received for over 12 Months Klipper3d/klipper#4844 (comment)
Moonraker Arksine/moonraker#253 Docker is considered a different form of Installation Method and should therefore reside in it's own Repo, comparable to kiauh.
A reference to prind was added to moonrakers README.md
Mainsail mainsail-crew/mainsail#296 (comment) Since mainsail-crew/mainsail@958864b, the Mainsail Project creates their own Docker images, that are basically identical to the ones from this project, minus the (as of 08.02.2022) missing versioning
Update: as of today (09.07.2022), prind is using the official Mainsail docker image

Broken webcam config

Fluidd & Mainsail can not serve the ustreamer stream in the provided configuration. Mainsail & Fluidd are reaching out to '/webcam', but the traefik path prefix is '/stream'.

Changing the path prefix to '/webcam' is not enough, as the '/webcam' path reaches ustreamer, which doesn't know what to do with it. Changing the default ustreamer service config to:

  ustreamer:
    <<: *ustreamer-svc
    container_name: ustreamer
    devices:
      - /dev/video0:/dev/webcam
    labels:
      - "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"

fixes the issue, and Mainsail & Fluidd can serve the first webcam. I can submit a PR for this if required.

cant flash controller

I could successfully compile the firmware within the container. however - if I try to flash it to I get the error:

WARN[0000] Found orphan containers ([prind-fluidd-1 prind-moonraker-1 prind-klipper-1 prind-octoprint-1 prind-klipper-priv-1 prind-mainsail-1]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. 
  Building hid-flash
/bin/sh: 1: pkg-config: not found
    hid-flash requires libusb-1.0, please install with:
    sudo apt-get install libusb-1.0
  Flashing out/klipper.bin to /dev/ttyACM1
Entering bootloader on /dev/ttyACM1
Device reconnect on /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5:1.0
sudo dfu-util -p 1-1.5 -R -a 0 -s 0x8008000:leave -D out/klipper.bin

Traceback (most recent call last):
  File "./scripts/flash_usb.py", line 386, in <module>
    main()
  File "./scripts/flash_usb.py", line 383, in main
    flash_func(options, args[0])
  File "./scripts/flash_usb.py", line 313, in flash_stm32f4
    ["-R", "-a", "0", "-s", start], options.sudo)
  File "./scripts/flash_usb.py", line 156, in flash_dfuutil
    call_dfuutil(["-p", buspath] + extra_flags, binfile, sudo)
  File "./scripts/flash_usb.py", line 139, in call_dfuutil
    res = subprocess.call(args)
  File "/usr/lib/python3.6/subprocess.py", line 287, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'sudo': 'sudo'
src/stm32/Makefile:97: recipe for target 'flash' failed
make: *** [flash] Error 1

Fluidd can't reach Moonraker

When starting the stack without the -d option, this is the log:

Attaching to fluidd, klipper, moonraker, traefik, ustreamer
ustreamer | -- INFO [10493.930 main] -- Using internal blank placeholder
ustreamer | -- INFO [10493.931 main] -- Listening HTTP on [0.0.0.0]:8080
ustreamer | -- INFO [10493.931 http] -- Starting HTTP eventloop ...
ustreamer | -- INFO [10493.932 stream] -- Using V4L2 device: /dev/webcam
ustreamer | -- INFO [10493.932 stream] -- Using desired FPS: 30
ustreamer | ================================================================================
traefik | time="2022-02-25T21:00:24Z" level=info msg="Configuration loaded from flags."
ustreamer | -- INFO [10494.020 stream] -- Device fd=8 opened
ustreamer | -- INFO [10494.021 stream] -- Using input channel: 0
ustreamer | -- ERROR [10494.022 stream] -- Requested resolution=1280x960 is unavailable
ustreamer | -- INFO [10494.022 stream] -- Using resolution: 1280x720
ustreamer | -- INFO [10494.023 stream] -- Using pixelformat: MJPEG
ustreamer | -- INFO [10494.024 stream] -- Using HW FPS: 30
ustreamer | -- ERROR [10494.024 stream] -- Device does not support setting of HW encoding quality parameters
ustreamer | -- INFO [10494.024 stream] -- Using IO method: MMAP
ustreamer | -- INFO [10494.037 stream] -- Requested 5 device buffers, got 5
ustreamer | -- INFO [10494.270 stream] -- Capturing started
ustreamer | -- INFO [10494.270 stream] -- Switching to HW encoder: the input is (M)JPEG ...
ustreamer | -- INFO [10494.270 stream] -- Using JPEG quality: encoder default
ustreamer | -- INFO [10494.270 stream] -- Creating pool JPEG with 1 workers ...
ustreamer | -- INFO [10494.270 stream] -- Capturing ...
moonraker | Traceback (most recent call last):
moonraker | File "/opt/moonraker/moonraker/moonraker.py", line 16, in
moonraker | import logging
moonraker | File "/usr/local/lib/python3.10/logging/init.py", line 57, in
moonraker | _startTime = time.time()
moonraker | PermissionError: [Errno 1] Operation not permitted
moonraker exited with code 1
fluidd | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
fluidd | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
fluidd | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
fluidd | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
fluidd | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
fluidd | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
fluidd | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
fluidd | /docker-entrypoint.sh: Configuration complete; ready for start up
fluidd | 2071/07/11 08:16:40 [notice] 1#1: using the "epoll" event method
fluidd | 2071/07/11 08:16:40 [notice] 1#1: nginx/1.21.1
fluidd | 2071/07/11 08:16:40 [notice] 1#1: built by gcc 10.3.1 20210424 (Alpine 10.3.1_git20210424)
fluidd | 2071/07/11 08:16:40 [notice] 1#1: OS: Linux 5.10.63-v7l+
fluidd | 2071/07/11 08:16:40 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
fluidd | 2071/07/11 08:16:40 [notice] 1#1: start worker processes
fluidd | 2071/07/11 08:16:40 [notice] 1#1: start worker process 31
fluidd | 2071/07/11 08:16:40 [notice] 1#1: start worker process 32
fluidd | 2071/07/11 08:16:40 [notice] 1#1: start worker process 33
fluidd | 2071/07/11 08:16:40 [notice] 1#1: start worker process 34
moonraker | Traceback (most recent call last):
moonraker | File "/opt/moonraker/moonraker/moonraker.py", line 16, in
moonraker | import logging
moonraker | File "/usr/local/lib/python3.10/logging/init.py", line 57, in
moonraker | _startTime = time.time()
moonraker | PermissionError: [Errno 1] Operation not permitted
moonraker exited with code 1
traefik | time="2022-02-25T21:00:27Z" level=error msg="service "moonraker" error: unable to find the IP address for the container "/moonraker": the server is ignored" providerName=docker container=moonraker-prind-3c4940dd2b1c9573739041869997c142031cd9277d8ebf8cecc9c42032914062
moonraker | Traceback (most recent call last):
moonraker | File "/opt/moonraker/moonraker/moonraker.py", line 16, in
moonraker | import logging
moonraker | File "/usr/local/lib/python3.10/logging/init.py", line 57, in
moonraker | _startTime = time.time()

These last 7 lines are then repeated over and over again.

Setting up project in portainer

I am currently using the klipper-web-control-docker project for controlling my printer from my nas, but I discovered this project and I am interested in trying it out.

Is there documentation on how to set it up in Portainer? My biggest issue is having to populate the docker-compose.override.yaml, which I don't think it's possible in Portainer

klipper container in docker-compose can't access config_spi or host version

I'm looking to run prind containers in a simpler docker-compose config:

version: "3.9"

services:
  app:
    image: "mkuf/klipper:722ad4a"
    restart: "always"
    devices:
      - "/dev/serial/by-id/usb-Klipper_stm32f429xx_3C0032001350304738313820-if00:/dev/ttyUSB0"
    volumes:
      - "$PWD/../../configs/klipper:/opt/cfg"
      - "klipper-gcode:/opt/gcode"
      - "klipper-run:/opt/run"
      - "klipper-log:/opt/log"
    command:
      - "-l"
      - "log/klippy.log"
      - "-I"
      - "run/klipper.tty"
      - "-a"
      - "run/klipper.sock"
      - "cfg/printer.cfg"
    networks:
      - "gateway"

  api:
    image: "mkuf/moonraker:cd520ba"
    restart: "always"
    depends_on:
      - "perms"
      - "app"
    volumes:
      - "$PWD/../../configs/klipper:/opt/cfg"
      - "/dev/null:/opt/klipper/config/null"
      - "/dev/null:/opt/klipper/docs/null"
      - "/run/dbus:/run/dbus"
      - "/run/systemd:/run/systemd"
      - "klipper-db:/opt/dbdoc"
      - "klipper-gcode:/opt/gcode"
      - "klipper-run:/opt/run"
      - "klipper-log:/opt/log"
    command:
      - "-l"
      - "log/moonraker.log"
      - "-c"
      - "cfg/moonraker.cfg"
    ports:
      - "80:7125"
    networks:
      - "gateway"

  perms:
    image: "busybox:latest"
    volumes:
      - "$PWD/../../configs/klipper:/opt/cfg"
    command: "chown 1000:1000 /opt/cfg/*.cfg"

volumes:
  klipper-db:
    name: "klipper-db"
  klipper-gcode:
    name: "klipper-gcode"
  klipper-run:
    name: "klipper-run"
    driver_opts:
      type: "tmpfs"
      device: "tmpfs"
  klipper-log:
    name: "klipper-log"
    driver_opts:
      type: "tmpfs"
      device: "tmpfs"

networks:
  gateway:
    name: "gateway"
    driver: "bridge"

As you can see, it's just moonraker and klipper but simplified from the docker-compose.yml in prind repo. However when I connect to moonraker with fluidd, this is the error I receive on FIRMWARE_RESTART:

mcu 'mcu': Unable to extract params from: config_spi

This type of error is frequently caused by running an older
version of the firmware on the micro-controller (fix by
recompiling and flashing the firmware).

Known versions: host=?, mcu=v0.10.0-324-g91ba9c00

Once the underlying issue is corrected, use the "RESTART"
command to reload the config and restart the host software.
Protocol error connecting to printer

Tihs error occurs even when running prind using the repo's docker-compose.yml. It feels like I'm missing some property in docker-compose.yml and preventing klipper from grabbing the host or config_spi data. Any ideas?

Reconnect to printer if it has been power cycled

Not sure how feasible this is or if there is already a way of doing it, but I always had this issue with "klipper on docker" projects: if I start the klipper container while the printer is on I don't have issues. If I power cycle the printer (turn it off and then on again, the docker containers are hosted on my nas) then I cannot reconnect to it, until I restart the klipper container. Is there a way of making sure that the connection is recovered or the container is restarted automatically? Failure to connect to the printer doesn't exit the klipper process so even adding a restart: always directive to the container doesn't work

Upstream Moonraker address is configurable

in the Mainsail Docker image:

Currently it looks like the upstream server is hardcoded to be the same host. but in a docker environment it would be ideal if the docker instance can be passed as an env the address of moonraker. for example, this would work better if your moonraker is in a independent docker and only exposed to other docker instance within the same docker-compose. you could reference the address just by its hostname:7125/api.

I assume a solution would require overriding the upstream address in the NGINX config which I think, currently is simply being copied from the Mainsail main repo - I'm still digging through this to validate.

Where is /tmp/printer?

I'm running Octoprint in a separate container, on a separate port so that there is no interference, but when I attach to the klipper container, there is nothing in /tmp (using Mainsail profile currently). Do I have to actually switch my profile to Octoprint? The only reason I need to have both running is because it seems to be easier to run Obico (TSD) in Octoprint rather than Mainsail/Fluidd.

klipperscreen: Connection refused & Failed to initialize Gtk

my prind-klipperscreen container show this errors.
how to fix it?

image

prind-klipperscreen-1  | Unable to init server: Could not connect: Connection refused
prind-klipperscreen-1  | Unable to init server: Could not connect: Connection refused
prind-klipperscreen-1  | 2022-12-07 21:30:58,577 [screen.py:main()] - KlipperScreen version: v0.2.9-104-g36faaa1
prind-klipperscreen-1  | Unable to init server: Could not connect: Connection refused
prind-klipperscreen-1  | 2022-12-07 21:30:58,579 [screen.py:main()] - Failed to initialize Gtk
prind-klipperscreen-1 exited with code 1

image

## System Info 
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
  compose: Docker Compose (Docker Inc., v2.12.2)

Server:
 Containers: 7
  Running: 4
  Paused: 0
  Stopped: 3
 Images: 7
 Server Version: 20.10.21
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 770bd0108c32f3fb5c73ae1264f7e503fe7b2661
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.80-flippy-79+o
 Operating System: Armbian 23.02.0-trunk Bullseye
 OSType: linux
 Architecture: aarch64
 CPUs: 4
 Total Memory: 1.908GiB
 Name: armbian
 ID: N6NJ:FV4T:DDRX:P5ZQ:EIRQ:VCVA:MYE2:M4HO:2OCH:PTK3:NBLG:F4HC
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://mirror.baidubce.com/
  https://hub-mirror.c.163.com/
 Live Restore Enabled: false


## Compose Version 
Docker Compose version v2.12.2

## System df 
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          7         7         1.192GB   121.7MB (10%)
Containers      7         5         4.625MB   0B (0%)
Local Volumes   2         2         73.79kB   0B (0%)
Build Cache     0         0         0B        0B

## Docker Images 
REPOSITORY           TAG       IMAGE ID       CREATED         SIZE
cadriel/fluidd       latest    186487fc7c78   2 days ago      32.7MB
mkuf/klipperscreen   latest    1bb7590d0309   3 days ago      437MB
mkuf/klipper         latest    b7eedd2ed1e1   4 days ago      390MB
mkuf/ustreamer       latest    e43f13d50832   4 days ago      91.4MB
mkuf/moonraker       latest    367c442017c8   4 days ago      262MB
busybox              latest    73a648b1404c   2 weeks ago     1.46MB
traefik              v2.5      09bdb197fc5d   10 months ago   99MB

## Disk Space 
Filesystem      Size  Used Avail Use% Mounted on
udev            841M     0  841M   0% /dev
tmpfs           196M  7.8M  188M   4% /run
/dev/sda2        14G  5.0G  8.8G  37% /
tmpfs           978M     0  978M   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           978M  4.7M  973M   1% /tmp
/dev/sda1       252M  110M  142M  44% /boot
/dev/zram1       49M  5.7M   40M  13% /var/log
tmpfs           196M     0  196M   0% /run/user/0
overlay          14G  5.0G  8.8G  37% /var/lib/docker/overlay2/ecb87c695e6c36ff560b579ec2fc5cf22dc6677b61405f67be2f6b973fa9ba9a/merged
overlay          14G  5.0G  8.8G  37% /var/lib/docker/overlay2/be87b7148eb7e8783406dd4be8a45a4d5315d307192c283ccbe114d4c079b535/merged
overlay          14G  5.0G  8.8G  37% /var/lib/docker/overlay2/e38b3062dc8e461df4cc9f8c6b9f63e8c53b0cee8262fab89a8b0e3e9d5946ba/merged
tmpfs           978M     0  978M   0% /var/lib/docker/volumes/prind_run/_data
tmpfs           978M   36K  977M   1% /var/lib/docker/volumes/prind_log/_data
overlay          14G  5.0G  8.8G  37% /var/lib/docker/overlay2/606f7599cb77eaf9f3660a405136e3c27ed129950c6cf51aa9c045d7911066a1/merged

## Connected devices 
total 0
crw-r--r-- 1 root root     10, 235 Dec  6 23:17 autofs
drwxr-xr-x 2 root root         460 Dec  6 23:17 block
drwxr-xr-x 2 root root          60 Jan  1  1970 bsg
crw-rw---- 1 root disk     10, 234 Dec  6 23:17 btrfs-control
drwxr-xr-x 3 root root          60 Jan  1  1970 bus
crw-rw---- 1 root video   249,   0 Dec  6 23:17 cec0
drwxr-xr-x 2 root root        3060 Dec  7 21:21 char
crw--w---- 1 root tty       5,   1 Dec  6 23:17 console
crw------- 1 root root     10, 124 Dec  6 23:17 cpu_dma_latency
crw------- 1 root root     10, 203 Dec  6 23:17 cuse
drwxr-xr-x 7 root root         140 Jan  1  1970 disk
drwxr-xr-x 3 root root         120 Dec  6 23:17 dri
crw-rw---- 1 root video    29,   0 Dec  6 23:17 fb0
lrwxrwxrwx 1 root root          13 Aug  7 21:25 fd -> /proc/self/fd
crw-rw-rw- 1 root root      1,   7 Dec  6 23:17 full
crw-rw-rw- 1 root root     10, 229 Dec  6 23:17 fuse
crw------- 1 root root    254,   0 Dec  6 23:17 gpiochip0
crw------- 1 root root    254,   1 Dec  6 23:17 gpiochip1
drwxr-xr-x 2 root root           0 Aug  7 21:25 hugepages
crw------- 1 root root     10, 183 Dec  6 23:17 hwrng
crw-rw---- 1 root i2c      89,   0 Dec  6 23:17 i2c-0
crw-rw---- 1 root i2c      89,   1 Dec  6 23:17 i2c-1
crw-rw---- 1 root i2c      89,   2 Dec  6 23:17 i2c-2
crw-rw---- 1 root i2c      89,   3 Dec  6 23:17 i2c-3
lrwxrwxrwx 1 root root          12 Aug  7 21:25 initctl -> /run/initctl
drwxr-xr-x 3 root root         120 Dec  6 23:17 input
crw-r--r-- 1 root root      1,  11 Dec  6 23:17 kmsg
crw-rw---- 1 root kvm      10, 232 Dec  6 23:17 kvm
crw-rw---- 1 root video   250,   0 Dec  6 23:17 lirc0
lrwxrwxrwx 1 root root          28 Aug  7 21:25 log -> /run/systemd/journal/dev-log
brw-rw---- 1 root disk      7,   0 Dec  6 23:17 loop0
brw-rw---- 1 root disk      7,   1 Dec  6 23:17 loop1
brw-rw---- 1 root disk      7,   2 Dec  6 23:17 loop2
brw-rw---- 1 root disk      7,   3 Dec  6 23:17 loop3
brw-rw---- 1 root disk      7,   4 Dec  6 23:17 loop4
brw-rw---- 1 root disk      7,   5 Dec  6 23:17 loop5
brw-rw---- 1 root disk      7,   6 Dec  6 23:17 loop6
brw-rw---- 1 root disk      7,   7 Dec  6 23:17 loop7
crw-rw---- 1 root disk     10, 237 Dec  6 23:17 loop-control
drwxr-xr-x 2 root root          60 Dec  6 23:17 mapper
crw-r----- 1 root kmem      1,   1 Dec  6 23:17 mem
brw-rw---- 1 root disk    179,   0 Dec  6 23:17 mmcblk2
brw-rw---- 1 root disk    179,  32 Dec  6 23:17 mmcblk2boot0
brw-rw---- 1 root disk    179,  64 Dec  6 23:17 mmcblk2boot1
crw------- 1 root root    240,   0 Dec  6 23:17 mmcblk2rpmb
drwxrwxrwt 2 root root          40 Jan  1  1970 mqueue
drwxr-xr-x 2 root root          60 Dec  6 23:17 net
crw-rw-rw- 1 root root      1,   3 Dec  6 23:17 null
crw-r----- 1 root kmem      1,   4 Dec  6 23:17 port
crw------- 1 root root    108,   0 Dec  6 23:17 ppp
crw------- 1 root root     10,   1 Dec  6 23:17 psaux
crw-rw-rw- 1 root tty       5,   2 Dec  7 22:04 ptmx
drwxr-xr-x 2 root root           0 Jan  1  1970 pts
brw-rw---- 1 root disk      1,   0 Dec  6 23:17 ram0
brw-rw---- 1 root disk      1,   1 Dec  6 23:17 ram1
brw-rw---- 1 root disk      1,   2 Dec  6 23:17 ram2
brw-rw---- 1 root disk      1,   3 Dec  6 23:17 ram3
crw-rw-rw- 1 root root      1,   8 Dec  6 23:17 random
crw-rw-r-- 1 root netdev   10, 242 Dec  6 23:17 rfkill
lrwxrwxrwx 1 root root           4 Dec  6 23:17 rtc -> rtc0
crw------- 1 root root    252,   0 Dec  6 23:17 rtc0
brw-rw---- 1 root disk      8,   0 Dec  6 23:17 sda
brw-rw---- 1 root disk      8,   1 Dec  6 23:17 sda1
brw-rw---- 1 root disk      8,   2 Dec  6 23:17 sda2
drwxr-xr-x 4 root root          80 Dec  7 21:21 serial
crw-rw---- 1 root disk     21,   0 Dec  6 23:17 sg0
drwxrwxrwt 2 root root          40 Aug  7 21:25 shm
drwxr-xr-x 3 root root         160 Dec  6 23:17 snd
lrwxrwxrwx 1 root root          15 Aug  7 21:25 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root          15 Aug  7 21:25 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root          15 Aug  7 21:25 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root tty       5,   0 Dec  6 23:17 tty
crw--w---- 1 root tty       4,   0 Dec  6 23:17 tty0
crw--w---- 1 root tty       4,   1 Dec  6 23:48 tty1
crw--w---- 1 root tty       4,  10 Dec  6 23:17 tty10
crw--w---- 1 root tty       4,  11 Dec  6 23:17 tty11
crw--w---- 1 root tty       4,  12 Dec  6 23:17 tty12
crw--w---- 1 root tty       4,  13 Dec  6 23:17 tty13
crw--w---- 1 root tty       4,  14 Dec  6 23:17 tty14
crw--w---- 1 root tty       4,  15 Dec  6 23:17 tty15
crw--w---- 1 root tty       4,  16 Dec  6 23:17 tty16
crw--w---- 1 root tty       4,  17 Dec  6 23:17 tty17
crw--w---- 1 root tty       4,  18 Dec  6 23:17 tty18
crw--w---- 1 root tty       4,  19 Dec  6 23:17 tty19
crw--w---- 1 root tty       4,   2 Dec  6 23:17 tty2
crw--w---- 1 root tty       4,  20 Dec  6 23:17 tty20
crw--w---- 1 root tty       4,  21 Dec  6 23:17 tty21
crw--w---- 1 root tty       4,  22 Dec  6 23:17 tty22
crw--w---- 1 root tty       4,  23 Dec  6 23:17 tty23
crw--w---- 1 root tty       4,  24 Dec  6 23:17 tty24
crw--w---- 1 root tty       4,  25 Dec  6 23:17 tty25
crw--w---- 1 root tty       4,  26 Dec  6 23:17 tty26
crw--w---- 1 root tty       4,  27 Dec  6 23:17 tty27
crw--w---- 1 root tty       4,  28 Dec  6 23:17 tty28
crw--w---- 1 root tty       4,  29 Dec  6 23:17 tty29
crw--w---- 1 root tty       4,   3 Dec  6 23:17 tty3
crw--w---- 1 root tty       4,  30 Dec  6 23:17 tty30
crw--w---- 1 root tty       4,  31 Dec  6 23:17 tty31
crw--w---- 1 root tty       4,  32 Dec  6 23:17 tty32
crw--w---- 1 root tty       4,  33 Dec  6 23:17 tty33
crw--w---- 1 root tty       4,  34 Dec  6 23:17 tty34
crw--w---- 1 root tty       4,  35 Dec  6 23:17 tty35
crw--w---- 1 root tty       4,  36 Dec  6 23:17 tty36
crw--w---- 1 root tty       4,  37 Dec  6 23:17 tty37
crw--w---- 1 root tty       4,  38 Dec  6 23:17 tty38
crw--w---- 1 root tty       4,  39 Dec  6 23:17 tty39
crw--w---- 1 root tty       4,   4 Dec  6 23:17 tty4
crw--w---- 1 root tty       4,  40 Dec  6 23:17 tty40
crw--w---- 1 root tty       4,  41 Dec  6 23:17 tty41
crw--w---- 1 root tty       4,  42 Dec  6 23:17 tty42
crw--w---- 1 root tty       4,  43 Dec  6 23:17 tty43
crw--w---- 1 root tty       4,  44 Dec  6 23:17 tty44
crw--w---- 1 root tty       4,  45 Dec  6 23:17 tty45
crw--w---- 1 root tty       4,  46 Dec  6 23:17 tty46
crw--w---- 1 root tty       4,  47 Dec  6 23:17 tty47
crw--w---- 1 root tty       4,  48 Dec  6 23:17 tty48
crw--w---- 1 root tty       4,  49 Dec  6 23:17 tty49
crw--w---- 1 root tty       4,   5 Dec  6 23:17 tty5
crw--w---- 1 root tty       4,  50 Dec  6 23:17 tty50
crw--w---- 1 root tty       4,  51 Dec  6 23:17 tty51
crw--w---- 1 root tty       4,  52 Dec  6 23:17 tty52
crw--w---- 1 root tty       4,  53 Dec  6 23:17 tty53
crw--w---- 1 root tty       4,  54 Dec  6 23:17 tty54
crw--w---- 1 root tty       4,  55 Dec  6 23:17 tty55
crw--w---- 1 root tty       4,  56 Dec  6 23:17 tty56
crw--w---- 1 root tty       4,  57 Dec  6 23:17 tty57
crw--w---- 1 root tty       4,  58 Dec  6 23:17 tty58
crw--w---- 1 root tty       4,  59 Dec  6 23:17 tty59
crw--w---- 1 root tty       4,   6 Dec  6 23:17 tty6
crw--w---- 1 root tty       4,  60 Dec  6 23:17 tty60
crw--w---- 1 root tty       4,  61 Dec  6 23:17 tty61
crw--w---- 1 root tty       4,  62 Dec  6 23:17 tty62
crw--w---- 1 root tty       4,  63 Dec  6 23:17 tty63
crw--w---- 1 root tty       4,   7 Dec  6 23:17 tty7
crw--w---- 1 root tty       4,   8 Dec  6 23:17 tty8
crw--w---- 1 root tty       4,   9 Dec  6 23:17 tty9
crw--w---- 1 root tty     244,   0 Dec  6 23:48 ttyAML0
crw-rw---- 1 root dialout   4,  64 Dec  6 23:17 ttyS0
crw-rw---- 1 root dialout   4,  65 Dec  6 23:17 ttyS1
crw-rw---- 1 root dialout   4,  66 Dec  6 23:17 ttyS2
crw-rw---- 1 root dialout   4,  67 Dec  6 23:17 ttyS3
crw-rw---- 1 root dialout   4,  68 Dec  6 23:17 ttyS4
crw-rw---- 1 root dialout 188,   0 Dec  7 21:21 ttyUSB0
crw-rw---- 1 root kvm      10, 126 Dec  6 23:17 udmabuf
crw------- 1 root root     10, 239 Dec  6 23:17 uhid
crw------- 1 root root     10, 223 Dec  6 23:17 uinput
crw------- 1 root root     10, 125 Dec  6 23:17 uleds
crw-rw-rw- 1 root root      1,   9 Dec  6 23:17 urandom
crw------- 1 root root    241,   0 Dec  6 23:17 usbmon0
crw------- 1 root root    241,   1 Dec  6 23:17 usbmon1
crw------- 1 root root    241,   2 Dec  6 23:17 usbmon2
drwxr-xr-x 3 root root          60 Dec  6 23:17 v4l
crw-rw---- 1 root tty       7,   0 Dec  6 23:17 vcs
crw-rw---- 1 root tty       7,   1 Dec  6 23:17 vcs1
crw-rw---- 1 root tty       7,   2 Dec  6 23:17 vcs2
crw-rw---- 1 root tty       7,   3 Dec  6 23:17 vcs3
crw-rw---- 1 root tty       7,   4 Dec  6 23:17 vcs4
crw-rw---- 1 root tty       7,   5 Dec  6 23:17 vcs5
crw-rw---- 1 root tty       7,   6 Dec  6 23:17 vcs6
crw-rw---- 1 root tty       7, 128 Dec  6 23:17 vcsa
crw-rw---- 1 root tty       7, 129 Dec  6 23:17 vcsa1
crw-rw---- 1 root tty       7, 130 Dec  6 23:17 vcsa2
crw-rw---- 1 root tty       7, 131 Dec  6 23:17 vcsa3
crw-rw---- 1 root tty       7, 132 Dec  6 23:17 vcsa4
crw-rw---- 1 root tty       7, 133 Dec  6 23:17 vcsa5
crw-rw---- 1 root tty       7, 134 Dec  6 23:17 vcsa6
crw-rw---- 1 root tty       7,  64 Dec  6 23:17 vcsu
crw-rw---- 1 root tty       7,  65 Dec  6 23:17 vcsu1
crw-rw---- 1 root tty       7,  66 Dec  6 23:17 vcsu2
crw-rw---- 1 root tty       7,  67 Dec  6 23:17 vcsu3
crw-rw---- 1 root tty       7,  68 Dec  6 23:17 vcsu4
crw-rw---- 1 root tty       7,  69 Dec  6 23:17 vcsu5
crw-rw---- 1 root tty       7,  70 Dec  6 23:17 vcsu6
crw------- 1 root root     10, 127 Dec  6 23:17 vga_arbiter
crw------- 1 root root     10, 137 Dec  6 23:17 vhci
crw------- 1 root root     10, 238 Dec  6 23:17 vhost-net
crw-rw---- 1 root video    81,   0 Dec  6 23:17 video0
crw------- 1 root root     10, 130 Dec  6 23:17 watchdog
crw------- 1 root root    246,   0 Dec  6 23:17 watchdog0
crw-rw-rw- 1 root root      1,   5 Dec  6 23:17 zero
brw-rw---- 1 root disk    254,   0 Dec  6 23:17 zram0
brw-rw---- 1 root disk    254,   1 Dec  6 23:17 zram1
brw-rw---- 1 root disk    254,   2 Dec  6 23:17 zram2

## Image Versions of running containers 
init: busybox:latest 
traefik: traefik:v2.5 

## All Containers 
NAME                COMMAND                  SERVICE             STATUS              PORTS
prind-init-1        "chown -R 1000:1000 …"   init                exited (0)          
prind-traefik-1     "/entrypoint.sh --ac…"   traefik             running             0.0.0.0:80->80/tcp, :::80->80/tcp

## Retrieving Klipper/Moonraker Logfiles 
Error response from daemon: Could not find the file /opt/log in container 532c706faae8ea787950a6e71bb702ccb76c9070a994e5f6b83c8d8b757ec65b

## Copying current configs 

## Generating Archive 
tar: Removing leading `/' from member names
/tmp/tmp.pRfsTGzxGk-prind/
/tmp/tmp.pRfsTGzxGk-prind/prind/
/tmp/tmp.pRfsTGzxGk-prind/prind/prind-info-07122022-220341.tar.gz
/tmp/tmp.pRfsTGzxGk-prind/prind/prind-info-07122022-220013.tar.gz
/tmp/tmp.pRfsTGzxGk-prind/prind/prind-info-07122022-220319.tar.gz
/tmp/tmp.pRfsTGzxGk-prind/prind/scripts/
/tmp/tmp.pRfsTGzxGk-prind/prind/scripts/setup-X11.sh
/tmp/tmp.pRfsTGzxGk-prind/prind/scripts/get-info.sh
/tmp/tmp.pRfsTGzxGk-prind/prind/scripts/build-images.sh
/tmp/tmp.pRfsTGzxGk-prind/prind/img/
/tmp/tmp.pRfsTGzxGk-prind/prind/img/splashscreen-1080p.png
/tmp/tmp.pRfsTGzxGk-prind/prind/img/splashscreen-1080p-dark.png
/tmp/tmp.pRfsTGzxGk-prind/prind/img/prind-logo.png
/tmp/tmp.pRfsTGzxGk-prind/prind/docker/
/tmp/tmp.pRfsTGzxGk-prind/prind/docker/ustreamer/
/tmp/tmp.pRfsTGzxGk-prind/prind/docker/ustreamer/README.md
/tmp/tmp.pRfsTGzxGk-prind/prind/docker/ustreamer/Dockerfile
/tmp/tmp.pRfsTGzxGk-prind/prind/docker/moonraker/
/tmp/tmp.pRfsTGzxGk-prind/prind/docker/moonraker/README.md
/tmp/tmp.pRfsTGzxGk-prind/prind/docker/moonraker/Dockerfile
/tmp/tmp.pRfsTGzxGk-prind/prind/docker/klipperscreen/
/tmp/tmp.pRfsTGzxGk-prind/prind/docker/klipperscreen/README.md
/tmp/tmp.pRfsTGzxGk-prind/prind/docker/klipperscreen/Dockerfile
/tmp/tmp.pRfsTGzxGk-prind/prind/docker/klipper/
/tmp/tmp.pRfsTGzxGk-prind/prind/docker/klipper/config.simulavr
/tmp/tmp.pRfsTGzxGk-prind/prind/docker/klipper/README.md
/tmp/tmp.pRfsTGzxGk-prind/prind/docker/klipper/Dockerfile
/tmp/tmp.pRfsTGzxGk-prind/prind/docker-compose.yaml
/tmp/tmp.pRfsTGzxGk-prind/prind/docker-compose.override.yaml
/tmp/tmp.pRfsTGzxGk-prind/prind/docker-compose.extra.simulavr.yaml
/tmp/tmp.pRfsTGzxGk-prind/prind/docker-compose.extra.make.yaml
/tmp/tmp.pRfsTGzxGk-prind/prind/docker-compose.extra.calibrate-shaper.yaml
/tmp/tmp.pRfsTGzxGk-prind/prind/custom/
/tmp/tmp.pRfsTGzxGk-prind/prind/custom/docker-compose.custom.portainer.yaml
/tmp/tmp.pRfsTGzxGk-prind/prind/custom/docker-compose.custom.multiple-printers.yaml
/tmp/tmp.pRfsTGzxGk-prind/prind/custom/README.md
/tmp/tmp.pRfsTGzxGk-prind/prind/config/
/tmp/tmp.pRfsTGzxGk-prind/prind/config/mks_mini_12864_v3.cfg
/tmp/tmp.pRfsTGzxGk-prind/prind/config/printer.cfg
/tmp/tmp.pRfsTGzxGk-prind/prind/config/.moonraker.conf.bkp
/tmp/tmp.pRfsTGzxGk-prind/prind/config/printer.20221206.cfg
/tmp/tmp.pRfsTGzxGk-prind/prind/config/printer.cfg.backup
/tmp/tmp.pRfsTGzxGk-prind/prind/config/printer-simulavr.cfg
/tmp/tmp.pRfsTGzxGk-prind/prind/config/octoprint.yaml
/tmp/tmp.pRfsTGzxGk-prind/prind/config/moonraker.conf
/tmp/tmp.pRfsTGzxGk-prind/prind/config/klipperscreen.conf
/tmp/tmp.pRfsTGzxGk-prind/prind/config/build.config
/tmp/tmp.pRfsTGzxGk-prind/prind/README.md
/tmp/tmp.pRfsTGzxGk-prind/prind/LICENSE
/tmp/tmp.pRfsTGzxGk-prind/prind/.github/
/tmp/tmp.pRfsTGzxGk-prind/prind/.github/workflows/
/tmp/tmp.pRfsTGzxGk-prind/prind/.github/workflows/ustreamer.yaml
/tmp/tmp.pRfsTGzxGk-prind/prind/.github/workflows/moonraker.yaml
/tmp/tmp.pRfsTGzxGk-prind/prind/.github/workflows/klipperscreen.yaml
/tmp/tmp.pRfsTGzxGk-prind/prind/.github/workflows/klipper.yaml
/tmp/tmp.pRfsTGzxGk-prind/prind/.github/workflows/image-workflow.yaml
/tmp/tmp.pRfsTGzxGk-prind/runtime-info.txt                     

KlipperScreen Image Build is failing

KlippperScreen Image Builds are failing while installing python requirements.

From https://github.com/mkuf/prind/runs/5687510098

#17 3286.0 Collecting kiwisolver>=1.0.1
#17 3286.0   Downloading kiwisolver-1.4.0.tar.gz (95 kB)
#17 3286.0      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 95.9/95.9 KB 5.5 MB/s eta 0:00:00
#17 3288.0   Installing build dependencies: started
#17 3321.9   Installing build dependencies: finished with status 'done'
#17 3321.9   Getting requirements to build wheel: started
#17 3325.6   Getting requirements to build wheel: finished with status 'done'
#17 3325.7   Preparing metadata (pyproject.toml): started
#17 3333.8   Preparing metadata (pyproject.toml): finished with status 'error'
#17 3333.9   error: subprocess-exited-with-error
#17 3333.9   
#17 3333.9   × Preparing metadata (pyproject.toml) did not run successfully.
#17 3333.9   │ exit code: 1
#17 3333.9   ╰─> [17 lines of output]
#17 3333.9       /tmp/pip-build-env-wc45a279/overlay/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py:100: _ExperimentalProjectMetadata: Support for project metadata in `pyproject.toml` is still experimental and may be removed (or change) in future releases.
#17 3333.9         warnings.warn(msg, _ExperimentalProjectMetadata)
#17 3333.9       Install ``trove-classifiers`` to ensure proper validation. Meanwhile a list of classifiers will be downloaded from PyPI.
#17 3333.9       error: Multiple top-level packages discovered in a flat-layout: ['py', 'kiwi'].
#17 3333.9       
#17 3333.9       To avoid accidental inclusion of unwanted files or directories,
#17 3333.9       setuptools will not proceed with this build.
#17 3333.9       
#17 3333.9       If you are trying to create a single distribution with multiple packages
#17 3333.9       on purpose, you should not rely on automatic discovery.
#17 3333.9       Instead, consider the following options:
#17 3333.9       
#17 3333.9       1. set up custom discovery (`find` directive with `include` or `exclude`)
#17 3333.9       2. use a `src-layout`
#17 3333.9       3. explicitly set `py_modules` or `packages` with a list of names
#17 3333.9       
#17 3333.9       To find more information, look for "package discovery" on setuptools docs.
#17 3333.9       [end of output]
#17 3333.9   
#17 3333.9   note: This error originates from a subprocess, and is likely not a problem with pip.
#17 3333.9 error: metadata-generation-failed
#17 3333.9 
#17 3333.9 × Encountered error while generating package metadata.
#17 3333.9 ╰─> See above for output.
#17 3333.9 
#17 3333.9 note: This is an issue with the package mentioned above, not pip.
#17 3333.9 hint: See above for details.
#17 ERROR: process "/bin/sh -c python -m venv venv  && venv/bin/pip install -r klipperscreen/scripts/KlipperScreen-requirements.txt" did not complete successfully: exit code: 1

This is caused by a breaking change in the current setuptools release: pypa/setuptools#3197

Port is invalid

Hi Mkuf, I got a issue after deploying octoprint on docker.
There is no /tmp/printer on Serial port when creating a new additional port.
Am I missing something?

Abort print on error?

Hi,

I found this issue earlier: Klipper3d/klipper#3666

It seems that Klipper does not turn off the heater in certain error conditions.

To make this repo failsafe by default, what do you think about adding the following:

[virtual_sdcard]
; other stuff here...
on_error_gcode:
  CANCEL_PRINT

multiple webcams

Hi there. can anyone share your multiple webcams settings, please?

Where is the camera supposed to appear?

Hi!

Congrats on this great work. I got a fully working klipper in a few hours. However, somethings aren't working as supposed.

Should the camera widget be manually configured? What's the URL to get the stream? Or does it need any addition configuration in Klipper? How's the telegram.conf supposed to be loaded and used ?

Thanks in advance!

No such file or directory: 'ip

I am trying to use your containers to set up this stack on my local machine. I'm running ubuntu 20.04 LTS so I'm not using it as-is since the docker version that comes with the OS doesn't have the newer docker-compose features that you're using here. I also can't use the traefik configuration b/c I already have another service using port 80 on the system.

I'm got a compose file started with containers for klipper and moonraker. I've worked through a couple volume mount issues, but those seem to be settled.

Now I'm running into the error that the moonraker service can't find a command ip. I'd not worked with this tool before, but when I tried running it on my ubuntu server it existed. It doesn't work in the container though. That's kind of weird because I would expect it to be part of the base container if this image worked previously. Any idea what's going on?

Traceback (most recent call last):
  File "/opt/moonraker/moonraker/components/machine.py", line 423, in parse_network_interfaces
    resp = await scmd.run_with_response(log_complete=False)
  File "/opt/moonraker/moonraker/components/shell_command.py", line 241, in run_with_response
    raise ShellCommandError(
components.shell_command.ShellCommandError: Error running shell command: '['ip', '-json', 'address']'
2021-12-30 00:00:18,544 [shell_command.py:_create_subprocess()] - shell_command: Command (ip -json address) failed
Traceback (most recent call last):
  File "/opt/moonraker/moonraker/components/shell_command.py", line 256, in _create_subprocess
    transport, protocol = await loop.subprocess_exec(
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1652, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "/usr/local/lib/python3.10/asyncio/unix_events.py", line 207, in _make_subprocess_transport
    transp = _UnixSubprocessTransport(self, protocol, args, shell,
  File "/usr/local/lib/python3.10/asyncio/base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "/usr/local/lib/python3.10/asyncio/unix_events.py", line 799, in _start
    self._proc = subprocess.Popen(
  File "/usr/local/lib/python3.10/subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.10/subprocess.py", line 1842, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ip

KlipperScreen without network=host?

What part of KlipperScreen requires host networking and what do you loose if it's run isolated and DISPLAY is set to a remote IP address in the local network?

mcu container in docker-compose cannot find unknown in $PATH

I'm looking to put the mcu build process in a simple docker-compose:

version: "3.9"

services:
  app:
    image: "mkuf/klipper:722ad4a-mcu"
    restart: "always"
    stdin_open: true
    tty: true
    depends_on:
      - "perms"
    devices:
      - "/dev/serial/by-id/usb-Klipper_stm32f429xx_3C0032001350304738313820-if00:/dev/ttyUSB0"
    volumes:
      - "$PWD/../../configs/klipper-mcu/build.cfg:/opt/klipper/.config"
      - "$PWD/../../configs/klipper-mcu/out:/opt/klipper/out"
    command:
      - "bash -c 'cd /opt/klipper; make menuconfig && make && make flash'"

  perms:
    image: "busybox:latest"
    volumes:
      - "$PWD/../../configs/klipper-mcu/build.cfg:/opt/klipper/.config"
    command: "chown 1000:1000 /opt/klipper/.config"

As you can see, it's the same as running the docker run command in the README.md, but instead I run it with docker-compose up. The stdin_open and tty acts like -it flag for docker run.

However. I'm unable to run this container. This is the error message returned

Starting klipper-mcu_perms_1 ... done
Starting klipper-mcu_app_1 ... error

ERROR: for klipper-mcu_app_1  Cannot start service app: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/bin/bash -c 'cd /opt/klipper; make menuconfig && make && make flash'": stat /bin/bash -c 'cd /opt/klipper; make menuconfig && make && make flash': no such file or directory: unknown

ERROR: for app  Cannot start service app: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/bin/bash -c 'cd /opt/klipper; make menuconfig && make && make flash'": stat /bin/bash -c 'cd /opt/klipper; make menuconfig && make && make flash': no such file or directory: unknown
ERROR: Encountered errors while bringing up the project.

Any idea why this would happen?

Moonraker Image Build is failing

Image Builds for Moonraker are failing with

 > [linux/amd64 build 4/4] RUN python -m venv venv  && venv/bin/pip install -r moonraker/scripts/moonraker-requirements.txt:
#26 33.82         196 |   #include "longintrepr.h"
#26 33.82             |            ^~~~~~~~~~~~~~~
#26 33.82       compilation terminated.
#26 33.82       error: command '/usr/bin/gcc' failed with exit code 1
#26 33.82       [end of output]
#26 33.82   
#26 33.82   note: This error originates from a subprocess, and is likely not a problem with pip.
#26 33.82   ERROR: Failed building wheel for streaming-form-data
#26 33.82 Failed to build streaming-form-data
#26 33.82 ERROR: Could not build wheels for streaming-form-data, which is required to install pyproject.toml-based projects
------
Dockerfile:13
--------------------
  12 |     
  13 | >>> RUN python -m venv venv \
  14 | >>>  && venv/bin/pip install -r moonraker/scripts/moonraker-requirements.txt
  15 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c python -m venv venv  && venv/bin/pip install -r moonraker/scripts/moonraker-requirements.txt" did not complete successfully: exit code: 1

https://github.com/mkuf/prind/actions/runs/3398480456/jobs/5651564826

Flashing the micro-controller

This is a great project! I hope you continue your work on it!

I just noticed, that it seems that there is currently no option to flash the micro-controller of the 3D printer.

What I tried:

  • I entered the "klipper" docker container with $ docker exec -it klipper /bin/bash
  • I changed the directory to /opt/klipper
  • I tried to run $ make menuconfig but got the response that the command make is not available: bash: make: command not found

I was able to quick-fix this problem by entering the container as root ($ docker exec -it --user root klipper /bin/bash) installing make with

$ apt update; apt install build-essential gcc-arm-none-eabi

(The latter package is only necessary for ARM micro-controllers. As I use a BigTreeTech SKR1.4 Pro, I need it.)

After that I was able to run make menuconfig and make. However this increased the size of the docker container by about 2 GB and it might still be a little clumsy to obtain the files generated by the script afterwards as they are stored inside the docker container. I think there could be a more convenient solutions for this.

Can host reboot/shutdown from mainsail be enabled?

I was wondering, since I've deployed this project to a raspberry pi, would it be possible to have the reboot/shutdown commands working from moonraker? I get an error when I try to do it:

Traceback (most recent call last):

  File "/opt/moonraker/moonraker/websockets.py", line 299, in execute_method
    result = await callback(params)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/moonraker/moonraker/websockets.py", line 412, in func
    result = await callback(
             ^^^^^^^^^^^^^^^
  File "/opt/moonraker/moonraker/components/machine.py", line 277, in _handle_machine_request
    raise self.server.error(
utils.ServerError: Cannot reboot from within a docker container

I saw that a method to do this is to mount /etc/systemd in the container, but it's already done

Warning since last update

Since my recent pull I get these Warnings in Mainsail

image

I couldn't tack down the source of this message but I think that they are again imposed by recent changes in Moonraker.

Access moonraker through/in a third party app

I'm trying to use the iOS app "mobileraker". When I go add a printer it asks me for moonraker's IP address. I put in my docker host's 192.168.x.x address and the port number 7125.

Unfortunately the app fails to connect. Is there something I need to modify in the traefik config to allow it to accept connections other than through fluidd?

Moonraker is starting over and over

Hello,
the moon raker is starting over and over. The docker runs on a raspy 3B+ with buster. I use the nightly build.

Here are the log:

--------------------Moonraker Log Start--------------------
config_file: cfg/moonraker.cfg
log_file: log/moonraker.log
software_version: ?
python_version: 3.10.2 (main, Jan 29 2022, 05:43:04) [GCC 10.2.1 20210110]
2022-02-25 18:39:59,921 [utils.py:setup_logging()] - config_file: cfg/moonraker.cfg
2022-02-25 18:39:59,922 [utils.py:setup_logging()] - log_file: log/moonraker.log
2022-02-25 18:39:59,922 [utils.py:setup_logging()] - software_version: ?
2022-02-25 18:39:59,922 [utils.py:setup_logging()] - python_version: 3.10.2 (main, Jan 29 2022, 05:43:04) [GCC 10.2.1 20210110]

This is the moonraker.cfg:

[server]
host: 0.0.0.0
port: 7125
klippy_uds_address: /opt/run/klipper.sock

[file_manager]
config_path: /opt/cfg

[machine]
provider: none

[database]
database_path: /opt/db

[authorization]
trusted_clients:
0.0.0.0/0
cors_domains:
*

[octoprint_compat]

[history]

Reduce klipper docker image size

Hi,

There are a couple of issues making klipper image significantly larger than it should be:

Here you can remove .git folder after git checkout. This saves around 80M:

RUN git clone ${REPO} klipper \
&& cd klipper \
&& git checkout ${VERSION}

Here you can try using COPY --chown instead of a separate COPY and RUN chown. Otherwise all the files are duplicated in a new layer:

COPY --from=build /opt/klipper ./klipper
COPY --from=build /opt/venv ./venv
RUN mkdir -p printer_data/run printer_data/gcodes printer_data/logs printer_data/config
RUN groupadd klipper --gid 1000 \
&& useradd klipper --uid 1000 --gid klipper \
&& usermod klipper --append --groups dialout \
&& chown -R klipper:klipper /opt/*

Those two simple changes should result in pull size reduction from ~720M to ~350M (for armv7).

I would have liked to created a platform, but I'm using that to try to run klipper on a machine without docker, so I don't have an easy way to test the changes....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.