Skip to content

Commit 47594cb

Browse files
committed
Create v0.2.11 release, common version string, healthcheck endpoint, healthcheck in Dockerfile
1 parent 8932f6b commit 47594cb

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ WORKDIR /app
1111
COPY --from=builder /app/server .
1212
EXPOSE 8080
1313
USER appuser
14+
HEALTHCHECK CMD wget --spider http://127.0.0.1:8080/health || exit 1
1415
CMD ["./server"]

changelog.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919

2020
### Security
2121

22+
## [0.2.11] - 2025-10-24
23+
24+
### Added
25+
26+
- Healthcheck in Dockerfile
27+
- `/health` endpoint for healthcheck, returns current server version
28+
2229
## [0.2.10] - 2025-10-24
2330

2431
### Fixed
@@ -125,7 +132,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
125132
- Go programs for [client](./tui/main.go) and [server](./server/main.go)
126133
- GitHub Actions release flow, including binaries
127134

128-
[unreleased]: https://github.com/supleed2/go-chat/compare/v0.2.10...HEAD
135+
[unreleased]: https://github.com/supleed2/go-chat/compare/v0.2.11...HEAD
136+
[0.2.11]: https://github.com/supleed2/go-chat/releases/tag/v0.2.11
129137
[0.2.10]: https://github.com/supleed2/go-chat/releases/tag/v0.2.10
130138
[0.2.9]: https://github.com/supleed2/go-chat/releases/tag/v0.2.9
131139
[0.2.8]: https://github.com/supleed2/go-chat/releases/tag/v0.2.8

client/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ type args struct {
7676
}
7777

7878
func (a *args) Version() string {
79-
return "v0.2.10"
79+
return c.Version
8080
}
8181

8282
func (a *args) Description() string {

common/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package common
22

33
import "time"
44

5+
const Version = "0.2.11"
6+
57
type SMsg struct {
68
Tim time.Time
79
Id string

server/main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const createRoomTable = "CREATE TABLE IF NOT EXISTS %s (tim DATETIME, id TEXT, m
6464
const insertRoomMsg = "INSERT INTO %v (tim, id, msg) VALUES (:tim, :id, :msg)"
6565

6666
func (a *args) Version() string {
67-
return "v0.2.10"
67+
return c.Version
6868
}
6969

7070
func (a *args) Description() string {
@@ -147,6 +147,12 @@ func run(addr string, nickMap map[string]string, admin string, rhlen int, log *l
147147
}
148148

149149
func (s server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
150+
if r.Method == "GET" && r.URL.Path == "/health" {
151+
w.WriteHeader(http.StatusOK)
152+
fmt.Fprintf(w, "go-chat %s is up!", c.Version)
153+
return
154+
}
155+
150156
if r.ProtoAtLeast(1, 1) && !hasUpgradeHeader(r.Header) {
151157
http.Redirect(w, r, "https://github.com/supleed2/go-chat", http.StatusSeeOther)
152158
return

0 commit comments

Comments
 (0)