forked from pub-solar/os
Switch from caddy to haproxy
This commit is contained in:
parent
67e90032c4
commit
9aafa7ff52
|
@ -2,7 +2,9 @@
|
|||
|
||||
with lib;
|
||||
|
||||
let cfg = config.pub-solar.x-os;
|
||||
let
|
||||
psCfg = config.pub-solar;
|
||||
cfg = psCfg.x-os;
|
||||
in
|
||||
{
|
||||
options.pub-solar.x-os = {
|
||||
|
@ -34,21 +36,51 @@ in
|
|||
|
||||
# These entries get added to /etc/hosts
|
||||
networking.hosts = {
|
||||
"127.0.0.1" = [ "cups.local" ];
|
||||
"127.0.0.1" = mkIf psCfg.printing.enable [ "cups.local" ];
|
||||
};
|
||||
|
||||
# Caddy reverse proxy for local services like cups
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
config = ''
|
||||
{
|
||||
auto_https off
|
||||
}
|
||||
cups.local:80
|
||||
bind 127.0.0.1
|
||||
request_header Host localhost:631
|
||||
reverse_proxy unix//run/cups/cups.sock
|
||||
'';
|
||||
};
|
||||
# ha reverse proxy for local services like cups
|
||||
services.haproxy.enable = true;
|
||||
services.haproxy.config = ''
|
||||
global
|
||||
maxconn 4096
|
||||
# user http
|
||||
# group http
|
||||
daemon
|
||||
|
||||
defaults
|
||||
log global
|
||||
mode http
|
||||
option httplog
|
||||
option dontlognull
|
||||
retries 3
|
||||
option redispatch
|
||||
maxconn 2000
|
||||
timeout connect 5000
|
||||
timeout client 50000
|
||||
timeout server 50000
|
||||
log 127.0.0.1 local0
|
||||
log 127.0.0.1 local7 debug
|
||||
option httpchk
|
||||
|
||||
frontend http
|
||||
bind 0.0.0.0:80
|
||||
|
||||
acl is_cups hdr_end(host) -i cups.local
|
||||
acl is_local dst 127.0.0.1
|
||||
|
||||
use_backend cups if is_cups is_local
|
||||
|
||||
frontend vnc
|
||||
bind 0.0.0.0:5901
|
||||
mode tcp
|
||||
use_backend vnc
|
||||
|
||||
backend cups
|
||||
server cups unix@/run/cups/cups.sock
|
||||
|
||||
backend vnc
|
||||
server vnc unix@/run/wayvnc.sock
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue