Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM golang:1.25 AS build
WORKDIR /build/src
COPY . .
RUN CGO_ENABLED=0 go build -trimpath -ldflags=-s -o bin/mokv .
FROM scratch
COPY --from=build /build/src/bin/mokv /usr/bin/mokv
ENTRYPOINT [ "/usr/bin/mokv" ]

8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ start:

.PHONY: build
build:
go build -o bin/mokv main.go
go build -o bin/mokv .

.PHONY: perf
perf:
-go test -bench=. -benchtime=5s ./mokv -benchmem -run=^#
-go test -bench=. -benchtime=5s ./mokv -benchmem -run=^#

.PHONY: perf-long
perf-long:
-go test -bench=. -benchtime=60s ./mokv -benchmem -run=^#
54 changes: 54 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
services:
mokv:
build: .
command:
- "--bootstrap"

ports:
- "8400:8400"
- "8401:8401"
- "4000:4000"
networks:
- mokv-net

prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
- prometheus-data:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--web.console.libraries=/usr/share/prometheus/console_libraries"
- "--web.console.templates=/usr/share/prometheus/consoles"
networks:
- mokv-net
depends_on:
- mokv

grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
volumes:
- grafana-data:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning
networks:
- mokv-net
depends_on:
- prometheus
- mokv

networks:
mokv-net:
driver: bridge

volumes:
prometheus-data:
grafana-data:
10 changes: 10 additions & 0 deletions prometheus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
global:
scrape_interval: 15s
evaluation_interval: 15s

scrape_configs:
- job_name: "mokv"
static_configs:
- targets: ["mokv:4000"]
labels:
service: "mokv"