Multiple printers per server megathread

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.

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.


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.

        maxconn 4096
        user haproxy
        group haproxy
        log local1 debug

        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
#       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
        errorfile 503 /etc/haproxy/errors/503-no-octoprint.http

backend pmk3
        reqrep ^([^\ :]*)\ /pmk3/(.*) \1\ /\2
        option forwardfor
        server octoprint1
        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
        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
        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.

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

1 Like

Found a workaround...


Oct  8 12:42:08 localhost haproxy[25108]: ::ffff: [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: [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 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.

1 Like

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 ( 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?

You should probably refer to the megathread for the Pi.

I looked there but they set up OctoPrint differently on the Pi. I have a PC.

In what ways? Pi is still on Linux. The concepts will be fairly similar, and the effort will be similar.

1 Like

Raspbian is basically Debian and Debian is basically just Linux.

Well, most guides start with the custom image for the Rpi. I can't find some of the files they want me to copy and mod, so I get stuck. For instance, in the guide linked in the megathread, it says to run " sudo cp /etc/default/octoprint /etc/default/octoprint2". My environment doesn't have an /etc/default/octoprint.

Searching Guy's octopi repository for /etc/default/octoprint turns up the file you appear to be looking for.


So it looks like the OctoPi image includes this set of /etc files which help to make the magic happen.

You'll have to forgive me, I'm pretty new to Linux and all that went right over my head.

My /ect/default/ doesn't have an "octoprint" directory or file. Do I need to put something here?

We're at the point now where you should begin to appreciate the value that Guy's done by packaging OctoPrint and then making a variety of automated adjustments to Raspbian so that it works rather smoothly out of the box.

You can see that he's made adjustments in the form of a service which autostarts OctoPrint, the mjpg_streamer as well as creating the necessary /etc/sudoers.d/—related files to allow the pi user to do a couple of things without providing the password for sudo.

Personally, I don't really think that running multiple printers on a single computer is a good idea. If you believe that you have the extra power on your box to do that, then it's your setup. But now you're asking someone like myself to take that journey with you and to talk you through it. From the 80/20 rule, I like to setup things for 80% of the people. The outliers probably need to know what they're doing in a case like this.

If I generally point you in the direction where you could get the answers to your questions and you lack the experience at the moment for success, then it's up to you to decide if you want to challenge yourself, "go to school" on the code itself and learn how to do this... or to simply choose an easier path for yourself. You've just said "I'm pretty new to Linux" and you want to do something rather advanced in Linux by setting up haproxy soon for four instances. I'd like to say that I have the quality time to take you through this step by step but I've got other things I should be doing.

Read things. Learn. Challenge yourself. Make this a great setup if you want to but it's going to cost you more time at this. Good luck.

1 Like

If you are this new to Linux, doing the config work necessary for multiple installs is gonna be difficult. I'm gonna merge this to the multiple multithread.

Okay, yes, I'm new to linux, but I'm willing to learn. I'm just not sure where to start. I understand that you "don't support it" but I know it can be done. Can someone answer my question?

How do I point OctoPrint to a different config.yaml?

Now that you're in the megathread for this topic, back-read it and see how it's done.

1 Like

Is there plans to have like an OctoServer setup so one can go to Site, and see cameras for all Registered Octoprint devices? (so yuou can see the print happening, cancel failed print, even start a print from remote, see temps of everything

One Dashboard shows status of your printers./ Kinda like Repetier Server :slight_smile:

now I am not talking running all printeres off 1 Pi, I want to see a frint end that see;s all tghe Pis into 1 Dashboard

maybe this has bneen discussed before

Search the forum here for the word "multiple" and you can read that people have created solutions and are working on new ones for dashboards like you're describing.

Didn't read the entire thread, but this simple bash script I put together may be useful for some folks: