Debian Octoprint Server - rchamp26/Octoprint_AnycubicVyper GitHub Wiki

Debian Octoprint Server Configuration

The Build

Currently I use the following hardware:

Hardware

  • Anycubic Vyper
  • Mosaic Palette 2s
  • Beelink T4 Pro mini PC (for running Octoprint)
  • NexiGo N660p webcam for timelapse and remote monitoring of prints
  • Old extra PC running The Spaghetti Detective (to limit CPU consumption on the Octoprint server. I may move this to the Beelink as so far the CPU and memory have barely been touched)

I setup a DIY Octoprint server to control the the Vyper and Palette2s.

Setting up Octoprint on anything other than a Raspberry PI was a little bit of a challenge. I originally setup Octoprint and MJPG-streamer using docker + docker-compose, which was super simple and easy (see this video tutorial to give you a solid basic understanding ).

I use docker for many other things in my home-lab and this was my first choice, however, I could not get the Mosaic canvas & palette plugins for Octoprint to work properly (even when passing through the USB device in the docker-compose). If someone else figured this out, please let me know as managing the machine and having all configs in a simple docker-compose file is much easier to manage and redeploy/deploy more printers without needing a bunch of mini PCs everywhere.

I used a Beelink T4 Pro mini PC. Some might think it's expensive, but when you consider the cost of the PI + Case + Power Supply + Cable, you're looking anywhere from $100-150 here in the states. At the time I purchased the Beelink, it was only $140 and it's super small, 4GB RAM, 64GB eMMC storage, offers 4 USBs has a good power supply. And Since it's amd64, I could later repurpose this machine to pretty much anything else at a later point in time much easier than an aging Pi. Pi's have their purpose, but if you're not using the GPIO or PiCam, I feel one of these mini Pcs are way more reliable and powerful for the money.

As an added bonus, this doesn't have the under voltage issues I couldn't get around with multiple tries of power supplies, cables and 2 different pi3s I had laying around prior to switching to the beelink.

The biggest challenge I had manually installing Octoprint on anything other than the prebuilt octopi image was piecing together information from other forums and posts scattered about the net. Hopefully this writeup will help others looking to deploy Octoprint on a proper PC instead of a Raspberry Pi.

Important: This guide expects you to have a more than basic grasp of the Linux command line. In order to follow it you'll need to know:

  • how to issue commands on the shell
  • how to edit a text file from the command line
  • what the difference is between your user account (e.g. octoprint) and the superuser account root
  • how to SSH into your pc (so you don't need to also attach keyboard and monitor)
  • how to use Git
  • how to use the Internet to help you if you run into problems

Installation and Setup

  1. Install Debian onto the PC using any of the USB methods out there. I typically download a copy of a Debian non-free image, then use Balena Etcher to create a bootable USB from the image. Stick the USB in, power on, and use the appropriate function key to enter the boot menu. Select the USB you entered to boot from. Proceed with the Debian install. I typically make sure to enable the ssh server at install so I can run the machine headless after this process and control it from my laptop over ssh.

  2. Install Pre-reqs

sudo update
sudo upgrade
sudo apt install python3 python3-dev python3-setuptools python-pip git virtualenv libyaml-dev build-essential
  1. Install Octoprint
git clone https://github.com/foosel/Octoprint.git
cd Octoprint
virtualenv [foldername]             #choose your foldername, i.e Vyper
./[foldername]/bin/pip install .    #don't forget the '.'!!

You may need to add the user to the dialout group and tty group so that the user can access the serial ports before starting Octoprint:

sudo usermod -aG tty [yourusername]
sudo usermod -aG dialout [yourusername]

Note: You may need to log out and back in for the changes to take effect.

Init/systemd files to Automatic Startup

init

Download the init.d files from the scripts folder to the locations shown:

octoprint.default   => /etc/default/octoprint
octoprint.init      => /etc/init.d/octoprint

In the octoprint.default file, make sure to change [yourusername] to the user on your machine you've configured.

Next, enable and start the octoprint service: Enable octoprint service

sudo update-rc.d octoprint defaults

start it

sudo service octoprint start

Systemd

Download the systemd files to the locations shown:

octoprint.service   => /etc/systemd/system/octoprint.service

In the octoprint.service file, make sure to change [yourusername] to the user on your machine you've configured.

Next, enable and start the octoprint service:

Enable octoprint service

sudo systemctl enable octoprint

and start it

sudo systemctl start octoprint

Support restart/shutdown through OctoPrint's system menu

In order for me to get this to work, I needed to add the user to the sudoers table. you must use visudo for this.

sudo visudo /etc/sudoers.d/octoprint-service

In the file enter:

[yourusername] ALL=(root) NOPASSWD: /usr/sbin/service octoprint *

Where [yourusername] is the username you are using on your machine i.e. octoprint. octoprint ALL=(root) NOPASSWD: /usr/sbin/service

Do the same for the reboot command as well

sudo vidsudo /etc/sudoers.d/octoprint-reboot

Should look like this: octoprint ALL=(root) NOPASSWD: /usr/sbin/reboot

In Octoprint, under Settings > Server

Restart Octoprint: sudo /usr/sbin/service octoprint restart

Restart System: sudo reboot

octoprint server commands

I don't like having the option to shutdown from the webUI, so I leave that blank.

Plugins

Canvas and Palette Plugins

Info on how to setup your octoprint server with Canvas and Palette plugins here

  • Mosaic plugins
    • Canvas Plugin
    • Palette 2 Plugin
    • The Spaghetti Detective - amazing tool for monitoring your prints and stopping them, if a failure is detected. Fully Opensource and you can run in locally if you're technical, otherwise i recommend using their cloud service. it's very reasonably priced (free for light use and inexpensive for heavy use)

MQTT

Octoprint-MQTT

Home Assistant Auto Discovery

MQTT and Home Assistant Discovery allow for more sensors being exposed to Home Assistant to monitor and use in your Home Assistant instance. Also allows for some commands to be sent back to Octoprint Home Assistant Discovery

More References: