feat(Tracer Bullet)
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
FROM openjdk:17-jre-slim
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the gateway JAR file
|
||||
COPY infrastructure/gateway/build/libs/*.jar app.jar
|
||||
|
||||
# Expose port
|
||||
EXPOSE 8080
|
||||
|
||||
# Add health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=30s --retries=3 \
|
||||
CMD curl -f http://localhost:8080/actuator/health || exit 1
|
||||
|
||||
# Run the application
|
||||
ENTRYPOINT ["java", "-jar", "app.jar"]
|
||||
@@ -6,7 +6,18 @@ server:
|
||||
spring:
|
||||
application:
|
||||
name: api-gateway
|
||||
security:
|
||||
user:
|
||||
name: admin
|
||||
password: admin
|
||||
cloud:
|
||||
consul:
|
||||
host: localhost
|
||||
port: 8500
|
||||
discovery:
|
||||
register: true
|
||||
health-check-path: /actuator/health
|
||||
health-check-interval: 10s
|
||||
gateway:
|
||||
# HTTP Client-Timeouts für stabile Upstream-Verbindungen
|
||||
httpclient:
|
||||
@@ -22,9 +33,17 @@ spring:
|
||||
# Antwort-Header bereinigen (verhindert doppelte CORS-Header)
|
||||
default-filters:
|
||||
- DedupeResponseHeader=Access-Control-Allow-Credentials Access-Control-Allow-Origin
|
||||
# Aktiviert die automatische Routen-Erstellung basierend auf Consul
|
||||
discovery:
|
||||
locator:
|
||||
enabled: true
|
||||
# Macht Routen-Namen klein (z.B. /members-service/** statt /MEMBERS-SERVICE/**)
|
||||
lower-case-service-id: true
|
||||
# Route definitions with service discovery
|
||||
routes:
|
||||
- id: ping-service-route
|
||||
uri: lb://ping-service
|
||||
predicates:
|
||||
- Path=/api/ping/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info
|
||||
|
||||
+3
-1
@@ -71,7 +71,9 @@ class GatewayApplicationTests {
|
||||
class TestRoutes {
|
||||
@Bean
|
||||
fun routeLocator(builder: RouteLocatorBuilder): RouteLocator = builder.routes()
|
||||
.route("test-forward") { r -> r.path("/hello").uri("forward:/internal/hello") }
|
||||
.route("test-forward") {
|
||||
it.path("/hello").uri("forward:/internal/hello")
|
||||
}
|
||||
.build()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user