mirror of
https://github.com/bitwarden/self-host.git
synced 2026-03-03 02:17:01 +00:00
Remove Certbot cleanup functions and logic (#457)
This commit is contained in:
20
run.ps1
20
run.ps1
@@ -70,8 +70,6 @@ function Install() {
|
||||
"certonly{0} --standalone --noninteractive --agree-tos --preferred-challenges http " + `
|
||||
"--email ${email} -d ${domain} --logs-dir /etc/letsencrypt/logs"
|
||||
Invoke-Expression ($certbotExp -f $qFlag)
|
||||
|
||||
Cleanup-Certbot
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,8 +152,6 @@ function Update-Lets-Encrypt {
|
||||
"-v ${outputDir}/letsencrypt:/etc/letsencrypt/ certbot/certbot " + `
|
||||
"renew{0} --logs-dir /etc/letsencrypt/logs" -f $qFlag
|
||||
Invoke-Expression $certbotExp
|
||||
|
||||
Cleanup-Certbot
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,8 +162,6 @@ function Force-Update-Lets-Encrypt {
|
||||
"-v ${outputDir}/letsencrypt:/etc/letsencrypt/ certbot/certbot " + `
|
||||
"renew{0} --logs-dir /etc/letsencrypt/logs --force-renew" -f $qFlag
|
||||
Invoke-Expression $certbotExp
|
||||
|
||||
Cleanup-Certbot
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,8 +221,6 @@ function Uninstall() {
|
||||
if ($purgeAction -eq "y") {
|
||||
Docker-Prune
|
||||
}
|
||||
|
||||
Cleanup-Certbot
|
||||
}
|
||||
|
||||
function Print-Environment {
|
||||
@@ -264,18 +256,6 @@ function Write-Line($str) {
|
||||
}
|
||||
}
|
||||
|
||||
function Cleanup-Certbot {
|
||||
# Check if the certbot image is being used by any containers
|
||||
if ([string]::IsNullOrEmpty((docker ps -a --filter ancestor=certbot/certbot --quiet))) {
|
||||
Write-Host "(!) " -f red -nonewline
|
||||
$response = $( Read-Host "The [certbot/certbot] container image used by this script is no longer associated with any containers. Would you like to purge it? (y/N)" )
|
||||
|
||||
if ($response.ToLower() -eq 'y') {
|
||||
docker image rm certbot/certbot
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Commands
|
||||
|
||||
if ($install) {
|
||||
|
||||
23
run.sh
23
run.sh
@@ -90,8 +90,6 @@ function install() {
|
||||
docker run -it --rm --name certbot -p 80:80 -v $OUTPUT_DIR/letsencrypt:/etc/letsencrypt/ certbot/certbot \
|
||||
certonly --standalone --noninteractive --agree-tos --preferred-challenges http \
|
||||
--email $EMAIL -d $DOMAIN --logs-dir /etc/letsencrypt/logs
|
||||
|
||||
certbotCleanup
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -176,8 +174,6 @@ function updateLetsEncrypt() {
|
||||
docker run -i --rm --name certbot -p 443:443 -p 80:80 \
|
||||
-v $OUTPUT_DIR/letsencrypt:/etc/letsencrypt/ certbot/certbot \
|
||||
renew --logs-dir /etc/letsencrypt/logs
|
||||
|
||||
certbotCleanup
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -188,8 +184,6 @@ function forceUpdateLetsEncrypt() {
|
||||
docker run -i --rm --name certbot -p 443:443 -p 80:80 \
|
||||
-v $OUTPUT_DIR/letsencrypt:/etc/letsencrypt/ certbot/certbot \
|
||||
renew --logs-dir /etc/letsencrypt/logs --force-renew
|
||||
|
||||
certbotCleanup
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -287,8 +281,6 @@ function uninstall() {
|
||||
dockerPrune
|
||||
echo -e -n "${CYAN}Bitwarden uninstall complete! ${NC}"
|
||||
fi
|
||||
|
||||
certbotCleanup
|
||||
}
|
||||
|
||||
function printEnvironment() {
|
||||
@@ -318,21 +310,6 @@ function pullSetup() {
|
||||
docker pull ghcr.io/bitwarden/setup:$COREVERSION
|
||||
}
|
||||
|
||||
function certbotCleanup() {
|
||||
# Check if the certbot image is being used by any containers
|
||||
if [[ -z $(docker ps -a --filter ancestor=certbot/certbot --quiet) ]]
|
||||
then
|
||||
echo -e -n "${RED}(!) The [certbot/certbot] container image used by this script is no longer associated with any containers. Would you like to purge it? (y/N): ${NC}"
|
||||
read RESPONSE
|
||||
RESPONSE=$(echo "$RESPONSE" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
if [[ $RESPONSE == 'y' ]]
|
||||
then
|
||||
docker image rm certbot/certbot
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Commands
|
||||
|
||||
case $1 in
|
||||
|
||||
Reference in New Issue
Block a user