|
| 1 | +# Bundle Server Architecture |
| 2 | + |
| 3 | +This document contains information about the architecture of the bundle server |
| 4 | +and how it is used with Git's [bundle-uri feature][bundle-uris]. |
| 5 | + |
| 6 | +[bundle-uris]: https://git-scm.com/docs/bundle-uri |
| 7 | + |
| 8 | +## High-level design |
| 9 | + |
| 10 | +The following diagram shows the relationship between the Git remote, Git client, |
| 11 | +and the bundle server with respect to typical end-user usage. |
| 12 | + |
| 13 | +```mermaid |
| 14 | +graph TB |
| 15 | + remotes[("Remote host(s)\n(GitHub, Bitbucket, GitLab, Codeberg, etc.)")] |
| 16 | + subgraph "Bundle Server" |
| 17 | + direction LR |
| 18 | +
|
| 19 | + repos[[Repository storage]] |
| 20 | + bundles[[Bundle storage]] |
| 21 | + routes[Route list] |
| 22 | + web([git-bundle-web-server]) |
| 23 | +
|
| 24 | + repos -. "git-bundle-server update" .-> bundles |
| 25 | + routes --> web |
| 26 | + bundles --> web |
| 27 | + end |
| 28 | +
|
| 29 | + git(["git (clone|fetch)"]) |
| 30 | +
|
| 31 | + remotes --> repos |
| 32 | + web --> git |
| 33 | + remotes --> git |
| 34 | +``` |
| 35 | + |
| 36 | +### Components |
| 37 | +#### Remote host(s) |
| 38 | + |
| 39 | +The Git hosts corresponding to the repositories served by the bundle server. The |
| 40 | +bundle server can contain repositories from different remotes (e.g. one from |
| 41 | +GitHub, another from GitLab), but each repository will have only one upstream |
| 42 | +remote. |
| 43 | + |
| 44 | +#### Repository storage |
| 45 | + |
| 46 | +A collection of Git bare repositories cloned from the corresponding remote(s), |
| 47 | +each representing a configured route on the bundle server. Repositories are |
| 48 | +cloned into local storage at the path `~/git-bundle-server/git/<route>` (e.g. |
| 49 | +`~/git-bundle/server/git/torvalds/linux` for the route `torvalds/linux`). |
| 50 | + |
| 51 | +These repositories are kept up-to-date with their corresponding remote using |
| 52 | +`git-bundle-server update`, and are the source of the bundles generated for the |
| 53 | +"Bundle storage" of each repo. |
| 54 | + |
| 55 | +#### Bundle storage |
| 56 | + |
| 57 | +The base and incremental bundles for each active repository on the bundle |
| 58 | +server. Bundles are created from the bundle server's cloned bare repositories |
| 59 | +(see "Repository storage") and are stored on disk at the path |
| 60 | +`~/git-bundle-server/www/<route>`, alongside a "bundle list" listing each bundle |
| 61 | +and associated metadata. These files are served to the user via the |
| 62 | +`git-bundle-web-server` API. |
| 63 | + |
| 64 | +#### Route list |
| 65 | + |
| 66 | +The list of _active_ routes in the bundle server (i.e., those for which bundles |
| 67 | +are being generated and can be served via the web server). |
| 68 | + |
| 69 | +#### `git-bundle-web-server` |
| 70 | + |
| 71 | +The `git-bundle-web-server` executable built from this repository. It can be run |
| 72 | +in the foreground directly, or started in the background with `git-bundle-server |
| 73 | +web-server start`. |
| 74 | + |
| 75 | +#### `git (clone|fetch)` |
| 76 | + |
| 77 | +The Git client invoked by users, CI, IDEs, etc. Only the `clone` and `fetch` |
| 78 | +commands utilize a configured bundle URI to download from the bundle server: the |
| 79 | +former using the `--bundle-uri` option to download all existing bundles for a |
| 80 | +repository and configured future fetches, the latter to [fetch new |
| 81 | +bundles][bundle-uri-fetch] according to the `creationToken` heuristic. |
| 82 | + |
| 83 | +[bundle-uri-fetch]: https://git-scm.com/docs/bundle-uri#_fetching_with_bundle_uris |
0 commit comments