From 63f41b691a9f5224f3943c27765e3d52c592059c Mon Sep 17 00:00:00 2001 From: johnerikhalse Date: Thu, 11 Apr 2019 09:47:11 +0200 Subject: [PATCH] Cache without balancer should be able to run without kubernetes --- go/cmd/confighandler/main.go | 9 ++++----- squid-balancer.conf | 10 ---------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/go/cmd/confighandler/main.go b/go/cmd/confighandler/main.go index 6e914ef..a15a416 100644 --- a/go/cmd/confighandler/main.go +++ b/go/cmd/confighandler/main.go @@ -15,21 +15,19 @@ import ( ) func main() { - r := &rewriter{discovery: discover.NewDiscovery()} + r := &rewriter{} flag.BoolVar(&r.balancer, "b", false, "Set to true to make this node a non-caching load balancing node") flag.Parse() if r.balancer { log.Print("Confighandler: Init squid as balancer") + r.discovery = discover.NewDiscovery() } else { log.Print("Confighandler: Init squid cache") } r.check() - log.Print("- - - - - - - - - - - - - - -") - log.Print("starting daemon") - context := &daemon.Context{LogFileName: "/proc/self/fd/2"} child, err := context.Reborn() if err != nil { @@ -37,11 +35,12 @@ func main() { } if child != nil { + // This code is run in parent process log.Printf("Confighandler: Init done") return } else { + // This code is run in forked child defer context.Release() - log.Print("- - - - - - - - - - - - - - -") log.Print("Confighandler: daemon started") for { r.check() diff --git a/squid-balancer.conf b/squid-balancer.conf index 74c79f8..cf6a2de 100644 --- a/squid-balancer.conf +++ b/squid-balancer.conf @@ -10,7 +10,6 @@ logfile_daemon /usr/bin/loghelper http_port 3128 forward_max_tries 10 -coredump_dir /var/cache/squid sslproxy_cert_error allow all workers 1 @@ -82,12 +81,3 @@ request_header_access veidemann_eid deny all maximum_object_size 64 MB offline_mode on - -# Refresh patterns -#refresh_pattern . 4320 100% 4320 store-stale override-expire override-lastmod ignore-private ignore-reload ignore-no-store -#refresh_pattern ^ftp: 1440 20% 10080 -#refresh_pattern ^gopher: 1440 0% 1440 -#refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 -#refresh_pattern . 0 20% 4320 - -#cache_dir ufs /var/cache/squid 102400 16 256 # Size: 100GB, First level dirs: 16, Second level dirs: 256