Skip to content

Commit a67c4c1

Browse files
committed
docs: add technical diagrams for bundle server
Add a high-level representation of the bundle server architecture, including descriptions of the major components of a bundle server. Helped-by: Derrick Stolee <[email protected]> Signed-off-by: Victoria Dye <[email protected]>
1 parent a9026f7 commit a67c4c1

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

docs/technical/architecture.md

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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 server["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+
git(["git (clone|fetch)"])
29+
30+
style server fill:#4682b477
31+
32+
remotes --> repos
33+
web --> git
34+
remotes --> git
35+
```
36+
37+
### Components
38+
39+
#### Remote host(s)
40+
41+
The Git hosts corresponding to the repositories served by the bundle server. The
42+
bundle server can contain repositories from different remotes (e.g. one from
43+
GitHub, another from GitLab), but each repository will have only one upstream
44+
remote.
45+
46+
#### Repository storage
47+
48+
A collection of Git bare repositories cloned from the corresponding remote(s),
49+
each representing a configured route on the bundle server. Repositories are
50+
cloned into local storage at the path `~/git-bundle-server/git/<route>` (e.g.
51+
`~/git-bundle/server/git/torvalds/linux` for the route `torvalds/linux`).
52+
53+
These repositories are kept up-to-date with their corresponding remote using
54+
`git-bundle-server update`, either run manually or via the system scheduler
55+
automatically started with `git-bundle-server (init|start)`. The repos are the
56+
source of the bundles generated for the "Bundle storage" of each route.
57+
58+
#### Bundle storage
59+
60+
The base and incremental bundles for each active repository on the bundle
61+
server. Bundles are created from the bundle server's cloned bare repositories
62+
(see "Repository storage") and are stored on disk at the path
63+
`~/git-bundle-server/www/<route>`, alongside a "bundle list" listing each bundle
64+
and associated metadata. These files are served to the user via the
65+
`git-bundle-web-server` API.
66+
67+
#### Route list
68+
69+
The list of _active_ routes in the bundle server (i.e., those for which bundles
70+
are being generated and can be served via the web server).
71+
72+
#### `git-bundle-web-server`
73+
74+
The `git-bundle-web-server` executable built from this repository. It can be run
75+
in the foreground directly, or started in the background with `git-bundle-server
76+
web-server start`.
77+
78+
#### `git (clone|fetch)`
79+
80+
The Git client invoked by users, CI, IDEs, etc. Only the `clone` and `fetch`
81+
commands use a bundle URI.
82+
83+
To bootstrap a repository from a given bundle URI, clone with `git clone
84+
--bundle-uri=<uri>`. This will download all bundles from the bundle server
85+
before fetching the remaining reachable objects from the origin remote.
86+
87+
When using this bundle server, `git clone --bundle-uri` will set the
88+
`fetch.bundleURI` configuration key in the repository. Using this configuration,
89+
future `git fetch` calls will also [check the bundle server for new
90+
bundles][bundle-uri-fetch] according to the `creationToken` heuristic before
91+
fetching from the origin remote.
92+
93+
[bundle-uri-fetch]: https://git-scm.com/docs/bundle-uri#_fetching_with_bundle_uris

0 commit comments

Comments
 (0)