Octoprint

From HackPittsburgh Wiki
Jump to navigation Jump to search

Octoprint

The 3D printer laptop is set up with Octoprint.


Installing Octoprint

Unfortunately we don't have a lot of notes from the first time we set up Octoprint. These are the rough notes, they will be expanded and fleshed out when we set up Octoprint on the new 3D printer laptop.

Multiprinter setup howto:

http://thomas-messmer.com/index.php/14-free-knowledge/howtos/79-setting-up-octoprint-for-multiple-printers

https://discourse.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337/1

https://cbonte.github.io/haproxy-dconv/1.8/configuration.html


We were encountering a config error. The solution turned out to be that the use_backend test has to be defined on a separate line as an ACL.

The following links provided relevant information:

https://www.digitalocean.com/community/tutorials/an-introduction-to-haproxy-and-load-balancing-concepts

http://cbonte.github.io/haproxy-dconv/1.8/configuration.html#4-use_backend

https://www.digitalocean.com/community/tutorials/how-to-use-haproxy-as-a-layer-7-load-balancer-for-wordpress-and-nginx-on-ubuntu-14-04

https://www.haproxy.com/blog/web-application-name-to-backend-mapping-in-haproxy/

The final, working config file is:

global
        maxconn 4096
        user haproxy
        group haproxy
        daemon
        log /dev/log local0

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
        option forwardfor except 127.0.0.1
        acl jeremy path_beg /jeremy_i3
        acl jesse path_beg /jesse_i3
        use_backend jeremy_i3 if jeremy
        use_backend jesse_i3 if jesse
        default_backend jeremy_i3

backend jesse_i3
        reqrep ^([^\ :]*)\ /jesse_i3/(.*)     \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-Script-Name:\ /jesse_i3

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