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

33
templates/watchtower/install.sh Executable file → Normal file
View File

@ -1,20 +1,25 @@
#!/bin/bash
source "$(dirname "$0")/_common.sh"
source "${AGENT_PATH}/_common.sh"
# Required environment variables
check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
# Watchtower Install Script
# Test Docker
_check_docker_installed || die "Docker test failed, aborting installation..."
# check can pull image on remote host and exit if fails
echo "Pulling image ${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}"
docker pull "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || die "Failed to pull image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"
# Load service environment variables
source ./service.env
_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
# remove and restart, as the env may have changed.
echo "Removing old container ${CONTAINER_NAME}"
_remove_container $CONTAINER_NAME || die "Failed to remove container ${CONTAINER_NAME}"
echo "Starting container ${CONTAINER_NAME}"
bash ./start.sh $1 || die "Failed to start container ${CONTAINER_NAME}"
echo "Checking Docker installation..."
_check_docker_installed || _die "Docker test failed, aborting installation..."
echo "Installation of ${CONTAINER_NAME} complete"
echo "Pulling image ${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}..."
docker pull "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || _die "Failed to pull image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"
echo "Stopping and removing any existing container..."
# No need to check failure, might not exist
_stop_container $CONTAINER_NAME
_remove_container $CONTAINER_NAME || _die "Failed to remove container ${CONTAINER_NAME}"
echo "Starting container..."
bash ./start.sh $1 || _die "Failed to start container ${CONTAINER_NAME}"
echo "Installation complete for service ${CONTAINER_NAME}."