biiig wrench

This commit is contained in:
Your Name
2025-05-03 22:58:39 +12:00
parent 107034cf7b
commit 340170b248
51 changed files with 347 additions and 395 deletions

View File

@ -1,19 +1,21 @@
#!/bin/bash
source "${AGENT_PATH}/_common.sh"
# UNINSTALL SCRIPT
# The uninstall script is required for all templates.
# It is used to uninstall the service from the server.
# It is called with the path to the server specific env file as an argument.
# Nginx Example Uninstall Script
source "$(dirname "$0")/_common.sh"
check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" "LOCAL_DATA_FOLDER"
_remove_container $CONTAINER_NAME || die "Failed to remove container ${CONTAINER_NAME}"
_is_container_running && die "Couldn't stop existing container"
_is_container_exists && die "Couldn't remove existing container"
# Load service environment variables
source ./service.env
_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" "LOCAL_DATA_FOLDER"
# remove the image
docker rmi "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || echo "Failed to remove image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"
echo "Uninstalling service ${CONTAINER_NAME}..."
_remove_container $CONTAINER_NAME || _die "Failed to remove container ${CONTAINER_NAME}"
if _is_container_running $CONTAINER_NAME; then _die "Couldn't stop existing container"; fi
if _is_container_exists $CONTAINER_NAME; then _die "Couldn't remove existing container"; fi
echo "Uninstallation of ${CONTAINER_NAME} complete."
echo "Local data folder ${LOCAL_DATA_FOLDER} still in place."
# Optional: Remove image?
# echo "Removing image ${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}..."
# docker rmi "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || echo "Warning: Failed to remove image (might be in use)"
echo "Service ${CONTAINER_NAME} uninstalled."
# Note: This does NOT remove the local data folder. Use nuke.sh for that.