Skip to content

Commit

Permalink
Add OpenAPI UI and JSON description of the API
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-yuxuan committed Sep 27, 2023
1 parent 8cee82f commit 633c493
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mvn spring-boot:start
mvn spring-boot:stop
```

Observability root path: http://localhost:8080/actuator.
# Docker dependency services

Clean local Docker environments:

Expand All @@ -31,13 +31,18 @@ docker compose up
docker compose up --force-recreate --renew-anon-volumes
```

See [docker-compose.yml](./docker-compose.yml) for all services.

# Observability

We use Spring Boot actuator to gather several metrics. It is exposed here: http://localhost:8080/actuator.

Now on your machine different services are available:

- Swagger UI: http://localhost:3001
- Grafana: http://localhost:3000
- Prometheus: http://localhost:9090

See [docker-compose.yml](./docker-compose.yml) for all services.

Grafana dashboards:
- https://grafana.com/grafana/dashboards/6756-spring-boot-statistics/
- Ideally there would be a standard dashboard for endpoints and another for database connections.
Expand Down
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ services:
- ./src/main/resources/static/monitoring/dashboard.json:/etc/dashboards/spring-boot-grafana-dashboard.json:rw
ports:
- 3000:3000

swagger-ui:
image: swaggerapi/swagger-ui:latest
ports:
- "3001:8080"
environment:
URL: http://localhost:8080/api-docs
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>

<build>
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
management.endpoints.web.exposure.include=*
management.endpoints.web.exposure.include=*
springdoc.api-docs.path=/api-docs

0 comments on commit 633c493

Please sign in to comment.