feat: uninstall script

This commit is contained in:
Jake Turner 2025-09-30 20:00:22 -07:00 committed by Jake Turner
parent 876475e25b
commit 4ab36f331a
2 changed files with 98 additions and 0 deletions

View File

@ -79,3 +79,12 @@ sudo bash /opt/project-nomad/start_nomad.sh
```bash
sudo bash /opt/project-nomad/update_nomad.sh
```
###### Uninstall Script - Need to start fresh? Use the uninstall script to make your life easy. Note: this cannot be undone!
```bash
curl -fsSL https://raw.githubusercontent.com/Crosstalk-Solutions/project-nomad/refs/heads/master/install/uninstall_nomad.sh -o uninstall_nomad.sh
```
```bash
sudo bash uninstall_nomad.sh
```

View File

@ -0,0 +1,89 @@
#!/bin/bash
# Project N.O.M.A.D. Uninstall Script
###################################################################################################################################################################################################
# Script | Project N.O.M.A.D. Uninstall Script
# Version | 1.0.0
# Author | Crosstalk Solutions, LLC
# Website | https://crosstalksolutions.com
###################################################################################################################################################################################################
# #
# Constants & Variables #
# #
###################################################################################################################################################################################################
NOMAD_DIR="/opt/project-nomad"
MANAGEMENT_COMPOSE_FILE="${NOMAD_DIR}/docker-compose-management.yaml"
###################################################################################################################################################################################################
# #
# Functions #
# #
###################################################################################################################################################################################################
check_current_directory(){
if [ "$(pwd)" == "${NOMAD_DIR}" ]; then
echo "Please run this script from a directory other than ${NOMAD_DIR}."
exit 1
fi
}
ensure_management_compose_file_exists(){
if [ ! -f "${MANAGEMENT_COMPOSE_FILE}" ]; then
echo "Unable to find the management Docker Compose file at ${MANAGEMENT_COMPOSE_FILE}. There may be a problem with your Project N.O.M.A.D. installation."
exit 1
fi
}
get_uninstall_confirmation(){
read -p "This script will remove ALL Project N.O.M.A.D. files and containers. THIS CANNOT BE UNDONE. Are you sure you want to continue? (y/n): " choice
case "$choice" in
y|Y )
echo -e "User chose to continue with the uninstallation."
;;
n|N )
echo -e "User chose not to continue with the uninstallation."
exit 0
;;
* )
echo "Invalid Response"
echo "User chose not to continue with the uninstallation."
exit 0
;;
esac
}
ensure_docker_installed() {
if ! command -v docker &> /dev/null; then
echo "Unable to find Docker. There may be a problem with your Docker installation."
exit 1
fi
}
uninstall_nomad() {
echo "Stopping and removing Project N.O.M.A.D. containers..."
docker compose -f "${MANAGEMENT_COMPOSE_FILE}" down
echo "Allowing some time for containers to stop..."
sleep 15
echo "Containers should be stopped now."
echo "Removing Project N.O.M.A.D. files..."
rm -rf "${NOMAD_DIR}"
echo "Project N.O.M.A.D. has been uninstalled. We hope to see you again soon!"
}
###################################################################################################################################################################################################
# #
# Main #
# #
###################################################################################################################################################################################################
check_current_directory
ensure_management_compose_file_exists
ensure_docker_installed
get_uninstall_confirmation
uninstall_nomad