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 fcf456f
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 50 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
7 changes: 4 additions & 3 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,8 +10,9 @@ 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/nijeti/healthcheck/servers/fasthttp v1.0.0-beta.2
github.com/stretchr/testify v1.9.0
github.com/valyala/fasthttp v1.55.0
)

require (
Expand All @@ -29,11 +30,11 @@ 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/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
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.55.0 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/sys v0.22.0 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa1
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
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 fcf456f

Please sign in to comment.