Skip to content

Commit

Permalink
feat: prometheus grafana
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Jun 29, 2024
1 parent 85b4709 commit 58cd6be
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# rpkm67-auth
# rpkm67-gateway

## Stack

Expand Down Expand Up @@ -30,13 +30,21 @@

### Running all RPKM67 services (all other services are run as containers)
1. Copy `docker-compose.qa.template.yml` and paste it in the same directory as `docker-compose.qa.yml`. Fill in the appropriate values.
2. Run `make pull-latest-mac` or `make pull-latest-windows` to pull the latest images of other services.
1. Run `make docker-qa`.
2. Run `make server` or `air` for hot-reload.
2. In `microservices/auth` folder, copy `staff.template.json` and paste it in the same directory as `staff.json`. It is the staffs' student id list (given `staff` roles instead of `user`).
3. Run `make pull-latest-mac` or `make pull-latest-windows` to pull the latest images of other services.
4. Run `make docker-qa`.
5. Run `make server` or `air` for hot-reload.

### Unit Testing
1. Run `make test`

## API
When run locally, the gateway url will be available at `localhost:3001`.
- Swagger UI: `localhost:3001/api/v1/docs/index.html#/`
- Grafana: `localhost:3006` (username: admin, password: 1234)
- Prometheus: `localhost:9090`
- Gateway's metrics endpoint: `localhost:3001/metrics`

## Other microservices/repositories of RPKM67
- [gateway](https://github.com/isd-sgcu/rpkm67-gateway): Routing and request handling
- [auth](https://github.com/isd-sgcu/rpkm67-auth): Authentication and user service
Expand Down
26 changes: 26 additions & 0 deletions docker-compose.qa.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,32 @@ services:
ports:
- "6379:6379"

prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: unless-stopped
networks:
- rpkm67
volumes:
- ./microservices/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"

grafana:
image: grafana/grafana:latest
container_name: grafana
restart: unless-stopped
depends_on:
- prometheus
environment:
- GF_SECURITY_ADMIN_PASSWORD=1234
networks:
- rpkm67
volumes:
- ./volumes/grafana:/var/lib/grafana
ports:
- "3006:3000"

networks:
rpkm67:
name: rpkm67
9 changes: 9 additions & 0 deletions microservices/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
global:
scrape_interval: 15s
evaluation_interval: 15s

scrape_configs:
- job_name: gateway-api
static_configs:
- targets: ['host.docker.internal:3001']
metrics_path: '/api/v1/metrics'

0 comments on commit 58cd6be

Please sign in to comment.