Skip to content

Microservices gateway generator #58

@mathieusouflis

Description

@mathieusouflis

Problem statement

A microservices project needs a gateway that routes requests to the correct service. Setting up nginx, Kong, or Traefik as a gateway with the right routing rules is complex and must be done consistently with dot's Patch model.

Proposed solution

Implement MicroservicesGatewayGenerator in generators/common/microservices_gateway.go.

  • Name(): "common-microservices-gateway"
  • Language(): "*"
  • Modules(): ["microservices-gateway"]

Apply() generates based on spec.Config.GatewayType:

  • nginx: gateway/nginx.conf with upstream + location blocks for initial services
  • Kong: gateway/kong.yml (declarative) with service and route definitions
  • Traefik: gateway/traefik.yml + gateway/dynamic/routes.yml
  • docker-compose.yml entry for the gateway service

Defines a new anchor AnchorGatewayRoute per gateway type for use by dot add service.

Alternatives considered

See gateway linking decision. Static config patch chosen over service discovery and env-driven.

Area

Core

Additional context

Depends on: Microservices init flow decision, Microservices gateway linking decision.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions