Skip to content

Commit e3d8976

Browse files
Rodrigo Dos SantosRodrigo Dos Santos
authored andcommitted
Update React Version - WIP
1 parent 85ae648 commit e3d8976

File tree

13 files changed

+212
-32
lines changed

13 files changed

+212
-32
lines changed

authentication-common/src/main/java/com/microservice/authentication/autoconfigure/AuthenticationCommonConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public OAuth2AccessToken enhance(
161161
return converter;
162162
}
163163

164-
@Profile("auth")
164+
@Profile({"!dev & auth"})
165165
@Bean
166166
KeyPair getKeyPair(AuthenticationProperties authenticationProperties) throws Exception {
167167
AuthenticationProperties.Jwt jwt = authenticationProperties.getJwt();

authentication-service/pom.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,34 @@
2020
</properties>
2121

2222
<dependencies>
23+
<dependency>
24+
<groupId>org.springframework.cloud</groupId>
25+
<artifactId>spring-cloud-starter-sleuth</artifactId>
26+
<exclusions>
27+
<exclusion>
28+
<groupId>org.springframework.cloud</groupId>
29+
<artifactId>spring-cloud-sleuth-brave</artifactId>
30+
</exclusion>
31+
</exclusions>
32+
</dependency>
33+
34+
<dependency>
35+
<groupId>org.springframework.cloud</groupId>
36+
<artifactId>spring-cloud-sleuth-otel-autoconfigure</artifactId>
37+
</dependency>
38+
39+
<dependency>
40+
<groupId>io.opentelemetry</groupId>
41+
<artifactId>opentelemetry-exporter-otlp-trace</artifactId>
42+
<version>1.14.0</version>
43+
</dependency>
44+
45+
<dependency>
46+
<groupId>io.opentelemetry</groupId>
47+
<artifactId>opentelemetry-exporter-otlp-common</artifactId>
48+
<version>1.14.0</version>
49+
</dependency>
50+
2351
<dependency>
2452
<groupId>org.springframework.cloud</groupId>
2553
<artifactId>spring-cloud-starter-kubernetes-fabric8-config</artifactId>

authentication-service/src/main/java/com/microservice/authentication/config/TracerConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
@Configuration
1010
public class TracerConfiguration {
1111

12-
@Primary
12+
/*@Primary
1313
@Bean
1414
public io.opentracing.Tracer jaegerTracer() {
1515
return io.opentracing.noop.NoopTracerFactory.create();
16-
}
16+
}*/
1717
}

docker/docker-compose.yml

Lines changed: 88 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -400,27 +400,78 @@ services:
400400
aliases:
401401
- prometheus
402402

403+
404+
elasticsearch:
405+
image: elasticsearch
406+
container_name: elasticsearch
407+
ports:
408+
- "9200:9200"
409+
410+
kibana:
411+
image: kibana
412+
container_name: kibana
413+
links:
414+
- "elasticsearch"
415+
ports:
416+
- "5601:5601"
417+
418+
fluentd:
419+
build: ./fluentd
420+
container_name: fluentd
421+
volumes:
422+
- ./fluentd/fluent.conf:/fluentd/etc
423+
links:
424+
- "elasticsearch"
425+
ports:
426+
- "24224:24224"
427+
- "24224:24224/udp"
428+
429+
grafana-loki:
430+
image: grafana/loki:2.6.1
431+
container_name: grafana-loki
432+
ports:
433+
- "3100:3100"
434+
volumes:
435+
- ./loki-config.yaml:/etc/loki/local-config.yaml
436+
command: -config.file=/etc/loki/local-config.yaml
437+
networks:
438+
net:
439+
aliases:
440+
- grafana-loki
441+
442+
grafana-promtail:
443+
image: grafana/promtail:2.6.1
444+
container_name: grafana-promtail
445+
volumes:
446+
# - /var/log:/var/log
447+
- ./promtail-config.yaml:/etc/promtail/config.yml
448+
command: -config.file=/etc/promtail/config.yml
449+
networks:
450+
net:
451+
aliases:
452+
- grafana-promtail
453+
403454
grafana:
404455
image: grafana/grafana
405456
container_name: grafana
406457
ports:
407-
- 3000:3000
458+
- "3000:3000"
408459
environment:
409-
# - GF_AUTH_ANONYMOUS_ENABLED=true
410-
# - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
460+
- GF_AUTH_ANONYMOUS_ENABLED=true
461+
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
411462
- GF_SERVER_HTTP_PORT=3000
412-
- GF_SERVER_DOMAIN=http://localhost:3000
413-
- GF_SERVER_ROOT_URL=http://localhost:3000/admin/grafana
414-
- GF_SERVER_SERVE_FROM_SUB_PATH=true
415-
- GF_AUTH_JWT_ENABLED=true
416-
- GF_AUTH_JWT_HEADER_NAME=Authorization
417-
- GF_AUTH_JWT_USERNAME_CLAIM=sub
418-
- GF_AUTH_JWT_EMAIL_CLAIM=user_name
419-
- GF_AUTH_JWT_URL_LOGIN=http://localhost:8080/login
420-
# - GF_AUTH_JWT_JWK_SET_URL=http://localhost:8080/.well-known/jwks.json
421-
- GF_AUTH_JWT_ROLE_ATTRIBUTE_PATH=contains(authorities[*], 'ROLE_ADMIN') && 'Admin' || contains(authorities[*], 'editor') && 'Editor' || 'Viewer'
422-
- GF_AUTH_JWT_JWK_SET_FILE=/etc/grafana/jwks.json
423-
- GF_AUTH_BASIC_ENABLED=false
463+
# - GF_SERVER_DOMAIN=http://localhost:3000
464+
# - GF_SERVER_ROOT_URL=http://localhost:3000/admin/grafana
465+
# - GF_SERVER_SERVE_FROM_SUB_PATH=true
466+
# - GF_AUTH_JWT_ENABLED=true
467+
# - GF_AUTH_JWT_HEADER_NAME=Authorization
468+
# - GF_AUTH_JWT_USERNAME_CLAIM=sub
469+
# - GF_AUTH_JWT_EMAIL_CLAIM=user_name
470+
# - GF_AUTH_JWT_URL_LOGIN=http://localhost:8080/login
471+
## - GF_AUTH_JWT_JWK_SET_URL=http://localhost:8080/.well-known/jwks.json
472+
# - GF_AUTH_JWT_ROLE_ATTRIBUTE_PATH=contains(authorities[*], 'ROLE_ADMIN') && 'Admin' || contains(authorities[*], 'editor') && 'Editor' || 'Viewer'
473+
# - GF_AUTH_JWT_JWK_SET_FILE=/etc/grafana/jwks.json
474+
# - GF_AUTH_BASIC_ENABLED=false
424475
# - GF_DIAGNOSTICS_TRACING_ENABLED=true
425476
# - GF_DIAGNOSTICS_TRACING_FILE=/tmp/trace.out
426477
# - GF_AUTH_GENERIC_OAUTH_ENABLED=true
@@ -451,12 +502,32 @@ services:
451502
aliases:
452503
- setup_grafana_datasource
453504

505+
otel-collector:
506+
image: otel/opentelemetry-collector:0.47.0 #otel/opentelemetry-collector-contrib:0.60.0 #logzio/otel-collector-traces
507+
container_name: otel-collector
508+
command: [ "--config=/etc/otel-collector-config.yaml" ]
509+
volumes:
510+
- /var/log:/var/log
511+
- ./otelcol-config.yaml:/etc/otel-collector-config.yaml
512+
depends_on:
513+
- jaeger
514+
ports:
515+
- "1888:1888" # pprof extension
516+
- "13133:13133" # health_check extension
517+
- "4317:4317" # OTLP gRPC receiver
518+
- "55679:55679" # zpages extension
519+
networks:
520+
net:
521+
aliases:
522+
- otel-collector
523+
454524
jaeger:
455525
image: jaegertracing/all-in-one:latest
456526
container_name: jaeger
457527
ports:
458-
- "6831:6831/udp"
459-
- "16686:16686"
528+
- "16686:16686"
529+
- "14268"
530+
- "14250"
460531
environment:
461532
QUERY_BASE_PATH: "/admin/jaeger"
462533
networks:

docker/spring-cloud-config/application.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ management:
1010
endpoint:
1111
health:
1212
show-details: when_authorized
13+
spring:
14+
sleuth:
15+
propagation:
16+
type:
17+
- jaeger
18+
- b3
19+
otel:
20+
config:
21+
trace-id-ratio-based: 1.0
22+
exporter:
23+
otlp:
24+
endpoint: ${OTLP_ENDPOINT:http://localhost:4317}
1325

1426
logging:
1527
file: ${LOGGING_PATH:/tmp/}${spring.application.name}.log

edge-server/pom.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,34 @@
1717
</properties>
1818

1919
<dependencies>
20+
<dependency>
21+
<groupId>org.springframework.cloud</groupId>
22+
<artifactId>spring-cloud-starter-sleuth</artifactId>
23+
<exclusions>
24+
<exclusion>
25+
<groupId>org.springframework.cloud</groupId>
26+
<artifactId>spring-cloud-sleuth-brave</artifactId>
27+
</exclusion>
28+
</exclusions>
29+
</dependency>
30+
31+
<dependency>
32+
<groupId>org.springframework.cloud</groupId>
33+
<artifactId>spring-cloud-sleuth-otel-autoconfigure</artifactId>
34+
</dependency>
35+
36+
<dependency>
37+
<groupId>io.opentelemetry</groupId>
38+
<artifactId>opentelemetry-exporter-otlp-trace</artifactId>
39+
<version>1.14.0</version>
40+
</dependency>
41+
42+
<dependency>
43+
<groupId>io.opentelemetry</groupId>
44+
<artifactId>opentelemetry-exporter-otlp-common</artifactId>
45+
<version>1.14.0</version>
46+
</dependency>
47+
2048
<dependency>
2149
<groupId>com.springboot</groupId>
2250
<artifactId>authentication-common</artifactId>

go-service/posts-api/main.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ import (
2525

2626
var (
2727
e = echo.New()
28+
29+
DefaultLoggerConfig = middleware.LoggerConfig{
30+
Skipper: middleware.DefaultSkipper,
31+
Format: `{"b3":"${header:b3}","uber-trace-id":"${header:uber-trace-id}",,"time":"${time_rfc3339_nano}","id":"${id}","remote_ip":"${remote_ip}",` +
32+
`"host":"${host}","method":"${method}","uri":"${uri}","user_agent":"${user_agent}",` +
33+
`"status":${status},"error":"${error}","latency":${latency},"latency_human":"${latency_human}"` +
34+
`,"bytes_in":${bytes_in},"bytes_out":${bytes_out}}` + "\n",
35+
CustomTimeFormat: "2006-01-02 15:04:05.00000",
36+
}
2837
)
2938

3039
func healthCheck(c echo.Context) error {
@@ -172,7 +181,7 @@ func urlSkipper(c echo.Context) bool {
172181
func processRestApi(middlewareObj echo.MiddlewareFunc) {
173182
// Middleware
174183
e.Use(middleware.Recover(),
175-
middleware.Logger())
184+
middleware.LoggerWithConfig(DefaultLoggerConfig))
176185
//middleware.CSRF())
177186

178187
// Routes

go-service/posts-api/rest/rest.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,8 @@ func CreateDefaultPosts() {
133133
}
134134

135135
func GetTasksApi(c echo.Context, id string) []model.TaskDto {
136-
authorizationHeader := c.Request().Header.Get("Authorization")
137-
138136
req, err := http.NewRequest("GET", util.GetEnv("TASKS_API_URL")+"?postId="+id, nil)
139-
req.Header.Add("Authorization", authorizationHeader)
137+
req.Header = c.Request().Header
140138

141139
resp, err := httpClient.Do(req)
142140
if err != nil {
@@ -154,6 +152,7 @@ func GetTasksApi(c echo.Context, id string) []model.TaskDto {
154152
}
155153

156154
func GetAllPosts(c echo.Context) error {
155+
log.Info("Processing getAllPosts")
157156
page := 0
158157
size := 10
159158
if c := c.QueryParam("page"); c != "" {
@@ -168,6 +167,7 @@ func GetAllPosts(c echo.Context) error {
168167
searchByText = searchByText[0:strings.Index(searchByText, "&")]
169168
}
170169
log.Info(fmt.Sprintf("QueryString = %v", searchByText))
170+
171171
pageInt64 := int64(page)
172172
sizeInt64 := int64(size)
173173
ctx := context.TODO()

kotlin-service/pom.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,34 @@
2424
</properties>
2525

2626
<dependencies>
27+
<dependency>
28+
<groupId>org.springframework.cloud</groupId>
29+
<artifactId>spring-cloud-starter-sleuth</artifactId>
30+
<exclusions>
31+
<exclusion>
32+
<groupId>org.springframework.cloud</groupId>
33+
<artifactId>spring-cloud-sleuth-brave</artifactId>
34+
</exclusion>
35+
</exclusions>
36+
</dependency>
37+
38+
<dependency>
39+
<groupId>org.springframework.cloud</groupId>
40+
<artifactId>spring-cloud-sleuth-otel-autoconfigure</artifactId>
41+
</dependency>
42+
43+
<dependency>
44+
<groupId>io.opentelemetry</groupId>
45+
<artifactId>opentelemetry-exporter-otlp-trace</artifactId>
46+
<version>1.14.0</version>
47+
</dependency>
48+
49+
<dependency>
50+
<groupId>io.opentelemetry</groupId>
51+
<artifactId>opentelemetry-exporter-otlp-common</artifactId>
52+
<version>1.14.0</version>
53+
</dependency>
54+
2755
<dependency>
2856
<groupId>com.github.rodrigorodrigues</groupId>
2957
<artifactId>spring-data-commons-2.7.X</artifactId>

kotlin-service/src/main/resources/application.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
spring:
2-
application:
3-
name: kotlin-service
4-
main:
5-
allow-bean-definition-overriding: true
61
management:
72
endpoints:
83
web:

0 commit comments

Comments
 (0)