Multiple printers per server megathread


#21

Actually, Google should know this forum as well. More simply, search this forum for the word "multiple". There is at least one post for setting up more than one printer with one Raspberry Pi.


#22

And I have followed them. The issue is that I am having issues, and I haven't found a working solution, but I guess I'll try again when I have a moment.


#23

So, something I've noticed that I have the HAproxy settings set so that, by default, if you don't put in /startt/ or /ender/, it should default to /webcam/. However, the default is /ender/. Maybe I have to restart the Pi?

EDIT:
Never mind, I just checked and my default backend is set to /ender/ instead of /webcam/, so it's not that. haproxy seems to be working fine... I think.

I'm going to look over the OctoPrint2 configuration and see if I can spot something out of whack.

EDIT 2:

So all my configuration settings are golden now, however I noticed that the octoprint2.service is showing as Active(exited). I am working on nailing down that issue, but I have a print going and cannot test further, for fear of a lost print. I will update with more as I have it.

EDIT 3:

More headway into the endeavor! Manually running the octoprint server with the correct settings from the virtual environment worked... for some reason. Not sure why, though. I guess I'll have to use whatever command I used for the daemon arguments, I guess. Not sure why it works, not sure why it didn't work in the first place.


#24

could we get a multi printer multi camera octopi rasp pi image?


#25

The raspberrypi does not have enough computing power to run more than one printer.

If you think this is critical you are welcome to submit a pull request.


#26

I have configuring a Debian based server to accomplish this on some old PC hardware I had laying around. Something that could theoretically also run on a beefier SBC/SOC. I've tried to replicate the OctoPi setup, but it is a little messy.

Any input/suggestions you may have around configuring mjpeg-streamer & haproxy for a multiprinter environment would be appreciated.


#27

Search the forum here for "multiple". The topic has been discussed and solved a few times.


#28

Hello... I managed to configure my new toshiba Wifi SD yesterday, set it as mapped drive and that's all i want: to drag&drop a file to SD without moving SD. So i guess my story with RPi is pretty much over. I dont' intend to print directly from printer, because it's just too many factors that cango wrong - wifi can go down, PC can freeze, RPi can freeze, printing from SD is the most reliable in any case.

[Edit: removed link]


#29

Possibly... but I have a Raspberry Pi 3B that's inside my printer and it's dedicated to streaming the job to the RAMPS board. It's a serial cable rather than wi-fi that manages this streaming.

Even if the wi-fi goes down, the OctoPrint instance still streams over the serial cable.

During the setup wizard, just indicate that you don't want it to check the network connectivity and it's pretty stand-alone at that point. Just don't install plugins like Anywhere or something that get unhappy when the wi-fi goes down.


#30

Good evening, I followed the tutorial of Chris's, the whole first part went well, three printers declared, but when it is necessary to declare the USb, the command "cat dmesg" does not exist apparently in this version.
I am in Octoprint version 1.3.10 Octopi 0.16.0, all on a raspberry PI 3B +
USB printer on raspberry and connection of raspberry to pc in wifi
Thank you for your help because I am blocked

the link of the video:


#31

TLDW: Try dmesg and see if that does something.


#32

yes thank you that seems to be good, thank you very much


#33

image

we must connect the usb one by one to get the idvendo and idproduct?
Is it in the "Automount Point System"?


#34

Looks like that's...

idVendor: 0424
idProduct: 7800

...for the new thing you just plugged in.

Personally, I'd just dedicate one Raspberry Pi 3B per printer and then I wouldn't have to worry about all this. But that's just me.


#35

oh! I just realized from the title of the video what you are after- multiple printers on one Pi.

It's a lot of work. Here at the OctoPrint community we don't support giving support for this. Pis are cheaper than the human effort required to support it. Here are some resources, otherwise you may need to look elsewhere.



#36

Hi,

i'm running multiple instances of octoprint behind the provided instance of haproxy. I kept the default install, but left it disabled, and put two other instances in the config for my printers running on ports 5001 and 5002.

global
        maxconn 4096
        user haproxy
        group haproxy
        log 127.0.0.1 local1 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  15min
        timeout server  15min

frontend public
        bind :::80 v4v6
        bind :::443 v4v6 ssl crt /etc/ssl/snakeoil.pem
        option forwardfor except 127.0.0.1
#       http-request redirect code 301 prefix / drop-query append-slash if { path_reg /[^/\.]+$ }

        use_backend webcam if { path_beg /webcam/ }
        use_backend mpmd if { path_beg /mpmd/ }
        use_backend pmk3 if { path_beg /pmk3/ }
        default_backend octoprint

backend octoprint
        acl needs_scheme req.hdr_cnt(X-Scheme) eq 0

        reqrep ^([^\ :]*)\ /(.*) \1\ /\2
        reqadd X-Scheme:\ https if needs_scheme { ssl_fc }
        reqadd X-Scheme:\ http if needs_scheme !{ ssl_fc }
        option forwardfor
        server octoprint1 127.0.0.1:5000
        errorfile 503 /etc/haproxy/errors/503-no-octoprint.http

backend pmk3
        reqrep ^([^\ :]*)\ /pmk3/(.*) \1\ /\2
        option forwardfor
        server octoprint1 127.0.0.1:5001
        acl needs_scheme req.hdr_cnt(X-Scheme) eq 0
        reqadd X-Scheme:\ https if needs_scheme { ssl_fc }
        reqadd X-Scheme:\ http if needs_scheme !{ ssl_fc }
        reqadd X-Script-Name:\ /pmk3

backend mpmd
        reqrep ^([^\ :]*)\ /mpmd/(.*) \1\ /\2
        option forwardfor
        server octoprint1 127.0.0.1:5002
        acl needs_scheme req.hdr_cnt(X-Scheme) eq 0
        reqadd X-Scheme:\ https if needs_scheme { ssl_fc }
        reqadd X-Scheme:\ http if needs_scheme !{ ssl_fc }
        reqadd X-Script-Name:\ /mpmd

backend webcam
        reqrep ^([^\ :]*)\ /webcam/(.*)     \1\ /\2
        server webcam1  127.0.0.1:8080
        errorfile 503 /etc/haproxy/errors/503-no-webcam.http

In a browser, this works great. However I just tried to sent a file to the MK3 via slic3r's built in Octoprint capability. When I try this, the request 503's...telling me something is wrong on the octoprint side. Am I missing something in my haproxy config, and does the proxy log its errors somewhere?

Anyone else have this working? I can upload gcodes to octoprint manually in a browser, but I liked the workflow of sending directly to it via the slicer's interface.


#37

Ironically-enough, there are multiple threads on the topic of multiple instances of OctoPrint on the same Pi.


#38

Found a workaround...

Failure:

Oct  8 12:42:08 localhost haproxy[25108]: ::ffff:10.0.0.140:57232 [08/Oct/2018:12:42:08.420] public pmk3/octoprint1 0/0/1/-1/8 502 231 - - SH-- 8/8/1/1/0 0/0 "POST /pmk3//api/files/local HTTP/1.1"

Success w/ workaround:

Oct  8 12:42:51 localhost haproxy[25108]: ::ffff:10.0.0.140:57237 [08/Oct/2018:12:42:50.952] public pmk3/octoprint1 0/0/1/555/556 201 820 - - ---- 10/10/1/2/0 0/0 "POST /pmk3/api/files/local HTTP/1.1"

With the path rewrite, slic3r added a slash at the end of the api endpoint....so it was causing haproxy to 503.

It works like this, but i'm going to reconfigure haproxy to use hosts instead of paths, should make it better.


#39

What is the problem?
I've seen tons of guides on how to get multiple instances of OctoPrint going on a single Pi. I, however, would like to get four instances going on a Linux machine. I followed the community guide (https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337) and a single instance of octoprint works fine. I then copied the "~/OctoPrint" folder into four separate instances, and created four config.yaml files. When I try and start a second instance of OctoPrint, however, it doesn't associate with the new .yaml. How do I point OctoPrint to use a file other than config.yaml, say, config2.yaml?


#40

You should probably refer to the megathread for the Pi.