Skip to content

Commit db16e7b

Browse files
authored
Merge branch 'development' into tests/auth-middleware
2 parents 6c2fe70 + d3ed4d1 commit db16e7b

File tree

99 files changed

+639
-316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+639
-316
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
services:
4040
# Kafka service
4141
kafka:
42-
image: bitnami/kafka:3.4.1
42+
image: bitnamilegacy/kafka:3.4.1
4343
ports:
4444
- "9092:9092"
4545
env:

.github/workflows/typos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ jobs:
1111
- name: Checkout Code
1212
uses: actions/checkout@v5
1313
- name: typos-action
14-
uses: crate-ci/[email protected].2
14+
uses: crate-ci/[email protected].3

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ linters:
4444
- usestdlibvars
4545
- usetesting
4646
- whitespace
47-
- wsl
47+
- wsl_v5
4848

4949
# don't enable:
5050
# - godox # Disabling because we need TODO lines at this stage of project.

docs/advanced-guide/using-publisher-subscriber/page.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ Azure Event Hub is supported as an external PubSub provider such that if you are
344344
Import the external driver for `eventhub` using the following command.
345345

346346
```bash
347-
go get gofr.dev/pkg/gofr/datasources/pubsub/eventhub
347+
go get gofr.dev/pkg/gofr/datasource/pubsub/eventhub
348348
```
349349

350350
Use the `AddPubSub` method of GoFr's app to connect
@@ -359,6 +359,7 @@ app := gofr.New()
359359
StorageServiceURL: "https://gofrdev.windows.net/",
360360
StorageContainerName: "test",
361361
EventhubName: "test1",
362+
ConsumerGroup: "$Default",
362363
}))
363364
```
364365

examples/http-server/Dockerfile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
# Build stage
2-
FROM golang:1.24 AS build
2+
FROM golang:1.25-alpine AS build
3+
RUN apk add --no-cache build-base
34

45
WORKDIR /src
6+
7+
# Copy go.mod + go.sum first for better caching
8+
COPY go.mod go.sum ./
9+
RUN go mod download
10+
11+
# Copy the rest of the source code
512
COPY . .
6-
RUN go get ./...
7-
RUN go build -ldflags "-linkmode external -extldflags -static" -a -o /app/main main.go
13+
14+
# Move into http-server folder and build the package (not main.go)
15+
WORKDIR /src/examples/http-server
16+
RUN CGO_ENABLED=0 go build -a -o /app/main .
817

918
# Final stage
1019
FROM alpine:3.14
1120
RUN apk add --no-cache tzdata ca-certificates
1221
COPY --from=build /app/main /main
13-
COPY --from=build /src/configs /configs
22+
COPY --from=build /src/examples/http-server/configs /configs
1423
EXPOSE 9000
1524

16-
CMD ["/main"]
25+
CMD ["/main"]

examples/http-server/README.md

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,56 @@
22

33
This GoFr example demonstrates a simple HTTP server which supports Redis and MySQL as datasources.
44

5-
### To run the example follow the steps below:
5+
### To run the example, follow the steps below:
6+
7+
#### 1. Run with Docker Compose (recommended)
8+
9+
From the project root (`/gofr`):
10+
11+
```console
12+
docker compose -f examples/http-server/docker/docker-compose.yml up -d
13+
```
14+
15+
* Explanation:
16+
17+
* `-f examples/http-server/docker/docker-compose.yml` → path to the docker-compose file
18+
* `up -d` → builds (if needed) and runs services in detached mode
19+
20+
---
21+
22+
#### 2. Build & Run Manually (without docker-compose)
23+
24+
##### Build the Docker image
25+
26+
From the project root (`/gofr`):
27+
28+
```console
29+
docker build -f examples/http-server/Dockerfile -t http-server:latest .
30+
```
31+
32+
* Explanation:
33+
34+
* `-f examples/http-server/Dockerfile` → path to the Dockerfile
35+
* `-t http-server:latest` → tag for the Docker image
36+
* `.` → build context (project root; needed for `go.mod` and `go.sum`)
37+
38+
##### Run the Docker container
639

7-
- Run the docker image of the application
840
```console
9-
docker-compose up -d
41+
docker run -p 9000:9000 --name http-server http-server:latest
1042
```
1143

44+
* Explanation:
45+
* `-p 9000:9000` → maps container port 9000 to host port 9000
46+
* `--name http-server` → optional, gives your container a name
47+
48+
* Use **Compose** when you want the whole stack (app + Redis + MySQL + Grafana + Prometheus).
49+
* Use **Docker build/run** when you just want to run the app container alone.
50+
1251
To test the example, follow these steps:
1352

1453
1. Open your browser and navigate to `http://localhost:9000/hello`.
1554
2. To view the GoFr trace, open `https://tracer.gofr.dev` and paste the traceid.
16-
3. To view the Grafana Dashboard open `http://localhost:3000`
17-
55+
3. To access the Grafana Dashboard, open `http://localhost:3000`. The dashboard UI will be displayed. Use the default admin credentials to log in:
56+
- Username: `admin`
57+
- Password: `password`

examples/http-server/docker/docker-compose.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ version: '3.8'
33
services:
44
gofr-http-server:
55
build:
6-
context: ../.
7-
dockerfile: Dockerfile
6+
context: ../../../ # project root (so go.mod and go.sum are included)
7+
dockerfile: examples/http-server/Dockerfile
88
environment:
9-
- TRACE_EXPORTER=gofr
10-
- TRACER_RATIO=0.1
11-
- REDIS_HOST=redisdb
12-
- REDIS_PORT=6379
13-
- DB_HOST=mysqldb
14-
- DB_USER=root
15-
- DB_PASSWORD=password
16-
- DB_NAME=test
17-
- DB_PORT=3306
18-
- DB_DIALECT=mysql
9+
TRACE_EXPORTER: gofr
10+
TRACER_RATIO: 0.1
11+
REDIS_HOST: redisdb
12+
REDIS_PORT: 6379
13+
DB_HOST: mysqldb
14+
DB_USER: root
15+
DB_PASSWORD: password
16+
DB_NAME: test
17+
DB_PORT: 3306
18+
DB_DIALECT: mysql
1919
ports:
2020
- "9000:9000"
2121
- "2121:2121"
@@ -49,8 +49,8 @@ services:
4949
ports:
5050
- "3000:3000"
5151
environment:
52-
- GF_SECURITY_ADMIN_USER=admin
53-
- GF_SECURITY_ADMIN_PASSWORD=password
52+
GF_SECURITY_ADMIN_USER: admin
53+
GF_SECURITY_ADMIN_PASSWORD: password
5454
volumes:
5555
- ./provisioning:/etc/grafana/provisioning
5656
networks:

examples/using-add-filestore/go.mod

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.25
55
require (
66
github.com/stretchr/testify v1.11.1
77
go.uber.org/mock v0.6.0
8-
gofr.dev v1.45.0
8+
gofr.dev v1.46.0
99
gofr.dev/pkg/gofr/datasource/file/ftp v0.2.1
1010
)
1111

@@ -18,15 +18,15 @@ require (
1818
cloud.google.com/go/pubsub v1.49.0 // indirect
1919
filippo.io/edwards25519 v1.1.0 // indirect
2020
github.com/DATA-DOG/go-sqlmock v1.5.2 // indirect
21-
github.com/XSAM/otelsql v0.39.0 // indirect
21+
github.com/XSAM/otelsql v0.40.0 // indirect
2222
github.com/beorn7/perks v1.0.1 // indirect
23-
github.com/cenkalti/backoff/v5 v5.0.2 // indirect
23+
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
2424
github.com/cespare/xxhash/v2 v2.3.0 // indirect
25-
github.com/davecgh/go-spew v1.1.1 // indirect
25+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2626
github.com/dgraph-io/dgo/v210 v210.0.0-20230328113526-b66f8ae53a2d // indirect
2727
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
2828
github.com/dustin/go-humanize v1.0.1 // indirect
29-
github.com/eclipse/paho.mqtt.golang v1.5.0 // indirect
29+
github.com/eclipse/paho.mqtt.golang v1.5.1 // indirect
3030
github.com/felixge/httpsnoop v1.0.4 // indirect
3131
github.com/go-logr/logr v1.4.3 // indirect
3232
github.com/go-logr/stdr v1.2.2 // indirect
@@ -41,7 +41,7 @@ require (
4141
github.com/gorilla/websocket v1.5.3 // indirect
4242
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect
4343
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
44-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect
44+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
4545
github.com/hashicorp/errwrap v1.1.0 // indirect
4646
github.com/hashicorp/go-multierror v1.1.1 // indirect
4747
github.com/jlaffaye/ftp v0.2.0 // indirect
@@ -54,15 +54,15 @@ require (
5454
github.com/openzipkin/zipkin-go v0.4.3 // indirect
5555
github.com/pierrec/lz4/v4 v4.1.22 // indirect
5656
github.com/pkg/errors v0.9.1 // indirect
57-
github.com/pmezard/go-difflib v1.0.0 // indirect
58-
github.com/prometheus/client_golang v1.23.0 // indirect
57+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
58+
github.com/prometheus/client_golang v1.23.2 // indirect
5959
github.com/prometheus/client_model v0.6.2 // indirect
60-
github.com/prometheus/common v0.65.0 // indirect
61-
github.com/prometheus/otlptranslator v0.0.0-20250717125610-8549f4ab4f8f // indirect
60+
github.com/prometheus/common v0.66.1 // indirect
61+
github.com/prometheus/otlptranslator v0.0.2 // indirect
6262
github.com/prometheus/procfs v0.17.0 // indirect
63-
github.com/redis/go-redis/extra/rediscmd/v9 v9.12.1 // indirect
64-
github.com/redis/go-redis/extra/redisotel/v9 v9.12.1 // indirect
65-
github.com/redis/go-redis/v9 v9.12.1 // indirect
63+
github.com/redis/go-redis/extra/rediscmd/v9 v9.14.0 // indirect
64+
github.com/redis/go-redis/extra/redisotel/v9 v9.14.0 // indirect
65+
github.com/redis/go-redis/v9 v9.14.0 // indirect
6666
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
6767
github.com/segmentio/kafka-go v0.4.49 // indirect
6868
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
@@ -71,36 +71,37 @@ require (
7171
go.opencensus.io v0.24.0 // indirect
7272
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
7373
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect
74-
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.62.0 // indirect
75-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect
74+
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 // indirect
75+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
7676
go.opentelemetry.io/otel v1.38.0 // indirect
77-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
78-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0 // indirect
79-
go.opentelemetry.io/otel/exporters/prometheus v0.59.1 // indirect
80-
go.opentelemetry.io/otel/exporters/zipkin v1.37.0 // indirect
77+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect
78+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect
79+
go.opentelemetry.io/otel/exporters/prometheus v0.60.0 // indirect
80+
go.opentelemetry.io/otel/exporters/zipkin v1.38.0 // indirect
8181
go.opentelemetry.io/otel/metric v1.38.0 // indirect
82-
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
83-
go.opentelemetry.io/otel/sdk/metric v1.37.0 // indirect
82+
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
83+
go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect
8484
go.opentelemetry.io/otel/trace v1.38.0 // indirect
85-
go.opentelemetry.io/proto/otlp v1.7.0 // indirect
86-
golang.org/x/crypto v0.41.0 // indirect
85+
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
86+
go.yaml.in/yaml/v2 v2.4.2 // indirect
87+
golang.org/x/crypto v0.42.0 // indirect
8788
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect
88-
golang.org/x/net v0.43.0 // indirect
89+
golang.org/x/net v0.44.0 // indirect
8990
golang.org/x/oauth2 v0.31.0 // indirect
9091
golang.org/x/sync v0.17.0 // indirect
91-
golang.org/x/sys v0.35.0 // indirect
92-
golang.org/x/term v0.34.0 // indirect
92+
golang.org/x/sys v0.36.0 // indirect
93+
golang.org/x/term v0.35.0 // indirect
9394
golang.org/x/text v0.29.0 // indirect
9495
golang.org/x/time v0.12.0 // indirect
9596
google.golang.org/api v0.249.0 // indirect
9697
google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect
97-
google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7 // indirect
98-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c // indirect
99-
google.golang.org/grpc v1.75.0 // indirect
100-
google.golang.org/protobuf v1.36.8 // indirect
98+
google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect
99+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect
100+
google.golang.org/grpc v1.75.1 // indirect
101+
google.golang.org/protobuf v1.36.9 // indirect
101102
gopkg.in/yaml.v3 v3.0.1 // indirect
102103
modernc.org/libc v1.66.3 // indirect
103104
modernc.org/mathutil v1.7.1 // indirect
104105
modernc.org/memory v1.11.0 // indirect
105-
modernc.org/sqlite v1.38.2 // indirect
106+
modernc.org/sqlite v1.39.0 // indirect
106107
)

0 commit comments

Comments
 (0)