Multiple instances of Octoprint on a single RPi

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.

3 posts were merged into an existing topic: Multiple printers per Pi megathread