feat(mongo): add session store + rename colliding collections#159
Merged
coopernetes merged 1 commit intomainfrom Apr 15, 2026
Merged
feat(mongo): add session store + rename colliding collections#159coopernetes merged 1 commit intomainfrom
coopernetes merged 1 commit intomainfrom
Conversation
Adds MongoDB as a first-class session store backend and eliminates the document-shape collision with the upstream Node.js git-proxy by renaming the two colliding collections. - MongoSessionRepository: Spring Session SessionRepository backed by the raw mongo-java-driver (no spring-data-mongodb). Attributes are JDK-serialized into a BSON Binary; a TTL index on expireAt delegates idle-session cleanup to MongoDB. Wired via SessionStoreConfig under server.session-store=mongo, reusing the shared MongoClient from MongoStoreFactory so the connection pool is not duplicated. - Collection renames: users → proxy_users, pushes → proxy_pushes. The other three Mongo collections (repo_permissions, access_rules, fetch_records) already had distinct names. From 1.0.0 onward these names are part of the stability contract. - Docs: CONFIGURATION.md gains a Mongo session-store example and a new "coexisting with upstream" subsection that recommends a dedicated database while explaining that the rename makes shared-database deployments no longer a correctness hazard. - Compose overlays: add GITPROXY_SERVER_SESSION_STORE to the mongo and postgres overlays so the session store actually engages. closes #138 closes #139
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
MongoSessionRepository— a Spring SessionSessionRepositorybacked directly by the raw mongo-java-driver (nospring-data-mongodbdep). Attributes are JDK-serialized into a BSONBinary; a TTL index onexpireAtdelegates idle-session cleanup to MongoDB. Wired viaSessionStoreConfigunderserver.session-store=mongo, reusing the sharedMongoClientfromMongoStoreFactoryso the connection pool is not duplicated.users→proxy_users,pushes→proxy_pushes. The other three collections (repo_permissions,access_rules,fetch_records) already had distinct names. From 1.0.0 onward these names are part of the stability contract.CONFIGURATION.mdgains a Mongo session-store example and a new "coexisting with upstream" subsection that recommends a dedicated database while explaining the rename makes shared-database deployments no longer a correctness hazard.GITPROXY_SERVER_SESSION_STOREtodocker-compose.mongo.ymlanddocker-compose.postgres.ymlso the session store actually engages (the previousGITPROXY_SESSION_STOREwas missing theSERVER_segment and was a no-op).Closes #138
Closes #139
Test plan
./gradlew :git-proxy-java-core:test :git-proxy-java-dashboard:test— full suites pass, including the newMongoSessionRepositoryIntegrationTest(6 cases: createSession, save/load round-trip, unknown id, delete, expired-session cleanup, save-updates-existing) running against a real Mongo 7.0 Testcontainer./compose.sh ... --profile mongowithsession-store: mongo: logged in, stopped and restarted thegit-proxy-javacontainer, re-opened the dashboard and remained authenticatedproxy_sessionswith the expected shape (JDK-serialized attribute blob, 86400s default timeout,expireAtindex withexpireAfterSeconds: 0)