Skip to content

Commit bba2064

Browse files
authored
Merge pull request #12 from msquee/feature/docker
Add Docker development environment and Prometheus metrics exports
2 parents 40236a9 + aacc527 commit bba2064

File tree

22 files changed

+652
-18
lines changed

22 files changed

+652
-18
lines changed

.docker/grafana/dashboards/go-websockify.json

Lines changed: 401 additions & 0 deletions
Large diffs are not rendered by default.

.docker/grafana/grafana.ini

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
instance_name = grafana
2+
http_port = 3000
3+
4+
[dashboards]
5+
versions_to_keep = 5
6+
default_home_dashboard_path = /etc/grafana/dashboards/go-websockify.json
7+
8+
[plugin.grafana-image-renderer]
9+
rendering_ignore_https_errors = true
10+
11+
[users]
12+
allow_sign_up = false
13+
default_theme = "dark"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: 1
2+
3+
providers:
4+
- name: 'Go WebSockify'
5+
orgId: 1
6+
type: file
7+
editable: true
8+
updateIntervalSeconds: 5
9+
allowUiUpdates: true
10+
options:
11+
path: /etc/grafana/dashboards
12+
foldersFromFilesStructure: true
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: Prometheus
5+
type: prometheus
6+
access: proxy
7+
url: http://prometheus:9090
8+
isDefault: true

.docker/grafana/provisioning/notifiers/.keep

Whitespace-only changes.

.docker/grafana/provisioning/plugins/.keep

Whitespace-only changes.

.docker/prometheus/prometheus.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
global:
2+
scrape_interval: 1s
3+
4+
scrape_configs:
5+
- job_name: "prometheus"
6+
static_configs:
7+
- targets: ["localhost:9090"]
8+
9+
- job_name: "go-websockify"
10+
scrape_interval: 1s
11+
static_configs:
12+
- targets: ["go-websockify:8080"]

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
client/
2+
.docker/
3+
screenshots/
4+
bin/

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM golang:1.14.7 as build
2+
3+
RUN mkdir /go-websockify
4+
WORKDIR /go-websockify
5+
COPY go.mod .
6+
COPY go.sum .
7+
8+
RUN go mod download
9+
COPY . .
10+
11+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-w -s -X main.versionString=$(git describe --tags --first-parent --abbrev=6 --long --dirty --always) -X main.buildTime=$(date -Iseconds)" -o /go/bin/go-websockify
12+
FROM scratch
13+
COPY --from=build /go/bin/go-websockify /go/bin/go-websockify
14+
ENTRYPOINT ["/go/bin/go-websockify"]

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
all: build
99

1010
build:
11-
GOOS=linux GOARCH=amd64
12-
go build -ldflags="-w -s -X main.versionString=$$(git describe --tags --first-parent --abbrev=6 --long --dirty --always) -X main.buildTime=$$(date -Iseconds)" -o ./bin/go-websockify
11+
GOOS=linux GOARCH=amd64 go build -ldflags="-w -s -X main.versionString=$$(git describe --tags --first-parent --abbrev=6 --long --dirty --always) -X main.buildTime=$(date)" -o ./bin/go-websockify
1312

1413
clean:
1514
rm -rf bin/

0 commit comments

Comments
 (0)