Skip to content

Commit

Permalink
Upgrade Healthcheck library
Browse files Browse the repository at this point in the history
  • Loading branch information
NiJeTi committed Sep 13, 2024
1 parent 7e1eb03 commit 8041890
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: 'Setup Go'
uses: actions/setup-go@v5
with:
go-version: 1.22
go-version: 1.23

- name: 'Install dependencies'
run: go mod download
Expand Down
2 changes: 1 addition & 1 deletion build/migrator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22-alpine3.20 as build
FROM golang:1.23-alpine3.20 as build
WORKDIR /build

COPY . .
Expand Down
2 changes: 1 addition & 1 deletion build/service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22-alpine3.20 as build
FROM golang:1.23-alpine3.20 as build
WORKDIR /build

COPY . .
Expand Down
16 changes: 12 additions & 4 deletions cmd/service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os/signal"

"github.com/nijeti/healthcheck"
"github.com/nijeti/healthcheck/servers/fasthttp"

"github.com/nijeti/cinema-keeper/internal/db"
"github.com/nijeti/cinema-keeper/internal/discord"
Expand All @@ -18,7 +19,6 @@ import (
"github.com/nijeti/cinema-keeper/internal/handlers/unlock"
cfgPkg "github.com/nijeti/cinema-keeper/internal/pkg/config"
"github.com/nijeti/cinema-keeper/internal/pkg/dbUtils"
"github.com/nijeti/cinema-keeper/internal/pkg/hcServer"
)

type config struct {
Expand Down Expand Up @@ -77,7 +77,9 @@ func main() {
},
}
discord.RegisterCommands(discordSession, commands, cfg.Discord.Guild)
defer discord.UnregisterCommands(discordSession, commands, cfg.Discord.Guild)
defer discord.UnregisterCommands(
discordSession, commands, cfg.Discord.Guild,
)

discordProbe := discord.NewProbe(discordSession)

Expand All @@ -87,8 +89,14 @@ func main() {
healthcheck.WithProbe("db", dbProbe),
healthcheck.WithProbe("discord", discordProbe),
)
hcs := hcServer.Serve(":8080", hc)
defer hcs.Shutdown()
hcs := fasthttp.New(
hc,
fasthttp.WithLogger(hcLogger),
fasthttp.WithAddress(":8080"),
fasthttp.WithRoute("/health"),
)
hcs.Start()
defer hcs.Stop()

// run
log.Println("startup complete")
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/nijeti/cinema-keeper

go 1.22.1
go 1.23

require (
github.com/bwmarrin/discordgo v0.28.1
Expand All @@ -10,6 +10,7 @@ require (
github.com/knadh/koanf/providers/file v1.0.0
github.com/knadh/koanf/v2 v2.1.1
github.com/lib/pq v1.10.9
github.com/nijeti/healthcheck v1.0.0-beta.2
github.com/stretchr/testify v1.9.0
github.com/valyala/fasthttp v1.55.0
)
Expand All @@ -29,7 +30,7 @@ require (
github.com/kr/pretty v0.3.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/nijeti/healthcheck v1.0.0-beta.1 // indirect
github.com/nijeti/healthcheck/servers/fasthttp v1.0.0-beta.2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/nijeti/healthcheck v1.0.0-beta.1 h1:qUaW2UTRBQVzkxl7zcq4+T1Qlrx0+Z7tQGM32IKMJLg=
github.com/nijeti/healthcheck v1.0.0-beta.1/go.mod h1:7FrjSzn+K+GgOcqrgpUCaj01Elnn2F5+Ri3IixIizaA=
github.com/nijeti/healthcheck v1.0.0-beta.2 h1:99dRxvH5rSj7mseQgb4e9nt/PGuAwVeMJW40RTmFWTc=
github.com/nijeti/healthcheck v1.0.0-beta.2/go.mod h1:YOvJznQqQ7qUbHOJhjS/gNMxEWyBkgsNeYWxLViOi70=
github.com/nijeti/healthcheck/servers/fasthttp v1.0.0-beta.2 h1:CObHhO7XSorPZVYXUDbDOtaZLDWUg4o+PaM9OYXOWlo=
github.com/nijeti/healthcheck/servers/fasthttp v1.0.0-beta.2/go.mod h1:sqZTsoePDrrqFWVOQYPPSNeLuG0WWlhumZzSkWDCrnw=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
Expand Down
38 changes: 0 additions & 38 deletions internal/pkg/hcServer/server.go

This file was deleted.

0 comments on commit 8041890

Please sign in to comment.