Skip to content

Commit b397894

Browse files
committed
software: tune git_cdn runtime envs (cache size, workers, depth, bundle)
Pass the proven git_cdn env vars on container run: - PACK_CACHE_SIZE_GB=500 and GUNICORN_WORKER=12 (exposed as module options; workers otherwise defaults to host cpu_count()) - PACK_CACHE_DEPTH=true to cache shallow clones - CDN_BUNDLE_URL="" to disable the upstream Android/AOSP clone-bundle default, irrelevant for a GitHub proxy Verified every name/value against git_cdn source.
1 parent 5e1b6ef commit b397894

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

tools/modules/software/module_git_cdn.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ module_options+=(
1212
["module_git_cdn,dockerimage"]="ghcr.io/armbian/git_cdn:latest"
1313
["module_git_cdn,dockername"]="git_cdn"
1414
["module_git_cdn,upstream"]="https://github.com/"
15+
["module_git_cdn,cache_size_gb"]="500"
16+
["module_git_cdn,workers"]="12"
1517
)
1618
#
1719
# Module git_cdn — git+http(s) caching proxy / CDN (Groupe Renault)
@@ -22,6 +24,8 @@ function module_git_cdn () {
2224
local dockername="${module_options["module_git_cdn,dockername"]}"
2325
local port="${module_options["module_git_cdn,port"]}"
2426
local upstream="${module_options["module_git_cdn,upstream"]}"
27+
local cache_size_gb="${module_options["module_git_cdn,cache_size_gb"]}"
28+
local workers="${module_options["module_git_cdn,workers"]}"
2529

2630
local commands
2731
IFS=' ' read -r -a commands <<< "${module_options["module_git_cdn,example"]}"
@@ -47,6 +51,10 @@ function module_git_cdn () {
4751
--publish "${port}:8000" \
4852
--env GITSERVER_UPSTREAM="$upstream" \
4953
--env WORKING_DIRECTORY="/git-data" \
54+
--env GUNICORN_WORKER="$workers" \
55+
--env PACK_CACHE_SIZE_GB="$cache_size_gb" \
56+
--env PACK_CACHE_DEPTH="true" \
57+
--env CDN_BUNDLE_URL="" \
5058
--volume "${base_dir}/cache:/git-data" \
5159
"$dockerimage"; then
5260
echo -e "\nFailed to start ${dockername} (${dockerimage})\n" >&2
@@ -80,7 +88,7 @@ function module_git_cdn () {
8088
;;
8189
"${commands[4]}") # help
8290
show_module_help "module_git_cdn" "$title" \
83-
"Caching git+http(s) proxy / CDN that mirrors one upstream git server near your CI workers, reducing WAN usage on repeated clones.\n\nUpstream: ${upstream}\nProxy port: ${port}\nDocker Image: ${dockerimage}\nCache directory: ${base_dir}/cache\n\nClient configuration — on each git host:\n git config --global url.\"http://<server>:${port}/\".insteadOf ${upstream}\n\nThen clone normally:\n git clone ${upstream}<owner>/<repo>.git"
91+
"Caching git+http(s) proxy / CDN that mirrors one upstream git server near your CI workers, reducing WAN usage on repeated clones.\n\nUpstream: ${upstream}\nProxy port: ${port}\nDocker Image: ${dockerimage}\nCache directory: ${base_dir}/cache\nPack cache size: ${cache_size_gb} GB\nWorkers: ${workers}\n\nClient configuration — on each git host:\n git config --global url.\"http://<server>:${port}/\".insteadOf ${upstream}\n\nThen clone normally:\n git clone ${upstream}<owner>/<repo>.git"
8492
;;
8593
*)
8694
${module_options["module_git_cdn,feature"]} ${commands[4]}

0 commit comments

Comments
 (0)