Sweep of every containers/<app>/<app>.sh after the install-side fix that went into config_file_setup_data.sh — these were the same class of bug: bare `sudo sed -i` / `sudo docker exec` calls left over from when the manager carried NOPASSWD:ALL. After the rootless+de-sudo hardening (Model A, sudoers scoped to LP_HELPERS + LP_SYSTEM only) those calls fail at runtime, so every per-app routine that uses one would refuse on install or in its post-install tweak step. Each call routes through the existing `runFileOp` shim, which picks the right path per CFG_DOCKER_INSTALL_TYPE (dockerinstall in rootless, manager in rootful) — same pattern setup_dns.sh / authelia.sh / config_file_setup_data.sh already use. Fixed: gitea.sh:65 — sync GITEA_METRICS_TOKEN into prometheus-scrape.yml owncloud.sh:88 — fill OWNCLOUD_SETUP_* in the setup-webform html searxng.sh:87 — flip simple_style: auto → CFG_SEARXNG_THEME trilium.sh:89 — rewrite trilium-data/config.ini port= bookstack.sh:139 — bookstack:create-admin via `docker exec` bookstack.sh:148 — admin@admin.com cleanup via `docker exec ... tinker` `bash -n` clean on every touched file. Untested live (none of these apps are installed on the verify VM) but mechanically equivalent to the already-validated config_file_setup_data.sh fix. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
140 lines
4.1 KiB
Bash
Executable File
140 lines
4.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Category : Development & Version Control
|
|
# Description : Gitea - Git Repository Management (c/u/s/r/i):
|
|
|
|
installGitea()
|
|
{
|
|
local config_variables="$1"
|
|
|
|
if [[ "$gitea" == *[cCtTuUsSrRiI]* ]]; then
|
|
dockerConfigSetupToContainer silent gitea;
|
|
local app_name=$CFG_GITEA_APP_NAME
|
|
initializeAppVariables $app_name;
|
|
fi
|
|
|
|
if [[ "$gitea" == *[cC]* ]]; then
|
|
editAppConfig $app_name;
|
|
fi
|
|
|
|
if [[ "$gitea" == *[uU]* ]]; then
|
|
dockerUninstallApp $app_name;
|
|
fi
|
|
|
|
if [[ "$gitea" == *[sS]* ]]; then
|
|
dockerComposeDown $app_name;
|
|
fi
|
|
|
|
if [[ "$gitea" == *[rR]* ]]; then
|
|
dockerComposeRestart $app_name;
|
|
fi
|
|
|
|
if [[ "$gitea" == *[iI]* ]]; then
|
|
isHeader "Install $app_name"
|
|
|
|
((menu_number++))
|
|
echo ""
|
|
echo "---- $menu_number. Setting up install folder and config file for $app_name."
|
|
echo ""
|
|
|
|
dockerConfigSetupToContainer "loud" "$app_name" "install" "$config_variables";
|
|
isSuccessful "Install folders and Config files have been setup for $app_name."
|
|
|
|
((menu_number++))
|
|
echo ""
|
|
|
|
|
|
((menu_number++))
|
|
echo ""
|
|
echo "---- $menu_number. Setting up the $app_name docker-compose.yml file."
|
|
echo ""
|
|
|
|
dockerComposeSetupFile $app_name;
|
|
|
|
# Enable Gitea's /metrics endpoint only when CFG_GITEA_MONITORING=true
|
|
# (toggles the libreportal-monitoring marker block in the compose).
|
|
monitoringToggleAppConfig "$app_name" "docker-compose.yml";
|
|
|
|
# /metrics rides Gitea's public web port, so it's locked behind a
|
|
# bearer token. CFG_GITEA_METRICS_TOKEN lives in the .config (filled
|
|
# once by the RANDOMIZEDPASSWORD scanner, preserved across reinstalls)
|
|
# and reaches the compose via the GITEA_METRICS_TOKEN_TAG tag — mirror
|
|
# that same value into the Prometheus scrape fragment so the two agree.
|
|
if monitoringAppEnabled "$app_name"; then
|
|
if [[ -n "$CFG_GITEA_METRICS_TOKEN" ]]; then
|
|
local result=$(runFileOp sed -i "s|GITEA_METRICS_TOKEN_PLACEHOLDER|${CFG_GITEA_METRICS_TOKEN}|g" \
|
|
"$containers_dir$app_name/resources/monitoring/prometheus-scrape.yml")
|
|
checkSuccess "Synced Gitea /metrics token to the Prometheus scrape config"
|
|
else
|
|
isNotice "CFG_GITEA_METRICS_TOKEN is empty — Gitea /metrics scrape may 401."
|
|
fi
|
|
fi
|
|
|
|
((menu_number++))
|
|
echo ""
|
|
echo "---- $menu_number. Updating file permissions before starting."
|
|
echo ""
|
|
|
|
fixPermissionsBeforeStart $app_name;
|
|
|
|
((menu_number++))
|
|
echo ""
|
|
echo "---- $menu_number. Running the docker-compose.yml to install and start $app_name"
|
|
echo ""
|
|
|
|
dockerComposeUpdateAndStartApp $app_name install;
|
|
|
|
((menu_number++))
|
|
echo ""
|
|
echo "---- $menu_number. Running Application specific updates (if required)"
|
|
echo ""
|
|
|
|
appUpdateSpecifics $app_name;
|
|
|
|
((menu_number++))
|
|
echo ""
|
|
echo "---- $menu_number. Running Headscale setup (if required)"
|
|
echo ""
|
|
|
|
setupHeadscale $app_name;
|
|
|
|
((menu_number++))
|
|
echo ""
|
|
echo "---- $menu_number. Adding $app_name to the Apps Database table."
|
|
echo ""
|
|
|
|
databaseInstallApp $app_name;
|
|
|
|
((menu_number++))
|
|
echo ""
|
|
echo "---- $menu_number. Updating WebUI config file."
|
|
echo ""
|
|
|
|
webuiContainerSetup $app_name install;
|
|
|
|
((menu_number++))
|
|
echo ""
|
|
echo "---- $menu_number. Refreshing monitoring integration."
|
|
echo ""
|
|
|
|
# Self-correcting: adds Gitea's scrape target + dashboard to
|
|
# Prometheus/Grafana when CFG_GITEA_MONITORING=true, removes them when
|
|
# it's off. No-ops with a notice if either app isn't installed.
|
|
monitoringRefreshAll;
|
|
|
|
((menu_number++))
|
|
echo ""
|
|
echo "---- $menu_number. You can find $app_name files at $containers_dir$app_name"
|
|
echo ""
|
|
echo " You can now navigate to your $app_name service using one of the options below : "
|
|
echo ""
|
|
|
|
menuShowFinalMessages $app_name;
|
|
|
|
menu_number=0
|
|
#sleep 3s
|
|
cd
|
|
fi
|
|
gitea=n
|
|
}
|