From 41287ec0410363faa1451c2f1e1fc0fdec6d5a03 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 24 May 2025 20:43:56 +1200 Subject: [PATCH] Templates. --- caddy/destroy.sh | 9 +++++++++ caddy/nuke.sh | 11 ----------- simple-object-storage/destroy.sh | 12 ++++++++++++ simple-object-storage/nuke.sh | 12 ------------ squashkiwi/destroy.sh | 10 ++++++++++ squashkiwi/nuke.sh | 10 ---------- static-website/{nuke.sh => destroy.sh} | 7 +++---- static-website/uninstall.sh | 2 +- test_template.sh | 6 +++--- watchtower/uninstall.sh | 2 +- 10 files changed, 39 insertions(+), 42 deletions(-) create mode 100755 caddy/destroy.sh delete mode 100755 caddy/nuke.sh create mode 100755 simple-object-storage/destroy.sh delete mode 100755 simple-object-storage/nuke.sh create mode 100755 squashkiwi/destroy.sh delete mode 100755 squashkiwi/nuke.sh rename static-website/{nuke.sh => destroy.sh} (53%) diff --git a/caddy/destroy.sh b/caddy/destroy.sh new file mode 100755 index 0000000..4839b54 --- /dev/null +++ b/caddy/destroy.sh @@ -0,0 +1,9 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars + +./uninstall.sh + +datadestroy "volume=$DATA_VOLUME" "volume=$CONFIG_VOLUME" || _die "Failed to Destroy" + +echo "Destroyed ${CONTAINER_NAME}." diff --git a/caddy/nuke.sh b/caddy/nuke.sh deleted file mode 100755 index 874c8d1..0000000 --- a/caddy/nuke.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -source "${AGENT_PATH}/common.sh" -_check_required_env_vars - -# NUKE SCRIPT - -./uninstall.sh - -datanuke "volume=$DATA_VOLUME" "volume=$CONFIG_VOLUME" || _die "Failed to nuke" - -echo "Nuking of ${CONTAINER_NAME} complete." diff --git a/simple-object-storage/destroy.sh b/simple-object-storage/destroy.sh new file mode 100755 index 0000000..208d9cd --- /dev/null +++ b/simple-object-storage/destroy.sh @@ -0,0 +1,12 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars + +# Simple Object Storage Destroy Script +# Removes container AND volume. + +./uninstall.sh + +datadestroy "volume=${VOLUME_NAME}" || _die "Failed to Destroy volume ${VOLUME_NAME}" + +echo "Destroyed ${CONTAINER_NAME}." diff --git a/simple-object-storage/nuke.sh b/simple-object-storage/nuke.sh deleted file mode 100755 index 0d494d9..0000000 --- a/simple-object-storage/nuke.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -source "${AGENT_PATH}/common.sh" -_check_required_env_vars - -# Simple Object Storage Nuke Script -# Removes container AND volume. - -./uninstall.sh - -datanuke "volume=${VOLUME_NAME}" || _die "Failed to nuke volume ${VOLUME_NAME}" - -echo "Nuke complete for service ${CONTAINER_NAME}." diff --git a/squashkiwi/destroy.sh b/squashkiwi/destroy.sh new file mode 100755 index 0000000..143d69f --- /dev/null +++ b/squashkiwi/destroy.sh @@ -0,0 +1,10 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "LOCAL_DATA_FOLDER" + +./uninstall.sh + +datadestroy "path=${LOCAL_DATA_FOLDER}" || _die "Failed to destroy ${LOCAL_DATA_FOLDER}" + +echo "Drestroyed ${CONTAINER_NAME}" + diff --git a/squashkiwi/nuke.sh b/squashkiwi/nuke.sh deleted file mode 100755 index ea77805..0000000 --- a/squashkiwi/nuke.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -source "${AGENT_PATH}/common.sh" -_check_required_env_vars "LOCAL_DATA_FOLDER" - -./uninstall.sh - -datanuke "path=${LOCAL_DATA_FOLDER}" || _die "Failed to nuke ${LOCAL_DATA_FOLDER}" - -echo "Nuke of ${CONTAINER_NAME} complete" - diff --git a/static-website/nuke.sh b/static-website/destroy.sh similarity index 53% rename from static-website/nuke.sh rename to static-website/destroy.sh index 7fb2b8a..7162504 100755 --- a/static-website/nuke.sh +++ b/static-website/destroy.sh @@ -2,17 +2,16 @@ source "${AGENT_PATH}/common.sh" _check_required_env_vars "LOCAL_DATA_FOLDER" "CONTAINER_NAME" -# Nginx Example Nuke Script # Removes container and local data folder. # Call uninstall script first ./uninstall.sh -datanuke "path=${LOCAL_DATA_FOLDER}" || _die "Failed to nuke ${LOCAL_DATA_FOLDER}" +datadestroy "path=${LOCAL_DATA_FOLDER}" || _die "Failed to Destroy ${LOCAL_DATA_FOLDER}" if [ -d "${LOCAL_DATA_FOLDER}" ]; then - echo "datanuke failed to remove ${LOCAL_DATA_FOLDER}" + echo "datadestroy failed to remove ${LOCAL_DATA_FOLDER}" exit 1 fi -echo "Nuke complete for service ${CONTAINER_NAME}." +echo "Destroyed ${CONTAINER_NAME}." diff --git a/static-website/uninstall.sh b/static-website/uninstall.sh index 5391676..56fb06b 100755 --- a/static-website/uninstall.sh +++ b/static-website/uninstall.sh @@ -10,4 +10,4 @@ if _is_container_running $CONTAINER_NAME; then _die "Couldn't stop existing cont if _is_container_exists $CONTAINER_NAME; then _die "Couldn't remove existing container"; fi echo "Service ${CONTAINER_NAME} uninstalled." -echo "Note: This does NOT remove the local data folder. Use nuke.sh for that." +echo "Note: This does NOT remove the local data folder. Use destroy for that." diff --git a/test_template.sh b/test_template.sh index 29bc93f..dd29d10 100755 --- a/test_template.sh +++ b/test_template.sh @@ -55,8 +55,8 @@ title "Checking template $TEMPLATE" SERVICE_NAME="test-$TEMPLATE" -title "Nuking old service" -ds nuke localhost $SERVICE_NAME || die "Failed to nuke old service" +title "Destroying old service" +ds destroy localhost $SERVICE_NAME || die "Failed to destroy old service" title "Creating service" ds create-service localhost $SERVICE_NAME $TEMPLATE || die "Failed to create service" @@ -82,7 +82,7 @@ ds restore localhost $SERVICE_NAME latest || die "Failed to restore service" title "Checking status" ds status localhost $SERVICE_NAME || die "Failed to check status" -title "Nuking service" +title "Nuking service (alias for destroy)" ds nuke localhost $SERVICE_NAME || die "Failed to nuke service" title "Listing services" diff --git a/watchtower/uninstall.sh b/watchtower/uninstall.sh index 0d50a3c..d4647ba 100755 --- a/watchtower/uninstall.sh +++ b/watchtower/uninstall.sh @@ -9,5 +9,5 @@ _remove_container $CONTAINER_NAME || _die "Failed to remove container ${CONTAINE echo "Service ${CONTAINER_NAME} uninstalled." -# Note: Watchtower doesn't typically have volumes to nuke. +# Note: Watchtower doesn't have volumes to destroy.