Files
goplt/config/default.yaml
0x1d b02c1d44c8 fix(consul): Fix health checks for gRPC services in Docker
- Add gRPC health check support to Consul registry
  - Services are gRPC-only, not HTTP
  - Consul was trying HTTP health checks which failed
  - Now uses gRPC health checks via grpc.health.v1.Health service

- Update HealthCheckConfig to support both HTTP and gRPC
  - Add GRPC field for gRPC service name
  - Add UseGRPC flag to choose health check type
  - Default to gRPC for services (use_grpc: true in config)

- Fix service address registration in Docker
  - Services now register with Docker service name (e.g., auth-service)
  - Allows Consul to reach services via Docker network DNS
  - Falls back to localhost for local development

- Update default.yaml to enable gRPC health checks
  - Set use_grpc: true
  - Set grpc: grpc.health.v1.Health

This fixes services being deregistered from Consul due to failed
HTTP health checks. Services will now pass gRPC health checks.
2025-11-06 21:17:33 +01:00

73 lines
1.4 KiB
YAML

environment: development
server:
port: 8080
host: "0.0.0.0"
read_timeout: 30s
write_timeout: 30s
database:
driver: "postgres"
dsn: "postgres://goplt:goplt_password@localhost:5432/goplt?sslmode=disable"
max_connections: 25
max_idle_connections: 5
conn_max_lifetime: 5m
conn_max_idle_time: 10m
logging:
level: "info"
format: "json"
output: "stdout"
tracing:
enabled: true
service_name: "platform"
service_version: "1.0.0"
otlp_endpoint: ""
registry:
type: consul
consul:
address: "localhost:8500"
datacenter: "dc1"
scheme: "http"
health_check:
interval: "10s"
timeout: "3s"
deregister_after: "30s"
http: "/healthz"
grpc: "grpc.health.v1.Health"
use_grpc: true
services:
audit:
port: 8084
host: "localhost"
auth:
port: 8081
host: "localhost"
identity:
port: 8082
host: "localhost"
authz:
port: 8083
host: "localhost"
auth:
jwt_secret: "change-this-secret-in-production"
gateway:
port: 8080
host: "0.0.0.0"
routes:
- path: "/api/v1/auth/**"
service: "auth-service"
auth_required: false
- path: "/api/v1/users/**"
service: "identity-service"
auth_required: true
cors:
allowed_origins: ["*"]
allowed_methods: ["GET", "POST", "PUT", "DELETE", "PATCH"]
allowed_headers: ["Authorization", "Content-Type"]