File tree 9 files changed +170
-69
lines changed
9 files changed +170
-69
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ name : Build and publish docker image
2
+
3
+ on :
4
+ push :
5
+ branches : ['main']
6
+
7
+ jobs :
8
+ push_to_registry :
9
+ name : Push Docker image to Quay
10
+ runs-on : ubuntu-latest
11
+ permissions :
12
+ packages : write
13
+ contents : read
14
+ attestations : write
15
+ id-token : write
16
+ steps :
17
+ - name : Check out the repo
18
+ uses : actions/checkout@v4
19
+
20
+ - name : Log in to Quay
21
+ uses : docker/login-action@v3
22
+ with :
23
+ registry : quay.io
24
+ username : ${{ secrets.QUAY_USERNAME }}
25
+ password : ${{ secrets.QUAY_ROBOT_TOKEN }}
26
+
27
+ - name : Extract metadata (tags, labels) for Docker
28
+ id : meta
29
+ uses : docker/metadata-action@v5
30
+ with :
31
+ images : quay.io/road/heartbeat-collector
32
+ tags : |
33
+ type=raw,value=latest,enable=true
34
+ type=sha,prefix=,format=long
35
+
36
+ - name : Build and push Docker image
37
+ id : push
38
+ uses : docker/build-push-action@v6
39
+ with :
40
+ context : .
41
+ file : ./Dockerfile
42
+ push : true
43
+ tags : ${{ steps.meta.outputs.tags }}
44
+ labels : ${{ steps.meta.outputs.labels }}
45
+
46
+ - name : Generate artifact attestation
47
+ uses : actions/attest-build-provenance@v1
48
+ with :
49
+ subject-name : quay.io/road/heartbeat-collector
50
+ subject-digest : ${{ steps.push.outputs.digest }}
51
+ push-to-registry : true
Original file line number Diff line number Diff line change @@ -23,4 +23,5 @@ go.work.sum
23
23
24
24
# env file
25
25
.env
26
- heartbeats.db
26
+ heartbeats.db
27
+ .idea
Original file line number Diff line number Diff line change 1
- FROM golang:1.23 -alpine AS build-stage
1
+ FROM golang:1.24 -alpine AS build-stage
2
2
3
3
WORKDIR /app
4
4
@@ -21,7 +21,6 @@ RUN apk --no-cache add sqlite ca-certificates
21
21
WORKDIR /app
22
22
23
23
COPY --from=build-stage /app/heartbeat-collector .
24
- COPY --from=build-stage /app/heartbeats.db /app/heartbeats.db
25
24
26
25
EXPOSE 8080 8081
27
26
Original file line number Diff line number Diff line change 6
6
To run the heartbeat collector, use the following command in the root of the project
7
7
8
8
``` sh
9
- task watch
9
+ task run
10
10
```
11
11
12
12
### Creating a heartbeat
13
13
14
14
``` sh
15
- curl -X PUT http://localhost:8080/hb/secret -d ' {
16
- "secret": "secret",
15
+ curl -X PUT http://localhost:8181/hb/{id} -d ' {
17
16
"expiry": "2025-12-31T23:59:59Z",
18
17
"label": "example",
19
18
"metadata": {
20
19
"k1": "v1",
21
20
"k2": "v2"
22
21
}
23
22
}' -H " Content-Type: application/json"
24
-
25
- Heartbeat registered
26
23
```
27
24
28
25
### Reading a heartbeat
29
26
``` sh
30
- curl -X GET http://localhost:8081 /hb/secret
27
+ curl -X GET http://localhost:8080 /hb/{id}
31
28
32
29
{
33
- " secret " :" secret " ,
30
+ " id " :" id " ,
34
31
" expiry" :" 2025-12-31T23:59:59Z" ,
35
32
" label" :" example-label" ,
36
33
" metadata" :
Original file line number Diff line number Diff line change @@ -61,6 +61,11 @@ tasks:
61
61
-v {{.SQLITE_DSN}}:/app/{{.SQLITE_DSN}} \
62
62
heartbeat-collector:latest
63
63
64
+ run :
65
+ desc : " Run the application"
66
+ cmds :
67
+ - cmd : go run main.go
68
+
64
69
watch :
65
70
desc : " Run the application with live reloading"
66
71
cmds :
Original file line number Diff line number Diff line change 1
1
module github.com/e-flux-platform/heartbeat-collector
2
2
3
- go 1.23
3
+ go 1.24.1
4
4
5
5
require (
6
6
github.com/mattn/go-sqlite3 v1.14.24
7
7
github.com/urfave/cli/v2 v2.27.6
8
+ golang.org/x/sync v0.12.0
8
9
)
9
10
10
11
require (
Original file line number Diff line number Diff line change @@ -8,3 +8,5 @@ github.com/urfave/cli/v2 v2.27.6 h1:VdRdS98FNhKZ8/Az8B7MTyGQmpIr36O1EHybx/LaZ4g=
8
8
github.com/urfave/cli/v2 v2.27.6 /go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ =
9
9
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4 =
10
10
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 /go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM =
11
+ golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw =
12
+ golang.org/x/sync v0.12.0 /go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA =
You can’t perform that action at this time.
0 commit comments