refactor: isolate Spring Boot Actuator on dedicated internal port 8081#95
Merged
vitorhugo-java merged 2 commits intomasterfrom Apr 14, 2026
Merged
Conversation
- application.properties: add management.server.port=8081, remove prometheus token property - SecurityConfig.java: replace token-based actuator auth with permitAll() + Docker isolation comment; remove unused MessageDigest import and prometheusToken field - docker-compose.yml: update healthcheck to use port 8081; port 8081 not exposed to host - README.md: rewrite Monitoring section to document port-isolated approach; remove PROMETHEUS_SCRAPE_TOKEN from env vars Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/d4565133-0637-4f24-afc4-f9c494a06cdf Co-authored-by: vitorhugo-java <65777252+vitorhugo-java@users.noreply.github.com>
…t separation Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/d4565133-0637-4f24-afc4-f9c494a06cdf Co-authored-by: vitorhugo-java <65777252+vitorhugo-java@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
vitorhugo-java
April 14, 2026 19:32
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors monitoring by moving Spring Boot Actuator endpoints to a dedicated management port (8081) and removing token-based scrape authentication in favor of Docker network isolation (infra_network).
Changes:
- Configure Actuator to run on
management.server.port=8081and remove the Prometheus scrape token property. - Simplify
/actuator/**access rules in Spring Security by removing theX-Prometheus-Tokenheader gate. - Update Docker healthcheck and README monitoring docs to target the new management port.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/main/resources/application.properties | Sets management server port to 8081 and removes token config. |
| src/main/java/com/espacogeek/geek/config/SecurityConfig.java | Removes token-based actuator authorization and permits /actuator/**. |
| docker/docker-compose.yml | Points the container healthcheck at 8081/actuator/health. |
| README.md | Updates monitoring documentation to reflect port 8081 + network isolation approach. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+83
to
+89
| // Actuator is served exclusively on the dedicated management port 8081 | ||
| // (see management.server.port in application.properties), so this rule on | ||
| // the main port (8080) security chain is effectively a no-op. It is kept | ||
| // here for clarity: if /actuator paths ever reach this chain they are | ||
| // permitted, as security is handled via Docker network isolation | ||
| // (infra_network) rather than token-based authentication. | ||
| auth.requestMatchers("/actuator/**").permitAll(); |
| # Network-level isolation (Docker infra_network) replaces token-based auth. | ||
| management.server.port=8081 | ||
| management.endpoints.web.exposure.include=health,info,prometheus,metrics | ||
| management.endpoint.health.show-details=always |
Comment on lines
20
to
22
| healthcheck: | ||
| test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"] | ||
| test: ["CMD", "curl", "-f", "http://localhost:8081/actuator/health"] | ||
| interval: 10s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves the Spring Boot Actuator to a dedicated management port (
8081) and replaces the previous token-based (X-Prometheus-Tokenheader) authentication with Docker network-level isolation viainfra_network.Changes
src/main/resources/application.propertiesmanagement.server.port=8081— Actuator now runs on a separate port from the main API (8080).app.monitoring.prometheus-tokenproperty (token auth is no longer used).src/main/java/com/espacogeek/geek/config/SecurityConfig.javaprometheusTokenfield (@Value("${app.monitoring.prometheus-token:}")).X-Prometheus-Tokenheader matcher and the fallbackdenyAll()for/actuator/**.permitAll()for/actuator/**with a comment explaining:8081(management port), so this rule on the main chain (port8080) is a no-op.infra_networkisolation rather than token-based auth.java.security.MessageDigestimport.docker/docker-compose.ymlhttp://localhost:8080/actuator/health→http://localhost:8081/actuator/healthto match the new management port.8081is not listed inports:, confirming it is never exposed to the host machine.README.md8081, internal-only.infra_networkusingespacogeek-jvm:8081target — no auth header required.PROMETHEUS_SCRAPE_TOKENfrom the Environment Variables example block.