Skip to content

Commit

Permalink
Merge pull request #6 from nlnwa/loadbalancing
Browse files Browse the repository at this point in the history
Cache without balancer should be able to run without kubernetes
  • Loading branch information
johnerikhalse authored Apr 11, 2019
2 parents 103a555 + 63f41b6 commit 81c8184
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
9 changes: 4 additions & 5 deletions go/cmd/confighandler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,32 @@ 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 {
log.Fatal("Confighandler: Unable to run: ", err)
}

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()
Expand Down
10 changes: 0 additions & 10 deletions squid-balancer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 81c8184

Please sign in to comment.