Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ TWIGPINE_P2P_BOOTSTRAP=
# Maximum git smart-HTTP pack request size, in bytes.
TWIGPINE_MAX_PACK_BYTES=2147483648

# Maximum compressed Tigris repo archive size accepted on download, in bytes.
# Independent of the pack request cap because a repository accumulated over many
# pushes can exceed one push. Default 2147483648 (2 GiB).
TWIGPINE_MAX_TIGRIS_ARCHIVE_BYTES=2147483648

# Max seconds a served git upload-pack / receive-pack (clone / push) may run
# before it is aborted with a 504. Bounds a hung git that would otherwise pin a
# worker and, on push, the repo write lock. Also bounds both info/refs
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ Important node settings:
| `TWIGPINE_AUTO_SYNC` | Enable automatic sync from known peers. |
| `TWIGPINE_RECONCILIATION_SWEEP` | Enable the hourly durability sweep that re-pins/backstops missing objects (default `true`; disabled when no IPFS/Pinata backend is configured). Public pin repair runs against any configured backend (IPFS, Pinata, or both). Encrypted recovery repair requires local IPFS (`TWIGPINE_IPFS_API`); Pinata-only nodes reconcile public pins only. |
| `TWIGPINE_MAX_PACK_BYTES` | Max git pack body size for smart-HTTP routes. |
| `TWIGPINE_MAX_TIGRIS_ARCHIVE_BYTES` | Max compressed Tigris repo archive size accepted on download, independent of the per-push pack cap. Default 2147483648 (2 GiB). |
| `TWIGPINE_MODEL_HOSTING_ENABLED` | Enable model hosting (signed releases, block storage, HF-compatible reads, independent fetch). Off by default; see [docs/MODEL-HOSTING.md](docs/MODEL-HOSTING.md) for the quota, block-store, and durability knobs. |
| `TWIGPINE_GIT_SERVICE_TIMEOUT_SECS` | Max seconds a served git upload-pack, receive-pack, or `info/refs` advertisement may run before it is aborted (504). Default 600. Also bounds the withheld-blob classification walk (on both the upload-pack serve and receive-pack replication paths) and the push-side pin-candidate discovery (`rev-list` / `cat-file`), each reaped via process-group teardown at the deadline. On the path-scoped upload-pack path the classification walk and the pack serve share ONE deadline, so this value bounds their combined duration rather than granting each stage a full budget: a walk that consumes it leaves the serve nothing and the clone gets a 504. Serving large path-scoped repos may therefore need a higher value than they did when each stage was budgeted separately. Accepted range is 1 to 3153600000 (100 years), since the node derives deadlines from this value and a larger one cannot be represented. |
| `TWIGPINE_GIT_ACQUIRE_TIMEOUT_SECS` | Max seconds the storage-acquisition phase (Tigris HEAD/GET, push advisory-lock) of a served git op may run before the request is shed with a 503, separate from the git-run timeout. The concurrency permit is released on expiry so a stalled backend cannot pin the pool. Default 30. |
Expand Down
36 changes: 36 additions & 0 deletions crates/twigpine-node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,18 @@ pub struct Config {
)]
pub tigris_bucket: String,

/// Maximum compressed Tigris repo archive size accepted on download, in bytes.
/// Independent of the per-push pack ceiling: a repository accumulated over
/// many pushes can be larger than any one push. Default: 2 GiB. `global` so
/// admin subcommands accept it wherever they accept `--tigris-bucket`.
#[arg(
long,
env = "TWIGPINE_MAX_TIGRIS_ARCHIVE_BYTES",
default_value_t = crate::git::tigris::DEFAULT_MAX_ARCHIVE_BYTES,
global = true
)]
pub max_tigris_archive_bytes: u64,

/// Maximum pack body size for git-receive-pack and git-upload-pack, in bytes.
/// Applies only to git smart-HTTP routes — all other API routes keep the 2 MB default.
/// Default: 2 GB. Set lower on resource-constrained nodes.
Expand Down Expand Up @@ -1563,6 +1575,30 @@ mod tests {
defaults.validate().unwrap();
}

#[test]
fn tigris_archive_cap_defaults_and_parses() {
assert_eq!(
Config::parse_from(["twigpine-node"]).max_tigris_archive_bytes,
crate::git::tigris::DEFAULT_MAX_ARCHIVE_BYTES
);
assert_eq!(
Config::parse_from(["twigpine-node", "--max-tigris-archive-bytes", "12345"])
.max_tigris_archive_bytes,
12_345
);
// The bucket is global for admin subcommands, so its archive ceiling is too.
assert_eq!(
Config::parse_from([
"twigpine-node",
"purge-spam",
"--max-tigris-archive-bytes",
"12345",
])
.max_tigris_archive_bytes,
12_345
);
}

#[test]
fn upstream_mirror_worker_is_default_off_and_bounded() {
let mut config = Config::parse_from(["twigpine-node"]);
Expand Down
Loading