LibrePortal/scripts/docker/compose/update_compose_yml.sh
librelad 875a60f90f LibrePortal v0.1.0 — initial release
A free, open, self-hosted app platform (GNU AGPLv3): one-click app deploys,
Traefik reverse proxy with automatic SSL, rootless Docker support, gluetun
VPN routing, and a web dashboard to manage it all.

Free & open forever to self-host; optional paid hosted services fund it.
See PROMISE.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-21 20:37:54 +01:00

56 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
dockerComposeUpdate()
{
local app_name="$1"
local flags="$2"
local norestart="$3"
local whitelistupdates=false
if [[ $compose_setup == "default" ]]; then
local compose_file="docker-compose.yml"
elif [[ $compose_setup == "app" ]]; then
local compose_file="docker-compose.$app_name.yml"
fi
if [ "$flags" == "install" ]; then
dockerConfigSetupFileWithData $app_name;
if [[ $norestart != "norestart" ]]; then
dockerComposeRestartAfterUpdate $app_name $flags;
fi
fi
if [ "$flags" == "restart" ]; then
dockerConfigSetupFileWithData $app_name;
if [[ $norestart != "norestart" ]]; then
dockerComposeRestartAfterUpdate $app_name $flags;
fi
fi
# Fail2ban specifics
if [[ "$app_name" == "fail2ban" ]]; then
local jail_local_file="$containers_dir/$app_name/config/$app_name/jail.local"
if [ -f "$jail_local_file" ]; then
if sudo grep -q "ignoreip = ips_whitelist" "$jail_local_file"; then
# Whitelist not set up yet
if sudo grep -q "ignoreip = ips_whitelist" "$jail_local_file"; then
local result=$(sudo sed -i "s/ips_whitelist/$CFG_IPS_WHITELIST/" "$jail_local_file")
checkSuccess "Update the IP whitelist for $app_name"
local whitelistupdates=true
fi
# If the IPs are set up already but need an update
local current_ip_range=$(grep "ignoreip = " "$jail_local_file" | cut -d ' ' -f 2)
if [ "$current_ip_range" != "$CFG_IPS_WHITELIST" ]; then
local result=$(sudo sed -i "s/ignoreip = ips_whitelist/ignoreip = $CFG_IPS_WHITELIST/" "$jail_local_file")
checkSuccess "Update the IP whitelist for $app_name"
local whitelistupdates=true
fi
fi
fi
fi
}