A lightweight, configurable reverse proxy gateway built using Golang. Designed to act as an intermediary between clients and one or more origin servers or microservices, providing essential features such as rate limiting and request/response modification.
The directory structure is well-organized and follows standard Go project conventions:
└── blackprince001-patio/
├── main.go
├── provisioning/
│ └── datasources/
│ └── gateway.yaml
├── go.sum
├── internal/
│ ├── metrics/
│ │ └── metrics.go
│ ├── config/
│ │ └── config.go
│ └── middleware/
│ ├── metrics.go
│ └── ratelimiter.go
├── core/
│ ├── controllers/
│ │ └── proxy.go
│ ├── services/
│ │ └── services.go
│ └── models/
│ ├── service.go
│ └── route.go
├── .dockerignore
├── prometheus.yml
├── Dockerfile
├── go.mod
├── README.md
└── docker-compose.yml
- Go 1.22.2 or later
- Docker and Docker Compose
-
Clone the Repository:
git clone https://github.com/blackprince001/patio.git cd patio
-
Build and Run Using Docker Compose:
docker-compose up
This command will build the Docker image and start the containers defined in the
docker-compose.yml
file. -
Health Check: You can verify the health of the gateway by accessing the health check endpoint:
curl -f http://localhost:<PORT>/health
Replace
<PORT>
with the port specified in your configuration. -
Metrics: Metrics are exposed at the
/metrics
endpoint:curl http://localhost:<PORT>/metrics
-
Rate Limiting: The rate limiting is configured to allow 5 requests per second with a burst of 10. You can test this by making multiple requests to any endpoint.
Test rate limiting by making multiple requests to any endpoint.
The application configuration is read from environment variables. You can set SERVICEPATH
, PORT
, and ENV
variables to customize the setup.
Contributions are welcome. Please submit a pull request with your changes.