Skip to content
This repository was archived by the owner on Apr 15, 2020. It is now read-only.

Commit c27ea78

Browse files
committed
Minor, long due updates
* Logo updated * (c) updated * Fixed a null pointer * Added backoff for when Docker is not immediately ready * Updated dependencies
1 parent 33bc224 commit c27ea78

File tree

7 files changed

+195
-105
lines changed

7 files changed

+195
-105
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ systemctl restart nscd
237237

238238
## Development
239239

240-
We depend on at least Go 1.11.
240+
This projects requires Go 1.11 or newer.
241241

242242
There is a `Makefile` with targets for any common task.
243243

docker/client.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ func (client *Client) Launch() error {
2424
}
2525
client.dockerClient = dockerClient
2626

27-
client.updateContainers()
27+
err = client.updateContainers()
28+
if err != nil {
29+
return err
30+
}
2831

2932
listener := make(chan *docker.APIEvents)
3033
err = dockerClient.AddEventListener(listener)
@@ -50,6 +53,10 @@ func (client *Client) Launch() error {
5053

5154
// handles an event emitted by Docker
5255
func (client *Client) handleEvent(event *docker.APIEvents) error {
56+
if event == nil {
57+
return nil
58+
}
59+
5360
if event.Type != "container" {
5461
return nil
5562
}

go.mod

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
module github.com/ninech/reception
22

3+
replace github.com/Sirupsen/logrus v1.4.2 => github.com/sirupsen/logrus v1.4.1
4+
35
require (
4-
github.com/GeertJohan/go.incremental v0.0.0-20161212213043-1172aab96510 // indirect
5-
github.com/GeertJohan/go.rice v0.0.0-20170420135705-c02ca9a983da
6-
github.com/akavel/rsrc v0.0.0-20170831122431-f6a15ece2cfd // indirect
7-
github.com/daaku/go.zipexe v0.0.0-20150329023125-a5fe2436ffcb // indirect
8-
github.com/fsouza/go-dockerclient v1.3.1
9-
github.com/jessevdk/go-flags v1.4.0 // indirect
10-
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 // indirect
11-
github.com/miekg/dns v1.0.13
12-
github.com/tdewolff/minify v2.3.5+incompatible
13-
github.com/tdewolff/parse v2.3.3+incompatible // indirect
14-
github.com/tdewolff/test v0.0.0-20171106182207-265427085153 // indirect
15-
golang.org/x/lint v0.0.0-20181011164241-5906bd5c48cd // indirect
16-
golang.org/x/tools v0.0.0-20181013145246-13216ffa54f0 // indirect
6+
github.com/GeertJohan/go.rice v1.0.0
7+
github.com/cenkalti/backoff v2.2.1+incompatible
8+
github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6 // indirect
9+
github.com/daaku/go.zipexe v1.0.1 // indirect
10+
github.com/fsouza/go-dockerclient v1.4.4
11+
github.com/gogo/protobuf v1.3.0 // indirect
12+
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
13+
github.com/kr/pretty v0.1.0 // indirect
14+
github.com/miekg/dns v1.1.16
15+
github.com/sirupsen/logrus v1.4.2 // indirect
16+
github.com/stretchr/testify v1.4.0 // indirect
17+
github.com/tdewolff/minify v2.3.6+incompatible
18+
github.com/tdewolff/parse v2.3.4+incompatible // indirect
19+
github.com/tdewolff/test v1.0.3 // indirect
20+
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 // indirect
21+
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect
22+
golang.org/x/sys v0.0.0-20190830142957-1e83adbbebd0 // indirect
23+
golang.org/x/text v0.3.2 // indirect
24+
google.golang.org/appengine v1.4.0 // indirect
25+
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect
26+
google.golang.org/grpc v1.23.0 // indirect
27+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
1728
)

go.sum

Lines changed: 139 additions & 72 deletions
Large diffs are not rendered by default.

http/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package http
22

33
import (
4+
"github.com/tdewolff/minify/html"
45
"html/template"
56
"io"
67
"net/http"
@@ -12,7 +13,6 @@ import (
1213
"github.com/ninech/reception/common"
1314
"github.com/tdewolff/minify"
1415
"github.com/tdewolff/minify/css"
15-
"github.com/tdewolff/minify/html"
1616
"github.com/tdewolff/minify/js"
1717

1818
"github.com/GeertJohan/go.rice"

reception.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ package main
33
import (
44
"flag"
55
"fmt"
6-
net_http "net/http"
7-
"runtime"
8-
6+
"github.com/cenkalti/backoff"
97
miekg_dns "github.com/miekg/dns"
108
"github.com/ninech/reception/common"
119
"github.com/ninech/reception/dns"
1210
"github.com/ninech/reception/docker"
1311
"github.com/ninech/reception/http"
12+
net_http "net/http"
13+
"runtime"
1414
)
1515

1616
var config = &common.Config{
@@ -56,6 +56,7 @@ func BoolFlag(p *bool, name string, value bool, usage string) {
5656

5757
func main() {
5858
fmt.Println("(c) 2017-2018 Nine Internet Solutions AG")
59+
fmt.Println("(c) 2018-2019 nxt Engineering GmbH")
5960

6061
flag.Parse()
6162

@@ -67,7 +68,10 @@ func main() {
6768
go runHttpFrontend()
6869
go runDns()
6970

70-
runDockerClient()
71+
err := backoff.Retry(runDockerClient, backoff.NewExponentialBackOff())
72+
if err != nil {
73+
panic(err)
74+
}
7175
}
7276

7377
func runDns() {
@@ -92,14 +96,11 @@ func runDns() {
9296
}
9397
}
9498

95-
func runDockerClient() {
99+
func runDockerClient() error {
96100
client := docker.Client{
97101
Config: config,
98102
}
99-
err := client.Launch()
100-
if err != nil {
101-
panic(err)
102-
}
103+
return client.Launch()
103104
}
104105

105106
func runHttpFrontend() {

resources/index.html.tmpl

Lines changed: 12 additions & 8 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)