Skip to content

Latest commit

 

History

History
217 lines (166 loc) · 5.4 KB

File metadata and controls

217 lines (166 loc) · 5.4 KB

OCTOPRINT Octoprint

install

Tested on a Raspberry Pi 3 with trixie.

Install the prerequisites:

bash
$> cd
$> sudo apt-get install -y git virtualenv gcc build-essential libyaml-dev
$> sudo apt-get install -y python-pip python-dev python-setuptools python-venv

install from source

Then you can install octoprint from source, as regular user, using:

bash
$> git clone https://github.com/OctoPrint/OctoPrint.git
$> cd OctoPrint
$> python3 -m venv venv        # create an env dedicated to octoprint
$> source ./venv/bin/activate  # activate this env
$> pip install pip --upgrade   # optional
$> pip install .               # install octoprint from source int the env
bash
$> mkdir OctoPrint && cd OctoPrint
$> python3 -m venv venv			# create an env dedicated to octoprint
$> source ./venv/bin/activate		# activate this env
$> pip install pip --upgrade       # optional
$> pip install OctoPrint			# install octoprint from pip

setup system

permissions

You may need to add the user to the dialout and tty groups, so that the user can access the serial ports. To do so, do:

bash
# add the user to the dialout group and tty so that the user can access the serial ports
$> sudo usermod -a -G tty $USER
$> sudo usermod -a -G dialout $USER   # for access to webcam
$> sudo usermod -a -G video $USER     # for access to vcgencmd

Test octoprint is working fine:

bash
$> ~/OctoPrint/venv/bin/octoprint serve

Then, visit http://xxx:5000/ where xxx is the address of your device (can be localhost).

setup as service

If your user is not pi, change it in the scripts/octoprint.default. The following will do it for you:

bash
$> cd
$> git clone https://github.com/leoheck/octoprint-systemd.git
$> cd octoprint-systemd
$> make install      # be sure to execute as user (not sudo).

The path may be written with wrong case ("octoprint" instead of "OctoPrint"). Check and fix using:

bash
$> sudo nano /etc/systemd/system/octoprint.service #< to check ExecStart = ...
$> sudo sed -i "s,/octoprint/,/OctoPrint/,g" /etc/systemd/system/octoprint.service # fix
$> sudo systemctl daemon-reload
$> sudo systemctl restart octoprint.service
$> sudo systemctl status octoprint.service
$> sudo systemctl enable octoprint

octoprint setup

server control (reboot)

First allow octoprint user to reboot.

sudo groupadd power 				# create a group allowed to reboot
sudo usermod -a -G power $USER      # add users to that group
sudo visudo							# allow the group to take those actions

Add at the end the following:

visudo
## user is allowed to execute halt and reboot
%power ALL=(ALL) NOPASSWD: /bin/systemctl poweroff,/bin/systemctl halt,/bin/systemctl reboot

Note to myself: Passwd prompt might be a pb. See add "NOPASSWD:ALL" to avoid passwd prompt. Explore sudo echo $USER >> /etc/shutdown.allow

Then, in the OctoPrint web-ui, go to Settings > Server > Commands, configure the following commands:

  • Restart OctoPrint: sudo /usr/bin/systemctl restart octoprint.service

  • Restart system: sudo /usr/bin/systemctl reboot

  • Shutdown system: sudo /usr/bin/systemctl poweroff

plugins

  • Bed Level Visualizer: Displays 3D mesh of bed topography report.

  • OctoPrint-PrintTimeGenius: Use a gcode pre-analysis to provide better print time estimation

  • DisplayLayerProgress: Progress and other data on "Printer-Display"

  • OctoPrint-MQTT + OctoPrint-HomeAssistant

  • Themeify: dark theme

  • Cura Thumbnail: support for Ultimaker Format Package (.ufp) files

  • OctoPrint-TabOrder: ordering of tabs

Let’s keep in mind the evolution of the camera stack: https://github.com/cp2004/OctoPrint-CameraStreamer-Control

reverse proxy

Neet to host both webcam and octoprint. It redirects to octoprint or webcam based on the url. Install haproxy :

$> sudo apt install -y haproxy
$> sudo mv /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.bak
$> sudo nano /etc/haproxy/haproxy.cfg
# check the configuration is valid!
$> /usr/sbin/haproxy -c -V -f /etc/haproxy/haproxy.cfg
/etc/haproxy/haproxy.cfg
global
        maxconn 4096
        user haproxy
        group haproxy
        daemon
        log 127.0.0.1 local0 debug

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        retries 3
        option redispatch
        option http-server-close
        option forwardfor
        maxconn 2000
        timeout connect 5s
        timeout client  15m
        timeout server  15m

frontend public
        bind :::80 v4v6
        use_backend webcam if { path_beg /webcam/ }
        default_backend octoprint

backend octoprint
        http-request replace-path /(.*) /\1
        option forwardfor
        server octoprint1 127.0.0.1:5000

backend webcam
        http-request replace-path /webcam/(.*) /\1
        server webcam1  127.0.0.1:8080

Activate the reverse proxy:

$> sudo systemctl start haproxy
$> sudo systemctl status haproxy
$> sudo systemctl enable haproxy