Clients and interfaces
Enroute has two callers, Git clients and your application, and it calls one back: your application's hook endpoint.
Git client -- Git smart HTTP --> Enroute <-- gRPC -- application
|
+-- signed HTTP hooks --> application
| Interface | Caller | Use | Exposure |
|---|---|---|---|
listen.git | Git clients | Clone, fetch, and push over Git smart HTTP | Public, behind TLS |
listen.api | Your application | Create repositories, read Git data, and move refs over gRPC | Private: it authenticates nobody |
| Hook endpoint | Enroute | Ask your application for identity and policy decisions | Reachable from the compute nodes |
One feature, three interfaces
A typical feature uses all three. Take a merge request in a code-hosting application:
- A developer pushes a branch over Git. Enroute calls
authorizeto learn who they are, andpre_receiveto check that they may push to it. After the push,post_receivetells your application which branch moved, and your application prints a link to open a merge request. - A reviewer opens the merge request page. Your application calls the API:
FindMergeBasesfor the commit where the branch started,DiffCommitfor the changed files, andGetObjectfor their contents. It renders the page itself. Enroute serves no HTML. - The reviewer merges. Your application calls
UpdateRefsto move the target branch, guarded by the commit that the reviewer saw. No hook runs, because your application is the caller.
Your application never parses the Git protocol, holds a connection open for a
clone, or runs git. Enroute never decides who a user is or what they may do.
The Merge requests pattern builds this
feature in full.
Which interface to use
| To | Use |
|---|---|
| Let a developer or CI clone and push | Git, on listen.git |
| Show files, history, and diffs in your product | The API: ListTree, ListCommits, DiffCommit, GetObject |
| Commit a change from your product, such as an edit in a browser | The API: CreateCommit |
| Merge, or move a branch on a user's behalf | The API: UpdateRefs |
| Decide who may read or push, and what may land | Hooks: authorize, visible_refs, pre_receive |
| Start work after a push, such as CI | Hooks: post_receive |
| Copy refs to or from another Git server | The API: PushToRemote, FetchFromRemote |
The trust boundary
The Git listener is public, and authorize is its only access control. The
API listener trusts every caller: any client that can reach it can read,
write, and delete every repository. Keep it reachable only by your application.
Hooks are signed, so your application can tell that a request came from
Enroute. See Security.
For the RPCs, see the API contract. For the hooks, see Hooks.
Generated from docs/concepts/two-callers.md at 11fd62b