Unify java-auth on port 8081 (internal == external)#169
Merged
Conversation
The Compose host port (8081) translated to the container's 8080, so the app, Dockerfile, k8s manifests, and client all spoke 8080 while the host and the demo script spoke 8081. That host:container split is confusing and error-prone. Move the app's actual port to 8081 everywhere: application.yml server.port, Dockerfile EXPOSE + healthcheck, Compose mapping (8081:8081) and SERVER_URL, the client's default SERVER_URL, and all k8s containerPort / targetPort / probe / SERVER_PORT references. The k8s Service port stays 80 (normal in-cluster service routing to the pod's 8081). README and scripts/test.sh already use 8081. Verified: docker compose up rebuilds clean, app binds 8081 (0.0.0.0:8081->8081), health + login + protected calls all pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
The Compose host port
8081mapped to the container's8080, so the app config, Dockerfile, k8s manifests, and Java client all spoke8080while the host mapping, README, and demo script spoke8081. A port mapping that translates (8081:8080) is confusing and easy to trip over — running./scripts/test.shagainst the wrong port fails silently.Solution
Make
8081the app's actual port everywhere, so internal == external with no translation:server/src/main/resources/application.yml—server.port: 8081server/Dockerfile—EXPOSE 8081+ healthcheck on 8081docker-compose.yml—8081:8081,SERVER_URL: http://auth-service:8081client/.../AuthClient.java— defaultSERVER_URL→localhost:8081containerPort,targetPort, liveness/readiness probes,SERVER_PORTconfigmaps → 8081The two k8s Service
port: 80entries stay as-is — that's normal in-cluster service routing to the pod's 8081, not a host/container mismatch.README.mdandscripts/test.shalready used 8081.Verified locally:
docker compose up -d --buildcomes up clean, the container binds0.0.0.0:8081->8081, and health + login + protected/api/auth/usercalls all pass.Note: MySQL is still
3307:3306(host 3307 avoids a local collision; container keeps the conventional 3306). Left as-is since 3306 is the expected MySQL port inside the container — easy to fold in if we want full symmetry.