OctoPrint (or Octopi) plays a major role in my printing. Printing from SD Card and especially Micro-SD Card (the Ender 3) where it is easy to miss-insert makes operating from OctoPrint a no-brainer. But one Raspberry Pi for each printer doesn’t make sense. Multiple Printers can run on the same RPi but not Out-of-the-Box (OOB).
The first step in running multiple printers on the same RPi is to be able to easily identify which printer is plugged in. Linux assigns names to the USB ports and you must modify the configuration to provide ‘friendly’ names.
Start by plugging more than one printer into the RPi and identify the /dev/tty* for each printer. From OctoPrint you should see those names in the list and be able to select which one you wish to connect with.
Simply plug-in and run either printer. So how do you run more than one printer at a time? The short answer is, you don’t with just a single instance of OctoPrint running. You need to create additional instances for every printer you wish to run simultaneously.
Let me phrase it a little differently to make it clear. In this example I will plug in three printers. With three printers plugged in you can select any of them with the single instance.
Now I’ll jump ahead to having installed and configured everything for two instances of OctoPrint. Now I can connect with two different URLs to the two different instances. From either instance I can select any of the three printers. This means I can run any two of the three printers simultaneously.
With a basic understanding of the environment and how it is structured it is the time to define a clear naming convention. This will cover:
Within these instructions I was able to get everything working. I started by identifying the ports via
SSH into the RPi without any printers plugged in and then plug one printer in and execute it again to see the new port’s name. In my case it is ttyACM0
With the port identified I can plug in another printer and see it is ttyACM1. Now we can scan the attributes and find unique identifiers to define symbolic links.
You can can for unique identifiers by running a difference in the captured lists from the two ports.
Following the instructions create and edit a 99-usb.rules file where you specify the values from your system. Based on this example the file is
Reboot and verify the ports have symbolic links as expected.
I prefaced the printer identifier with USB so it is possible to identify just the printer ports and using the -al switch on the ls command you can see what ports the symbolic links represent.
From OctoPrint you can select either port.
Now it is possible to easily identify the port with a friendly name.
In order to establish a second instance of OctoPrint we must:
Change the Port and add a basedir to the DAEMON_ARGS
NOTE: The linked instructions provide an example that confused me which is why I made this post, as a augmentation of that document.
The key difference in what I present and what is in the referenced post is:
Within the haproxy.cfg file there are sections. Changes start in the ‘frontend public’ section. The backend is selected based on the URL ‘path’. This is how the traffic is routed to the different instances, based on path. For example, if the original path was http://octopi.local and two printers are defined as described in this document, anet, and mk3 — http://octopi.local/anet/ points at the port 5000 instance and http://octopi.local/mk3/ points at the port 5001 instance.
To assure we can get back to the starting point make a backup copy of the haproxy.cfg file before making changes.
Within the /etc/haproxy/haproxy.cfg file with sections ‘global’, ‘defaults’, ‘frontend public’, ‘backend octoprint’, and ‘backend webcam’.
Replace the ‘backend octoprint’ with sections to the active instances you created. A critical difference is the additions of ‘reqadd X-Script-Name:’ to the all the ‘backend’ sections except ‘backend webcam’.
It is interesting to note that the server is octoprint1 and you specify the access by port rather than any reference to octoprint2, which is directory pointed to as part of the octopi instance setup.
Since I only have one camera at the moment I can only refer to the referenced link.
A very long post. I don’t know that I have all the details perfect but I captured what I could and don’t have another RPi to setup. This is my notes for when I have need to setup another RPi.