Maintain, update and keep in sync multiple OctoPrint instances?

Hi,
I currently operate and manage 10 Prusa printers with OctoPrint, and things are getting out of hand already.

Is there a way to have one main Raspberry Pi running OctoPrint instance as "main" so that any changes done to it are replicated across all other OctoPrint instances?

I would love to have plugin management done in this fashion, so if plugin update command is issues that all instances do this. Also if plugin is added or removed, or settings change, that these changes are propagated to all devices.

Am I hallucinating or is this possible?

There's been discussion on this in the OctoFarm Discord server. It seems the most common approach is scripting it all on the backend, with cron jobs and such for files and config.yaml updates, but don't remember ever seeing any discussion as to plugin management between all of them. There was talk of potentially scripting the plugin installs, but it never really went any further than that.

I suppose you could technically script a backup via octoprint CLI commands, git commit/push or upload that backup somewhere and then have cron job scripts to pull/download the latest backup and restore it. Then you just have to deal with restarting octoprint while not printing, not sure if the restore CLI commands would automatically do that or not.

Edit: Link to backup CLI commands...

https://docs.octoprint.org/en/master/bundledplugins/backup.html#command-line-usage

1 Like

This is relatively straightforward if you aren't using individual Pis for each printer, but if you have multiple instances running off of a single Pi or other hardware. Example, I run around 10 printers off of a single linux box. They all use the base octoprint installation, so they share the same plugins, updates, etc. If you update one, all of them will be updated the next time they restart.

I use 10 individual Raspberry Pi devices, I thought that was obvious from my question.

How do you provide 10 serial ports from one single PC?

One or two USB hubs.

I have very bad experence with USB hubs and usb to serial adapters, they are unreliable. I much more prefer one single Raspberry Pi per printer.

But can you please share your exact usb hubs and usb to serial adapters so I can do further research. Thanks!

1 Like

I very much agree with you. If you have a single PC running multiple OctoPrint instances, it only takes one PC crashing to take down all OctoPrint instances. But adding multiple serial ports to a single (powerful enough) PC is not the problem.

1 Like

Thanks, this seams like a good start.

To each their own. I find a Pi per printer to be a waste of hardware when all the printers are in close proximity and overall I find Pi's WiFi to be significantly less reliable than a single ethernet connection to a printer server. A linux box with an LTS distro that just serves octoprint instances and a couple of cameras doesn't just crash randomly. Plus, you get the ability to update everything at once for all instances, as described. Additionally, you can sync access control between all instances in a shared printer environment through a few symlinks (though moved to LDAP plugin for this now).

Then there's also the potential for octoprint docker containers.

1 Like

I have used docker containers extensively, but I don't see the benefits of using them for octoprint instances... but maybe someone can give some interesting use-cases where it makes sense.

I tried something similar myself a few months ago (as I now have 6 instances of octoprint to look after).
I got as far as treating one as a 'primary', listing the installed plugins and then ssh to each of the others to try and install the same list.
But that was before I started using ansible properly.
It looks like the pip module support venv's, which is how octopi/print is installed isn't it?
https://docs.ansible.com/ansible/latest/modules/pip_module.html
Which means that could be a way to do it remotely.

In a similar vein, I've got zabbix checking for ubuntu/debian updates and installing them automatically.
So if there were some way to correlate the json from the plugin repo (which seemed like the most obvious source for checking) with what you have installed, it might be relatively easy (he says hopefully).

Sean

Ten Pi computers and ten Prusa printers.

On your workstation, push your public key over to all ten Pi computers. ssh-copy-id -i ~/.ssh/id_rsa.pub pi@octopi.local (for example)

Once this has been done, you can then remotely run shell commands. ssh -t pi@octopi.local "./scripts/somescript" Personally, I wouldn't want anything which auto-updates printers since a particular printer could be running a job and shouldn't be interrupted. So keep a log of your computers and update them yourself based upon your schedule. The good thing about this is that you can upgrade one, run it for a week and verify that nothing is now broken. Then upgrade the rest.

1 Like