From 9b476a916cc233a8fdac094e774c49c5404ee79f Mon Sep 17 00:00:00 2001 From: cyteen Date: Sun, 3 Jan 2021 14:20:46 +0000 Subject: [PATCH] Commit before merge. --- docker-compose.yml | 39 ++++++--- klipper/Dockerfile | 62 +++++++++----- klipper/bin/run.sh | 21 +++++ klipper/build.sh | 4 +- .../printer/klipper-geeetech-a10-bltouch.cfg | 8 +- klipper/run.sh | 20 +++++ octoprint/Dockerfile | 54 +++++++++---- octoprint/bin/run.sh | 76 ++++++++++++++++-- octoprint/bin/run.sh-env | 22 +++++ octoprint/bin/run.sh-old | 47 +++++++++++ octoprint/bin/run.sh_before | 34 ++++++++ octoprint/build.sh | 3 +- octoprint/debs/yq_2.11.1_armhf.deb | Bin 2256 -> 0 bytes octoprint/printerProfiles/_default.profile | 33 ++++++++ .../printerProfiles/geeetech_a10.profile | 33 ++++++++ octoprint/run.sh | 22 +++++ 16 files changed, 421 insertions(+), 57 deletions(-) create mode 100755 klipper/bin/run.sh create mode 100644 klipper/run.sh create mode 100755 octoprint/bin/run.sh-env create mode 100755 octoprint/bin/run.sh-old create mode 100755 octoprint/bin/run.sh_before delete mode 100644 octoprint/debs/yq_2.11.1_armhf.deb create mode 100644 octoprint/printerProfiles/_default.profile create mode 100644 octoprint/printerProfiles/geeetech_a10.profile create mode 100644 octoprint/run.sh diff --git a/docker-compose.yml b/docker-compose.yml index efca1e0..9b27c9e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ version: '3' volumes: octoprint_vol: {} octoklipper_vol: {} - klipper_vol: {} + #klipper_vol: {} services: # Octoprint itself @@ -15,14 +15,24 @@ services: args: OP_MACHINE_NAME: release: latest - image: amedee/octoprint-octoprint + image: cyteen/octoprint-octoprint restart: always environment: WITH_KLIPPER: "yes" - OCTO_PRINTER: "/octo_printer" + KLIPPER_HOME: "/octo_printer" + #WITH_SAFEMODE: "yes" + #OCTO_PRINTER: "/octo_printer" + OCTO_PRINTER: "/tmp" + PRINTER_CFG: "klipper-geeetech-a10-bltouch.cfg" + SOCAT_TYPE: "TCP" + SOCAT_HOST: "klipper" + SOCAT_PORT: "9999" + #SOCAT DEBUG: " -d -d -d -t 60 -T 60 " volumes: - octoprint_vol:/opt/octoprint/data - octoklipper_vol:/octo_printer + - /home/default/octoprint-containers/octoprint/printerProfiles:/opt/octoprint/data/octoprint/printerProfiles + - /home/default/octoprint-containers/octoprint/bin:/opt/octoprint/bin # - tmp:/tmp # Uncomment next line for "Plain Docker" setup # - /run/dbus:/host/run/dbus @@ -64,21 +74,30 @@ services: context: klipper args: KLIPPER_BRANCH: "work-python3-20200612" + KLIPPER_HOME: "/octo_printer" PRINTER_CFG: "printer.cfg" - OCTO_PRINTER: "/octo_printer" + #OCTO_PRINTER: "/octo_printer" + OCTO_PRINTER: "/tmp" image: cyteen/octoprint-klipper restart: always devices: - - "/dev/ttyUSB0:/dev/ttyUSB0" + - "/dev/ttyUSB0:/hostdevices/ttyUSB0" environment: + KLIPPER_HOME: "/octo_printer" #PRINTER_CFG: "printer.cfg" + PYTHONDIR: "/home/klippy/klippy-env" + SRCDIR: "/home/klippy/klipper" PRINTER_CFG: "klipper-geeetech-a10-bltouch.cfg" #PRINTER_CFG: "generic-bigtreetech-skr-v1.3.cfg" - #OCTO_PRINTER: "/tmp/printer" - OCTO_PRINTER: "/octo_printer" + OCTO_PRINTER: "/tmp" + #OCTO_PRINTER: "/octo_printer" + SER2NET_CONFIG: "9999:raw:0:/tmp/printer:115200 8DATABITS NONE 1STOPBIT -XONXOFF LOCAL -RTSCTS" volumes: - - klipper_vol:/${HOME}/.config + #- klipper_vol:/${HOME}/.config + #- ./klipper/klipper_cfg:/home/klippy/.config/klipper + - /home/default/octoprint-containers/klipper/klipper_cfg:/home/klippy/.config/klipper + #- ./klipper_cfg:/home/klippy/.config/klipper - octoklipper_vol:/octo_printer - #- ./klipper_cfg:/home/default/.config/klipper - #- octoprint_vol:/home/default/.config/klipper + #- octoprint_vol:/home/klippy/.config/klipper #- octoprint_vol:/tmp + #command: ["/home/klippy/klippy-env/bin/python3", "/home/klippy/klipper/klippy/klippy.py", "${OCTO_PRINTER}/${PRINTER_CFG}", "--logfile", "${OCTO_PRINTER}/klippy.log", "--input-tty", "${OCTO_PRINTER}/printer" ] diff --git a/klipper/Dockerfile b/klipper/Dockerfile index c7694b3..b229b4b 100644 --- a/klipper/Dockerfile +++ b/klipper/Dockerfile @@ -11,31 +11,50 @@ ENV KLIPPER_BRANCH=${KLIPPER_BRANCH} ARG PRINTER_CFG="printer.cfg" ENV PRINTER_CFG=${PRINTER_CFG} -ARG OCTO_PRINTER="/tmp/printer" +ARG KLIPPER_HOME="/octo_printer" +ENV KLIPPER_HOME=${KLIPPER_HOME} + +ARG KLIPPER_SERIAL="/hostdevice/ttyUSB0" +ENV KLIPPER_SERIAL=${KLIPPER_SERIAL} + +ARG OCTO_PRINTER="/tmp" ENV OCTO_PRINTER=${OCTO_PRINTER} +#RUN export OCTO_DIR=$(dirname ${OCTO_PRINTER}); mkdir ${OCTO_DIR} && chgrp dialout ${OCTO_DIR} + +# SER2NET config string +ENV SER2NET_CONFIG "9999:raw:0:${OCTO_PRINTER}/printer:115200 8DATABITS NONE 1STOPBIT -XONXOFF LOCAL -RTSCTS" ENV PYTHONDIR "/home/klippy/klippy-env" +RUN apt-get update +RUN apt-get install --no-install-recommends --yes apt-utils sudo python3-pip python3-wheel ser2net procps vim-tiny + # Packages for python cffi ENV PKGLIST "python3-venv python3 python3-dev libffi-dev build-essential git" +RUN apt-get install --no-install-recommends --yes ${PKGLIST} # kconfig requirements ENV PKGLIST "${PKGLIST} libncurses-dev" +RUN apt-get install --no-install-recommends --yes ${PKGLIST} # hub-ctrl ENV PKGLIST "${PKGLIST} libusb-dev" +RUN apt-get install --no-install-recommends --yes ${PKGLIST} # AVR chip installation and building ENV PKGLIST "${PKGLIST} avrdude gcc-avr binutils-avr avr-libc" +RUN apt-get install --no-install-recommends --yes ${PKGLIST} # ARM chip installation and building ENV PKGLIST "${PKGLIST} stm32flash dfu-util libnewlib-arm-none-eabi" ENV PKGLIST "${PKGLIST} gcc-arm-none-eabi binutils-arm-none-eabi libusb-1.0" +RUN apt-get install --no-install-recommends --yes ${PKGLIST} + + # Update system package info -RUN apt-get update && \ - apt-get install --no-install-recommends --yes ${PKGLIST} sudo python3-pip python3-wheel && \ - apt-get autoclean +#RUN apt-get install --no-install-recommends --yes ${PKGLIST} +RUN apt-get autoclean RUN echo -e '[global]\n\ extra-index-url=https://www.piwheels.org/simple'\ @@ -43,16 +62,20 @@ extra-index-url=https://www.piwheels.org/simple'\ # Create user RUN useradd -ms /bin/bash klippy && adduser klippy dialout + +# Create the shared volume mount point +RUN mkdir -p ${KLIPPER_HOME} && chown -R klippy.klippy ${KLIPPER_HOME} + USER klippy #This fixes issues with the volume command setting wrong permissions -#RUN mkdir -p ${HOME}/.config/klipper/firmware/ -RUN ls -lh +RUN mkdir -p /home/klippy/.config/klipper/printer/ RUN mkdir -p /home/klippy/.config/klipper/firmware/ + ### Klipper setup ### -WORKDIR ${HOME} +WORKDIR /home/klippy USER root RUN mkdir -p /etc/sudoers.d/ @@ -65,7 +88,7 @@ USER klippy #RUN ./klipper/scripts/install-octopi.sh #---------------------------------------------------------------------------- -# Download the klipper git repo and checkout the python3 branch +## Download the klipper git repo and checkout the python3 branch WORKDIR /home/klippy ENV SRCDIR /home/klippy/klipper RUN git clone --branch ${KLIPPER_BRANCH} --single-branch https://github.com/KevinOConnor/klipper.git ${SRCDIR} @@ -75,13 +98,13 @@ COPY klipper_cfg/firmware/config ${SRCDIR}/.config WORKDIR ${SRCDIR} RUN make -RUN cp out/klipper.elf.hex ${HOME}/.config/klipper/firmware/ +RUN cp out/klipper.elf.hex /home/klippy/.config/klipper/firmware/ ## Create python virtual environment # Create virtualenv -WORKDIR ${HOME} +WORKDIR /home/klippy -COPY klipper_cfg/printer/ ${HOME}/.config/klipper/printer/ +#COPY klipper_cfg/printer/${PRINTER_CFG} /home/klippy/.config/klipper/printer/ ENV VIRTUAL_ENV=${PYTHONDIR} RUN python3 -m venv $VIRTUAL_ENV @@ -89,17 +112,15 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH" RUN pip3 install -r ${SRCDIR}/scripts/klippy-requirements.txt -# && \ -# ${PYTHONDIR}/bin/python ${SRCDIR}/klippy/klippy.py ${HOME}/.config/klipper/printer/${PRINTER_CFG} -l /var/tmp/klippy.log -# Install startup script +## Install startup script #USER root ENV INIT_FILE /etc/init.d/klipper #ENV INIT_FILE /tmp/init_klipper RUN sudo cp ${SRCDIR}/scripts/klipper-start.sh ${INIT_FILE} RUN sudo update-rc.d klipper defaults -# Install startup script config +## Install startup script config #ENV DEFAULTS_FILE /etc/default/klipper ENV DEFAULTS_FILE /tmp/default_klipper @@ -109,18 +130,17 @@ KLIPPER_USER='$USER'\n\ \n\ KLIPPER_EXEC='${PYTHONDIR}/bin/python3'\n\ \n\ -KLIPPER_ARGS='${SRCDIR}/klippy/klippy.py ${HOME}/.config/klipper/printer/${PRINTER_CFG} -l /tmp/klippy.log -I ${OCTO_PRINTER}'\n\ +KLIPPER_ARGS='${SRCDIR}/klippy/klippy.py /home/klippy/.config/klipper/printer/${PRINTER_CFG} -l ${KLIPPER_HOME}/klippy.log -I ${OCTO_PRINTER}/printer'\n\ \n '\ >> ${DEFAULTS_FILE} -VOLUME ${HOME}/.config +#VOLUME /home/klippy/.config # Start host software #RUN sudo /etc/init.d/klipper restart #-------------------------------------------------- -CMD ["${PYTHONDIR}/bin/python3", "${SRCDIR}/klippy/klippy.py", "${HOME}/.config/klipper/printer/${PRINTER_CFG}", "-l", "/tmp/klippy.log", "-I", ${OCTO_PRINTER}] +COPY bin /home/klippy/bin/ -#CMD ["/home/klippy/klippy-env/bin/python3", "/home/klippy/klipper/klippy/klippy.py", "/home/klippy/.config/klipper/printer/${PRINTER_CFG}", "-l", "tmp/klippy.log", "-I", ${OCTO_PRINTER}] - -#CMD ["/home/klippy/klippy-env/bin/python3", "/home/klippy/klipper/klippy/klippy.py", "/home/klippy/.config/klipper/printer/${PRINTER_CFG", "-l", "tmp/klippy.log", "-I", ${OCTO_PRINTER}] +#CMD ["${PYTHONDIR}/bin/python3", "${SRCDIR}/klippy/klippy.py", "/home/klippy/.config/klipper/printer/${PRINTER_CFG}", "--logfile", "${KLIPPER_HOME}/klippy.log", "--input-tty", "${OCTO_PRINTER}/printer"] +CMD ["/home/klippy/bin/run.sh"] diff --git a/klipper/bin/run.sh b/klipper/bin/run.sh new file mode 100755 index 0000000..ee56b4e --- /dev/null +++ b/klipper/bin/run.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + + +# We use the octoklipper_vol to share klippers pseudo-terminal with octoprint, additionally the octoprint plugin requires access to the printer.cfg and klipper.log + +# Create a symlink in the octoklipper_vol to the printer.cfg to be shared with the octoklipper plugin in the octoprint container. +# ln -sf /home/klippy/.config/klipper/printer/${PRINTER_CFG} ${KLIPPER_HOME}/${PRINTER_CFG} + +cp /home/klippy/.config/klipper/printer/${PRINTER_CFG} ${KLIPPER_HOME}/${PRINTER_CFG} + +echo "*** Starting ser2net" +ser2net -d -u -C "${SER2NET_CONFIG}" & + +# Substitute serial device in the printer config +sed -i 's,^\(serial: \).*,\1'${KLIPPER_SERIAL}',' ${KLIPPER_HOME}/${PRINTER_CFG} + + +touch ${KLIPPER_HOME}/klippy.log + +echo "*** Starting klipper" +${PYTHONDIR}/bin/python3 ${SRCDIR}/klippy/klippy.py ${KLIPPER_HOME}/${PRINTER_CFG} --logfile ${KLIPPER_HOME}/klippy.log --input-tty ${OCTO_PRINTER}/printer diff --git a/klipper/build.sh b/klipper/build.sh index aef2347..6c9c501 100644 --- a/klipper/build.sh +++ b/klipper/build.sh @@ -2,12 +2,12 @@ # --no-cache \ # --build-arg PRINTER_CFG klipper-geeetech-a10-bltouch.cfg \ # --build-arg PRINTER_CFG generic-bigtreetech-skr-v1.3.cfg \ +# -v ${PWD}/klipper_cfg:${HOME}/.config/klipper \ docker build \ - --no-cache \ --progress=plain \ --build-arg KLIPPER_BRANCH="work-python3-20200612" \ --build-arg PRINTER_CFG="printer.cfg" \ - --build-arg OCTO_PRINTER="/tmp/printer" \ + --build-arg OCTO_PRINTER="/octo_printer" \ -t cyteen/octoprint-klipper \ -f Dockerfile \ . diff --git a/klipper/klipper_cfg/printer/klipper-geeetech-a10-bltouch.cfg b/klipper/klipper_cfg/printer/klipper-geeetech-a10-bltouch.cfg index abb60fc..7c24b65 100644 --- a/klipper/klipper_cfg/printer/klipper-geeetech-a10-bltouch.cfg +++ b/klipper/klipper_cfg/printer/klipper-geeetech-a10-bltouch.cfg @@ -23,9 +23,9 @@ step_pin: ar25 dir_pin: ar23 enable_pin: !ar27 step_distance: .0025 -endstop_pin: ^!ar30 +#endstop_pin: ^!ar30 position_endstop: 0 -#endstop_pin: probe:z_virtual_endstop +endstop_pin: probe:z_virtual_endstop position_max: 250 position_min: -2 @@ -196,8 +196,8 @@ speed: 50 horizontal_move_z: 6 samples: 3 sample_retract_dist: 2.5 -min_point: 54,15 -max_point: 233,220 +mesh_min: 54,15 +mesh_max: 233,220 probe_count: 4,4 algorithm: lagrange diff --git a/klipper/run.sh b/klipper/run.sh new file mode 100644 index 0000000..14ae27a --- /dev/null +++ b/klipper/run.sh @@ -0,0 +1,20 @@ +docker run -i -t \ + --rm \ + -v $(pwd)/klipper_cfg:/home/klippy/.config/klipper \ + -v octoklipper_vol:/octo_printer \ + cyteen/octoprint-klipper \ + /bin/bash + #python3 /home/klippy/klipper/klippy/klippy.py /home/klippy/.config/klipper/printer/printer.cfg -l /tmp/klippy.log -I /octo_printer + +#docker run -i -t \ +# --rm \ +# -v $(pwd)/klipper_cfg:/home/klippy/.config/klipper \ +# -v octoklipper_vol:/octo_printer \ +# 884b3944402a \ +# /bin/bash +# #python3 /home/klippy/klipper/klippy/klippy.py /home/klippy/.config/klipper/printer/printer.cfg -l /tmp/klippy.log -I /octo_printer + + #/bin/bash + #-v klipper_vol:${HOME}/.config \ + #-v octoklipper_vol:/octo_printer \ + diff --git a/octoprint/Dockerfile b/octoprint/Dockerfile index 9ecb86c..f8fde9c 100644 --- a/octoprint/Dockerfile +++ b/octoprint/Dockerfile @@ -6,8 +6,8 @@ SHELL ["/bin/bash", "-c"] ARG WITH_KLIPPER="no" ENV WITH_KLIPPER ${WITH_KLIPPER} -ARG OCTO_PRINTER="/tmp/printer" -ENV OCTO_PRINTER ${OCTO_PRINTER} +ARG WITH_SAFEMODE="no" +ENV WITH_SAFEMODE ${WITH_SAFEMODE} # Balena /bin/sh stub is supposed to cleanup itself, but loops when initally called by apt... # https://github.com/balena-io-library/base-images/issues/637 @@ -15,17 +15,17 @@ ENV OCTO_PRINTER ${OCTO_PRINTER} RUN echo "deb http://deb.devuan.org/merged/ beowulf main contrib non-free" > /etc/apt/sources.list -COPY debs/yq_2.11.1_armhf.deb /tmp/yq_2.11.1_armhf.deb RUN apt-get update && \ apt-get install -y python3-pip python3-dev python3-setuptools python3-wheel python3-venv \ - git build-essential ffmpeg dbus jq curl jq \ - libffi-dev libssl-dev libyaml-dev zlib1g-dev libjpeg62-turbo-dev && \ - dpkg -i /tmp/yq_2.11.1_armhf.deb && \ + git build-essential ffmpeg dbus jq curl jq socat procps vim-tiny \ + libffi-dev libssl-dev libyaml-dev zlib1g-dev libjpeg62-turbo-dev libatlas-base-dev && \ apt-get install -y -f && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* +RUN pip3 install yq + ENV OCTO_DEST /opt/octoprint/OctoPrint WORKDIR ${OCTO_DEST} @@ -66,7 +66,9 @@ RUN echo "** Entering virtualenv ${WORKDIR}/venv" && \ echo "** venv: Installing PyYAML." && \ pip3 install PyYAML && \ echo "** venv: Installing numpy." && \ - pip3 install numpy + pip3 install numpy && \ + echo "** venv: Installing Urllib3." && \ + pip3 install requests RUN echo "** venv: starting setup.py install." && \ python3 setup.py install @@ -76,25 +78,28 @@ RUN echo "** venv: installing plugins." && \ https://github.com/Octoprint/Octoprint-MQTT/archive/master.zip \ https://github.com/birkbjo/Octoprint-Themeify/archive/master.zip \ https://github.com/AlexVerrico/Octoprint-Display-ETA/archive/master.zip \ - https://github.com/FormerLurker/Octolapse/archive/master.zip \ https://github.com/pablogventura/Octoprint-ETA/archive/master.zip \ https://github.com/1r0b1n0/Octoprint-Tempsgraph/archive/master.zip \ https://github.com/tpmullan/Octoprint-DetailedProgress/archive/master.zip \ https://github.com/marian42/octoprint-preheat/archive/master.zip \ - https://github.com/jneilliii/Octoprint-TasmotaMQTT/archive/master.zip \ https://github.com/jneilliii/Octoprint-TabOrder/archive/master.zip \ https://github.com/jneilliii/Octoprint-BedLevelVisualizer/archive/master.zip \ https://github.com/jneilliii/Octoprint-Python3PluginCompatibilityCheck/archive/master.zip \ https://github.com/jneilliii/Octoprint-UltimakerFormatPackage/archive/master.zip \ https://github.com/jneilliii/Octoprint-ConsolidateTempControl/archive/master.zip \ - https://github.com/mikedmor/Octoprint_Multicam/archive/master.zip \ - https://github.com/OllisGit/Octoprint-PrintJobHistory/releases/latest/download/master.zip \ + https://github.com/jneilliii/Octoprint-PrusaSlicerThumbnails/archive/master.zip \ + https://github.com/jneilliii/Octoprint-FloatingNavbar/archive/master.zip \ + https://github.com/jneilliii/Octoprint-PlotlyTempGraph/archive/master.zip \ https://github.com/OllisGit/Octoprint-FilamentManager/releases/latest/download/master.zip \ https://github.com/OllisGit/Octoprint-DisplayLayerProgress/releases/latest/download/master.zip \ https://github.com/MoonshineSG/Octoprint-MultiColors/archive/master.zip \ - https://github.com/imrahil/Octoprint-PrintHistory/archive/master.zip \ https://github.com/Kragrathea/Octoprint-PrettyGCode/archive/master.zip \ https://github.com/quanticchaos/OctoPrint-Webcamsb/archive/master.zip + #https://github.com/FormerLurker/Octolapse/archive/master.zip \ + #https://github.com/jneilliii/Octoprint-TasmotaMQTT/archive/master.zip \ + #https://github.com/mikedmor/Octoprint_Multicam/archive/master.zip \ + #https://github.com/imrahil/Octoprint-PrintHistory/archive/master.zip \ + #https://github.com/OllisGit/Octoprint-PrintJobHistory/releases/latest/download/master.zip \ #https://github.com/AliceGrey/OctoPrintKlipperPlugin/archive/master.zip \ ##https://github.com/mmone/OctoPrintKlipper/archive/master.zip #echo "** venv: Installing zip." && \ @@ -103,7 +108,28 @@ RUN echo "** venv: installing plugins." && \ # klipper # The application of the changes to octoprints config.yaml happen on first run in /opt/octoprint/bin/run.sh copied in above from the build directory. +ARG SOCAT_TYPE="TCP" +ENV SOCAT_TYPE ${SOCAT_TYPE} + +ARG SOCAT_HOST="klipper" +ENV SOCAT_HOST ${SOCAT_HOST} + +ARG SOCAT_PORT="9999" +ENV SOCAT_PORT ${SOCAT_PORT} + +#ARG SOCAT_DEBUG=" -d -d -d -t 60 -T 60 " +ARG SOCAT_DEBUG="" +ENV SOCAT_DEBUG ${SOCAT_DEBUG} + + +ARG KLIPPER_HOME="/octo_printer" +ENV KLIPPER_HOME ${KLIPPER_HOME} + +ARG OCTO_PRINTER="/tmp" +ENV OCTO_PRINTER ${OCTO_PRINTER} RUN if [ "${WITH_KLIPPER}" = "yes" ]; then \ + #mkdir -p ${KLIPPER_HOME} && \ + mkdir ${OCTO_PRINTER} && chgrp dialout ${OCTO_PRINTER} && \ pip3 install \ https://github.com/AliceGrey/OctoPrintKlipperPlugin/archive/master.zip \ ; \ @@ -111,11 +137,11 @@ RUN if [ "${WITH_KLIPPER}" = "yes" ]; then \ WORKDIR /opt/octoprint -COPY bin bin/ +#COPY bin bin/ COPY etc etc/ -VOLUME /opt/octoprint/data:w +VOLUME /opt/octoprint/data EXPOSE 5000 diff --git a/octoprint/bin/run.sh b/octoprint/bin/run.sh index fd6791f..0dd2d95 100755 --- a/octoprint/bin/run.sh +++ b/octoprint/bin/run.sh @@ -7,13 +7,79 @@ if [ ! -f ${BaseDir}/config.yaml ]; then if [[ "${WITH_KLIPPER}" == "yes" ]]; then echo "*** Copying initial config file and enabling klipper" mkdir -p ${BaseDir} - yq -Y --arg octo_printer "${OCTO_PRINTER}" '.serial.additionalPorts = "[$octo_printer]" | .serial.baudrate = 250000 | .serial.disconnectOnErrors = "[false]" | .serial.port = "$octo_printer" ' etc/config.yaml > ${BaseDir}/config.yaml - else - echo "*** Copying initial config file" - mkdir -p ${BaseDir} - cp etc/config.yaml ${BaseDir} + + yq -Y --arg octo_printer_port "${OCTO_PRINTER}/printer" \ + --arg printer_cfg_path "${KLIPPER_HOME}/${PRINTER_CFG}" \ + --arg klipper_log "${KLIPPER_HOME}/klippy.log" \ + --arg klipper_port "${OCTO_PRINTER}/printer" ' + .accessControl.salt = "vsT8lIM7l4BFopzXddW3mHnPbMZihN8a" + | .api.key = "F337D04D9B7F445C85562ED3DE53E7C5" + | .appearance.components.order.sidebar = ["plugin_webcamSB", "plugin_firmware_check", "connection", "state", "files"] + | .taborder._config_version = 5 + | .serial.abortHeatupOnCancel = false + | .serial.disconnectOnErrors = false + | .serial.additionalPorts = [$octo_printer_port] + | .serial.baudrate = 250000 + | .serial.port = $octo_printer_port + | .serial.timeout.communication = 40 + | .serial.timeout.temperature = 9.0 + | .serial.timeout.temperatureAutoreport = 3.0 + | .serial.timeout.temperatureTargetSet = 6.0 + | .serial.unknownCommandsNeedAck = true + | .plugins.bedlevelvisualizer._config_version = 1 + | .plugins.discovery.upnpUuid = "cc2474ef-915e-4501-964c-974a5fc35d10" + | .plugins.errortracking.unique_id = "1c9ba54f-8476-423c-8d32-6dd5eb2dbd2f" + | .plugins.filamentmanager._config_version = 1 + | .plugins.filamentmanager.database.clientID = "d653b9a0-4797-11eb-951e-0242ac120002" + | .plugins.gcodeviewer._config_version = 1 + | .plugins.klipper._config_version = 2 + | .plugins.klipper.configuration.configpath = $printer_cfg_path + | .plugins.klipper.configuration.logpath = $klipper_log + | .plugins.klipper.connection.port = $klipper_port + | .plugins.octolapse._config_version = 3 + | .plugins.tracking.enabled = false + | .plugins.tracking.enabled = false + | .plugins.tracking.unique_id = "cf1c3dd5-885a-4a4e-95a1-25953910fea2" + | .plugins.softwareupdate._config_version = 8 + | .plugins.taborder._config_version = 5 + | .plugins.virtual_printer._config_version = 1 + | .server.firstRun = false + | .server.commands.serverRestartCommand = "/opt/octoprint/bin/restart.sh" + | .server.commands.systemRestartCommand = "/opt/octoprint/bin/reboot.sh" + | .server.commands.systemShutdownCommand = "/opt/octoprint/bin/poweroff.sh" + | .server.onlineCheck.enabled = true + | .server.onlineCheck.host = "94.247.43.254" + | .server.pluginBlacklist.enabled = true + | .server.secretKey = "Y9E11QoxP64cfgcqsiOYm5Bc8djGUD9p" + | .server.seenWizards.backup = null + | .server.seenWizards.corewizard = 3 + | .server.seenWizards.tracking = null ' \ + etc/config.yaml > ${BaseDir}/config.yaml +# cp etc/config.yaml ${BaseDir}/config.yaml fi fi +#| .plugins.klipper.configuration.configpath = $octo_printer/$printer_cfg \ +#| .plugins.klipper.configuration.logpath = $klipper_log \ +#| .plugins.klipper.connection.port = $klipper_port \ +#| .plugins.tracking.enabled = false \ +#| .server.firstRun = false \ +#| .server.commands.serverRestartCommand = "/opt/octoprint/bin/restart.sh" \ +#| .server.commands.systemRestartCommand = "/opt/octoprint/bin/reboot.sh" \ +#| .server.commands.systemShutdownCommand = "/opt/octoprint/bin/poweroff.sh" \ +#| .server.onlineCheck.enabled = true \ +#| .server.onlineCheck.host = "94.247.43.254" \ +#| .server.pluginBlacklist.enabled = true \ +#| .server.seenWizards.backup = null \ +#| .server.seenWizards.corewizard = 3 \ +#| .server.seenWizards.tracking = null ' \ +#etc/config.yaml > ${BaseDir}/config.yaml + +echo "*** Set permissions on $(dirname ${OCTO_PRINTER})" +chmod 775 ${OCTO_PRINTER} + +echo "*** Starting socat" +socat pty,raw,echo=0,wait-slave,link=${OCTO_PRINTER}/printer,user=root,mode=777,ignoreeof ${SOCAT_TYPE}:${SOCAT_HOST}:${SOCAT_PORT} ${SOCAT_DEBUG} & + echo "*** Starting octoprint" exec /opt/octoprint/OctoPrint/venv/bin/octoprint --basedir ${BaseDir} serve --iknowwhatimdoing diff --git a/octoprint/bin/run.sh-env b/octoprint/bin/run.sh-env new file mode 100755 index 0000000..af47f9d --- /dev/null +++ b/octoprint/bin/run.sh-env @@ -0,0 +1,22 @@ +#!/bin/bash +# Check for certificates and start haproxy +set -x +BaseDir=/opt/octoprint/data/octoprint + +if [ ! -f ${BaseDir}/config.yaml ]; then + if [[ "${WITH_KLIPPER}" == "yes" ]]; then + echo "*** Copying initial config file and enabling klipper" + mkdir -p ${BaseDir} + yq -Y ' .serial.abortHeatupOnCancel = false | .serial.disconnectOnErrors = false | .serial.additionalPorts = [env.OCTO_PRINTER] | .serial.baudrate = 250000 | .serial.port = $octo_printer | .serial.timeout.communication = 40 | .serial.timeout.temperature = 9.0 | .serial.timeout.temperatureAutoreport = 3.0 | .serial.timeout.temperatureTargetSet = 6.0 | .serial.unknownCommandsNeedAck = true | .plugins.klipper._config_version = 2 | .plugins.klipper.configuration.configpath = env.OCTO_PRINTER/env.PRINTER_CFG | .plugins.klipper.configuration.logpath = env.OCTO_PRINTER/klippy.log" | .plugins.klipper.connection.port = env.OCTO_PRINTER/printer" | .plugins.tracking.enabled = false | .server.firstRun = false | .server.commands.serverRestartCommand = "/opt/octoprint/bin/restart.sh" | .server.commands.systemRestartCommand = "/opt/octoprint/bin/reboot.sh" | .server.commands.systemShutdownCommand = "/opt/octoprint/bin/poweroff.sh" | .server.onlineCheck.enabled = true | .server.onlineCheck.host = "94.247.43.254" | .server.pluginBlacklist.enabled = true | .server.seenWizards.backup = null | .server.seenWizards.corewizard = 3 | .server.seenWizards.tracking = null ' etc/config.yaml > ${BaseDir}/config.yaml + else + echo "*** Copying initial config file" + mkdir -p ${BaseDir} + cp etc/config.yaml ${BaseDir} + fi +fi + +echo "*** Set permissions on $(dirname ${OCTO_PRINTER})" +chmod 775 $(dirname ${OCTO_PRINTER}) + +echo "*** Starting octoprint" +exec /opt/octoprint/OctoPrint/venv/bin/octoprint --basedir ${BaseDir} serve --iknowwhatimdoing diff --git a/octoprint/bin/run.sh-old b/octoprint/bin/run.sh-old new file mode 100755 index 0000000..2cb4602 --- /dev/null +++ b/octoprint/bin/run.sh-old @@ -0,0 +1,47 @@ +#!/bin/bash +# Check for certificates and start haproxy +set -x +BaseDir=/opt/octoprint/data/octoprint + +if [ ! -f ${BaseDir}/config.yaml ]; then + if [[ "${WITH_KLIPPER}" == "yes" ]]; then + echo "*** Copying initial config file and enabling klipper" + mkdir -p ${BaseDir} + yq -Y --arg octo_printer "${OCTO_PRINTER}" --arg printer_cfg "${PRINTER_CFG}" ' .serial.abortHeatupOnCancel = false \ + | .serial.disconnectOnErrors = false \ + | .serial.additionalPorts = [$octo_printer] \ + | .serial.baudrate = 250000 \ + | .serial.port = $octo_printer \ + | .serial.timeout.communication = 40 \ + | .serial.timeout.temperature = 9.0 \ + | .serial.timeout.temperatureAutoreport = 3.0 \ + | .serial.timeout.temperatureTargetSet = 6.0 \ + | .serial.unknownCommandsNeedAck = true \ + | .plugins.klipper._config_version = 2 \ + | .plugins.klipper.configuration.configpath = "$octo_printer/$printer_cfg" \ + | .plugins.klipper.configuration.logpath = "$octo_printer/klippy.log" \ + | .plugins.klipper.connection.port = "$octo_printer/printer" \ + | .plugins.tracking.enabled = false \ + | .server.firstRun = false \ + | .server.commands.serverRestartCommand = "/opt/octoprint/bin/restart.sh" \ + | .server.commands.systemRestartCommand = "/opt/octoprint/bin/reboot.sh" \ + | .server.commands.systemShutdownCommand = "/opt/octoprint/bin/poweroff.sh" \ + | .server.onlineCheck.enabled = true \ + | .server.onlineCheck.host = "94.247.43.254" \ + | .server.pluginBlacklist.enabled = true \ + | .server.seenWizards.backup = null \ + | .server.seenWizards.corewizard = 3 \ + | .server.seenWizards.tracking = null ' \ + etc/config.yaml > ${BaseDir}/config.yaml + else + echo "*** Copying initial config file" + mkdir -p ${BaseDir} + cp etc/config.yaml ${BaseDir} + fi +fi + +echo "*** Set permissions on $(dirname ${OCTO_PRINTER})" +chmod 775 $(dirname ${OCTO_PRINTER}) + +echo "*** Starting octoprint" +exec /opt/octoprint/OctoPrint/venv/bin/octoprint --basedir ${BaseDir} serve --iknowwhatimdoing diff --git a/octoprint/bin/run.sh_before b/octoprint/bin/run.sh_before new file mode 100755 index 0000000..da5acb2 --- /dev/null +++ b/octoprint/bin/run.sh_before @@ -0,0 +1,34 @@ +#!/bin/bash +# Check for certificates and start haproxy +set -x +BaseDir=/opt/octoprint/data/octoprint + +#if [ ! -f ${BaseDir}/config.yaml ]; then +# if [[ "${WITH_KLIPPER}" == "yes" ]]; then +# echo "*** Copying initial config file and enabling klipper" +# mkdir -p ${BaseDir} +## yq -Y --arg octo_printer "${OCTO_PRINTER}" --arg printer_cfg "${PRINTER_CFG}" --arg klipper_log "${OCTO_PRINTER}/klippy.log" --arg klipper_port "${OCTO_PRINTER}/printer" ' .serial.abortHeatupOnCancel = false | .serial.disconnectOnErrors = false | .serial.additionalPorts = [$octo_printer] | .serial.baudrate = 250000 | .serial.port = $octo_printer | .serial.timeout.communication = 40 | .serial.timeout.temperature = 9.0 | .serial.timeout.temperatureAutoreport = 3.0 | .serial.timeout.temperatureTargetSet = 6.0 | .serial.unknownCommandsNeedAck = true | .plugins.klipper._config_version = 2 ' etc/config.yaml > ${BaseDir}/config.yaml +# fi +#fi + +#| .plugins.klipper.configuration.configpath = $octo_printer/$printer_cfg \ +#| .plugins.klipper.configuration.logpath = $klipper_log \ +#| .plugins.klipper.connection.port = $klipper_port \ +#| .plugins.tracking.enabled = false \ +#| .server.firstRun = false \ +#| .server.commands.serverRestartCommand = "/opt/octoprint/bin/restart.sh" \ +#| .server.commands.systemRestartCommand = "/opt/octoprint/bin/reboot.sh" \ +#| .server.commands.systemShutdownCommand = "/opt/octoprint/bin/poweroff.sh" \ +#| .server.onlineCheck.enabled = true \ +#| .server.onlineCheck.host = "94.247.43.254" \ +#| .server.pluginBlacklist.enabled = true \ +#| .server.seenWizards.backup = null \ +#| .server.seenWizards.corewizard = 3 \ +#| .server.seenWizards.tracking = null ' \ +#etc/config.yaml > ${BaseDir}/config.yaml + +echo "*** Set permissions on $(dirname ${OCTO_PRINTER})" +chmod 775 ${OCTO_PRINTER} + +echo "*** Starting octoprint" +exec /opt/octoprint/OctoPrint/venv/bin/octoprint --basedir ${BaseDir} serve --iknowwhatimdoing diff --git a/octoprint/build.sh b/octoprint/build.sh index 12b3a52..36dd0f7 100644 --- a/octoprint/build.sh +++ b/octoprint/build.sh @@ -1,9 +1,10 @@ # --build-arg OP_MACHINE_NAME="raspberrypi3" \ +# --no-cache \ docker build \ --progress=plain \ --build-arg release="latest" \ --build-arg WITH_KLIPPER="yes" \ --build-arg OCTO_PRINTER="/octo_printer" \ - -t amedee/octoprint-octoprint \ + -t cyteen/octoprint-octoprint \ -f Dockerfile \ . diff --git a/octoprint/debs/yq_2.11.1_armhf.deb b/octoprint/debs/yq_2.11.1_armhf.deb deleted file mode 100644 index a68483ceb86ae34ecea2d7b94fce7fd54c2ad934..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2256 zcmbu=X*3)7769-hO)M#`rAn=#gm@YWVpo&~wYIgy($-R{sFI|%+8K?dwkoZiP}M3@ zTZ=RuLFXO$L_s*R6Wj?%n?)jf{&pr2k`knii)ONwUd0vFxc6Yt& z;(NjMuCEI|7zTr(RZ+@n7>ts-1`LKeuK)9*Q7Bav6&UO|{|slS5)uVKNjMGZ-yReBS;!L0g0Su77Q)VqE@RuH)-Kgz;#g@Y(`zPv zG&d!kK7@UOmq@k#`PByMT@%hwR_B+>BQREaB{4~;YsQQ!+&h@xd~kT^8O37)MD>eXE|B+|(ODvG-r2btS*okl zj@Cr)2J_~;9mddll(|?=Lpv)aeU*?>>D0_jlHOK)|1y~HDB6~4O{fcob>Yf!Q71$g zgTquz$g0>H5mU^-;y1-nbc$9Jw{XgHdSLNxF40D?=(|h2dp3)2iABn5?nAZ6E8^06 zDsGeF-Ew~G4VsA@8F#t!OFwjIHJ01hH7A!^!L}FOCBWy|GvuS11^NtFa#;CIoSH-K6fkTC94Yd%s?qBT8f*Z~xV0VoYZZo3d&{)_Ke=HK~6tEm4;_<#K+p8Tu7FkYSLV}FpC|HofQakE3?RKZ6~ zolHE}`#EO2$s~L_R$)2~8O!5ZP-M$L8lwm|v(i@h-1+vGvr|mI;onRm7VpXr7_(m* z9`Z|C2Z}d}Me14ZheId<`kD^i^l1*J{G-0wqF^~~JzYX`Gu!rLYRu!Y`F7;3C8=!U*?Ntn{W1WWXkcTSGDU8jdiTxsaobeY=xuo~s+9NSp(0F9ED8>@*~-W|B; z9MfwH(soyRhI{Q8R}9`rTffRb0fg)x`g-#H_&O2%D1n~oK91J+DH1UxEtN=85`MqXWh*^>j^NE{iZ%^ zfo?F)Hzb4X8_nu0>~9$zU-*oru;SGfsy314-VCF-Wt5Hjr;aMH!8z@`;bAEZxCbj% zxH!8wnK_ZK{Te-8;2gRl5Qd-KiN~6dDy+$?#b^#Ync_5X4#KMYXB!n-xx=VoxtdhQ zsQxE-AGsp{SCXr_61|-dKKb}im~W{f-+1TLHkw}ktVZy}4DXK7d9IS_XlckT;|>UNoWQfAB1raur>yt(^(!^iXt&@4HgZSL zvj;zriD(j$!@DX{RU;ZB!7r0BC6_K4@I>3DB%_H$-b!UWToMVNnQX$r2>>|9RudqKfBFTpN}M~};v7u#w<45LEH zSgPbwG`#p;qC4sFbw#DC!u4feo0~43buu4VWzGr6s|-=nI3ehp$a=eU6(79`!iZ@> z7Gu;{)54z$sa03Iwm=B|yj2#CngLeT5m$7o73}P(q<55e#<-{bbyeMEE*YExA>qQW zv?dvwGv#?qegWx9TxZwSSLZb+uCQX2UGV3^s$QW<5)2(Jzql8?dV-v zZQy~LhcDjcUVNlKk(Szit61pal}x!k3jaokI7TJIed3{QpH-zUU5a4yMRv1v zRtEz0>OLIIFLHXFsCB+a9DA|pOamd!2cS;rS^~;{qqw_07L0;QlGQ# z)W_u)%-~<;dfbhaK@f5Cd@wTa``G&&Sm^hXkR=6!$FKaWkKVK&wv7wc?_-5DJSPEn zR_Efb#|xIP(AyS#W{NaFN6?u2^>b$E3s%gsaqmZQn>`0855rbnWuCT~#{B~}IPDMs zp`obxb!1knZDW?ixsE~u6Ht$1U9wX`g2;#g({F0NC0v+Rz_9^ePPIL+q5d?}rJ=;9 zY)VShb1j@ZHnV%&T-F(?Zee`G2`K2}K+oa^hTWTeZzBC(@E_APM;ooGP6de|Uu)#c zF4OhJB1(+#1J}mWTeYX44+OnZDoaJIE|5pQ1WCu1*8A^5Bv_xiW1`h diff --git a/octoprint/printerProfiles/_default.profile b/octoprint/printerProfiles/_default.profile new file mode 100644 index 0000000..2cbfc7f --- /dev/null +++ b/octoprint/printerProfiles/_default.profile @@ -0,0 +1,33 @@ +axes: + e: + inverted: false + speed: 300 + x: + inverted: false + speed: 6000 + y: + inverted: false + speed: 6000 + z: + inverted: false + speed: 200 +color: default +extruder: + count: 1 + nozzleDiameter: 0.4 + offsets: + - - 0.0 + - 0.0 + sharedNozzle: false +heatedBed: true +heatedChamber: false +id: _default +model: Generic RepRap Printer +name: Default +volume: + custom_box: false + depth: 200.0 + formFactor: rectangular + height: 200.0 + origin: lowerleft + width: 200.0 diff --git a/octoprint/printerProfiles/geeetech_a10.profile b/octoprint/printerProfiles/geeetech_a10.profile new file mode 100644 index 0000000..74e830d --- /dev/null +++ b/octoprint/printerProfiles/geeetech_a10.profile @@ -0,0 +1,33 @@ +axes: + e: + inverted: false + speed: 300 + x: + inverted: false + speed: 6000 + y: + inverted: false + speed: 6000 + z: + inverted: false + speed: 200 +color: default +extruder: + count: 1 + nozzleDiameter: 0.4 + offsets: + - - 0.0 + - 0.0 + sharedNozzle: false +heatedBed: true +heatedChamber: false +id: cellar_a10 +model: Geeetech A10 +name: Geeetech_A10 +volume: + custom_box: false + depth: 220.0 + formFactor: rectangular + height: 260.0 + origin: lowerleft + width: 220.0 diff --git a/octoprint/run.sh b/octoprint/run.sh new file mode 100644 index 0000000..457c159 --- /dev/null +++ b/octoprint/run.sh @@ -0,0 +1,22 @@ +docker run -i -t \ + --rm \ + -v $(pwd)/bin:/opt/octoprint/bin \ + -v $(pwd)/printerProfiles:/opt/octoprint/data/octoprint/printerProfiles \ + -v octoklipper_vol:/octo_printer \ + -v octoprint_vol://opt/octoprint/data \ + cyteen/octoprint-octoprint \ + /bin/bash + #python3 /home/klippy/klipper/klippy/klippy.py /home/klippy/.config/klipper/printer/printer.cfg -l /tmp/klippy.log -I /octo_printer + +#docker run -i -t \ +# --rm \ +# -v $(pwd)/klipper_cfg:/home/klippy/.config/klipper \ +# -v octoklipper_vol:/octo_printer \ +# 884b3944402a \ +# /bin/bash +# #python3 /home/klippy/klipper/klippy/klippy.py /home/klippy/.config/klipper/printer/printer.cfg -l /tmp/klippy.log -I /octo_printer + + #/bin/bash + #-v klipper_vol:${HOME}/.config \ + #-v octoklipper_vol:/octo_printer \ +