2024-11-04 06:00:28 +01:00
|
|
|
# Goma Gateway - simple lightweight API Gateway Management.
|
2024-10-27 06:10:27 +01:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
_____
|
|
|
|
|
/ ____|
|
|
|
|
|
| | __ ___ _ __ ___ __ _
|
|
|
|
|
| | |_ |/ _ \| '_ ` _ \ / _` |
|
|
|
|
|
| |__| | (_) | | | | | | (_| |
|
|
|
|
|
\_____|\___/|_| |_| |_|\__,_|
|
|
|
|
|
|
|
|
|
|
```
|
2024-11-04 06:00:28 +01:00
|
|
|
Goma Gateway is a lightweight API Gateway Management.
|
2024-10-27 06:10:27 +01:00
|
|
|
|
2024-10-27 07:24:50 +01:00
|
|
|
[](https://github.com/jkaninda/goma-gateway/actions/workflows/release.yml)
|
2024-10-29 09:39:31 +01:00
|
|
|
[](https://goreportcard.com/report/github.com/jkaninda/goma-gateway)
|
2024-10-27 06:10:27 +01:00
|
|
|
[](https://pkg.go.dev/github.com/jkaninda/goma-gateway)
|
|
|
|
|

|
|
|
|
|
|
2024-11-02 13:58:01 +01:00
|
|
|
<img src="https://raw.githubusercontent.com/jkaninda/goma-gateway/main/logo.png" width="150" alt="Goma logo">
|
2024-11-02 13:45:17 +01:00
|
|
|
|
2024-11-04 06:00:28 +01:00
|
|
|
----
|
2024-11-02 21:19:35 +01:00
|
|
|
|
|
|
|
|
Architecture:
|
|
|
|
|
|
2024-11-02 21:20:45 +01:00
|
|
|
<img src="https://raw.githubusercontent.com/jkaninda/goma-gateway/main/goma-gateway.png" width="912" alt="Goma archi">
|
2024-11-02 21:19:35 +01:00
|
|
|
|
|
|
|
|
|
2024-10-27 06:10:27 +01:00
|
|
|
## Links:
|
|
|
|
|
|
|
|
|
|
- [Docker Hub](https://hub.docker.com/r/jkaninda/goma-gateway)
|
|
|
|
|
- [Github](https://github.com/jkaninda/goma-gateway)
|
|
|
|
|
|
2024-11-02 12:54:12 +01:00
|
|
|
### Documentation is found at <https://jkaninda.github.io/goma-gateway>
|
2024-11-02 12:39:31 +01:00
|
|
|
### Features
|
|
|
|
|
|
2024-11-08 22:58:09 +01:00
|
|
|
It's designed to be straightforward and efficient, offering features, like:
|
2024-11-02 12:39:31 +01:00
|
|
|
|
|
|
|
|
- RESTFull API Gateway management
|
|
|
|
|
- Domain/host based request routing
|
|
|
|
|
- Multi domain request routing
|
2024-11-04 05:36:52 +01:00
|
|
|
- Reverse Proxy
|
|
|
|
|
- Websocket Proxy
|
2024-11-02 12:39:31 +01:00
|
|
|
- Cross-Origin Resource Sharing (CORS)
|
2024-11-04 05:35:57 +01:00
|
|
|
- Custom Headers
|
|
|
|
|
- Backend Errors interceptor
|
2024-11-09 15:18:43 +01:00
|
|
|
- Logging
|
2024-11-10 17:47:05 +01:00
|
|
|
- Metrics
|
2024-11-10 21:28:40 +01:00
|
|
|
- Load Balancing, round-robin algorithm
|
2024-11-07 00:00:58 +01:00
|
|
|
- Support TLS
|
2024-11-08 19:34:28 +01:00
|
|
|
- Block common exploits middleware
|
|
|
|
|
- Patterns to detect SQL injection attempts
|
|
|
|
|
- Pattern to detect simple XSS attempts
|
2024-11-02 12:39:31 +01:00
|
|
|
- Authentication middleware
|
|
|
|
|
- JWT `client authorization based on the result of a request`
|
|
|
|
|
- Basic-Auth
|
2024-11-08 19:34:28 +01:00
|
|
|
- OAuth
|
2024-11-10 20:19:46 +01:00
|
|
|
- Rate limiting, In-Memory client IP based
|
2024-11-08 22:58:09 +01:00
|
|
|
- Limit HTTP methods allowed for a particular route.
|
2024-11-14 15:18:39 +01:00
|
|
|
- Distributed rate limiting, client IP based using Redis
|
2024-11-02 12:39:31 +01:00
|
|
|
|
|
|
|
|
### Todo:
|
2024-11-09 15:18:43 +01:00
|
|
|
- [ ] Blocklist IP address middleware
|
2024-10-27 06:10:27 +01:00
|
|
|
|
2024-11-04 06:00:28 +01:00
|
|
|
----
|
2024-11-03 04:01:18 +01:00
|
|
|
|
2024-10-27 06:10:27 +01:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
### 1. Initialize configuration
|
|
|
|
|
|
2024-11-08 19:39:38 +01:00
|
|
|
You can generate the configuration file using `config init --output /etc/goma/config.yml` command.
|
2024-11-04 07:48:03 +01:00
|
|
|
|
2024-11-08 19:39:38 +01:00
|
|
|
The default configuration is automatically generated if any configuration file is not provided, and is available at `/etc/goma/goma.yml`
|
2024-11-04 07:37:47 +01:00
|
|
|
|
2024-10-27 06:10:27 +01:00
|
|
|
```shell
|
|
|
|
|
docker run --rm --name goma-gateway \
|
2024-11-08 19:34:28 +01:00
|
|
|
-v "${PWD}/config:/etc/goma/" \
|
|
|
|
|
jkaninda/goma-gateway config init --output /etc/goma/goma.yml
|
2024-10-27 06:10:27 +01:00
|
|
|
```
|
2024-11-10 21:34:52 +01:00
|
|
|
## 2. Check configuration
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
docker run --rm --name goma-gateway \
|
|
|
|
|
-v "${PWD}/config:/etc/goma/" \
|
|
|
|
|
-p 8080:8080 \
|
|
|
|
|
jkaninda/goma-gateway config check --config /etc/goma/config.yml
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 3. Run server
|
2024-10-27 06:10:27 +01:00
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
docker run --rm --name goma-gateway \
|
2024-11-08 19:34:28 +01:00
|
|
|
-v "${PWD}/config:/etc/goma/" \
|
|
|
|
|
-p 8080:8080 \
|
2024-10-27 06:10:27 +01:00
|
|
|
jkaninda/goma-gateway server
|
|
|
|
|
```
|
|
|
|
|
|
2024-11-10 21:34:52 +01:00
|
|
|
### 4. Start server with a custom config
|
2024-10-27 06:10:27 +01:00
|
|
|
```shell
|
|
|
|
|
docker run --rm --name goma-gateway \
|
2024-11-08 19:34:28 +01:00
|
|
|
-v "${PWD}/config:/etc/goma/" \
|
|
|
|
|
-p 8080:8080 \
|
|
|
|
|
-p 8443:8443 \
|
|
|
|
|
jkaninda/goma-gateway server --config /etc/goma/config.yml
|
2024-10-27 06:10:27 +01:00
|
|
|
```
|
|
|
|
|
### 4. Healthcheck
|
|
|
|
|
|
2024-11-05 20:11:24 +01:00
|
|
|
- Goma Gateway health check: `/health/live`
|
2024-11-10 21:34:52 +01:00
|
|
|
- Routes health check: `/health/routes`
|
|
|
|
|
|
2024-10-27 07:24:50 +01:00
|
|
|
|
2024-11-04 06:00:28 +01:00
|
|
|
### 5. Simple deployment in docker compose file
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
services:
|
|
|
|
|
goma-gateway:
|
|
|
|
|
image: jkaninda/goma-gateway
|
|
|
|
|
command: server
|
|
|
|
|
ports:
|
2024-11-08 19:34:28 +01:00
|
|
|
- "8080:8080"
|
2024-11-04 06:00:28 +01:00
|
|
|
volumes:
|
2024-11-08 19:34:28 +01:00
|
|
|
- ./config:/etc/goma/
|
2024-11-04 06:00:28 +01:00
|
|
|
```
|
|
|
|
|
|
2024-11-09 04:52:05 +01:00
|
|
|
## Supported Systems
|
2024-10-27 06:10:27 +01:00
|
|
|
|
2024-11-09 04:52:05 +01:00
|
|
|
- [x] Linux
|
|
|
|
|
- [x] MacOS
|
|
|
|
|
- [x] Windows
|
|
|
|
|
|
2024-11-10 18:33:44 +01:00
|
|
|
Please download the binary from the [release page](https://github.com/jkaninda/goma-gateway/releases).
|
2024-11-10 21:30:54 +01:00
|
|
|
|
2024-11-10 20:19:46 +01:00
|
|
|
Init configs:
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
./goma config init --output config.yml
|
|
|
|
|
```
|
2024-11-10 18:33:44 +01:00
|
|
|
|
|
|
|
|
To run
|
|
|
|
|
```shell
|
|
|
|
|
./goma server --config config.yml
|
|
|
|
|
```
|
|
|
|
|
|
2024-11-10 20:19:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-09 04:52:05 +01:00
|
|
|
## Deployment
|
2024-10-27 06:10:27 +01:00
|
|
|
|
|
|
|
|
- Docker
|
2024-11-09 04:52:05 +01:00
|
|
|
- Kubernetes
|
2024-11-04 07:37:47 +01:00
|
|
|
|
|
|
|
|
## Contributing
|
|
|
|
|
|
|
|
|
|
The Goma Gateway project welcomes all contributors. We appreciate your help!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Give a Star! ⭐
|
|
|
|
|
|
|
|
|
|
If you like or are using Goma Gateway, please give it a star. Thanks!
|
|
|
|
|
|
2024-11-09 04:52:05 +01:00
|
|
|
Please share.
|
|
|
|
|
|
2024-11-04 07:37:47 +01:00
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
|
|
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Copyright
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2024 Jonas Kaninda
|