Skip to content

Project NOMAD is an offline-first knowledge and education server. Wikipedia, thousands of books, courses, maps, and optional local AI, all running on hardware you own with no internet required.

TypeScript

feat: uninstall script

Jake Turner4ab36f331a82
diff --git a/README.md b/README.md
index ec674896..72ddcfbf 100644
--- a/README.md
+++ b/README.md
@@ -78,4 +78,13 @@ sudo bash /opt/project-nomad/start_nomad.sh
###### Update Script - Attempts to pull the latest images for the Command Center and its dependencies (i.e. mysql) and recreate the containers. Note: this *only* updates the Command Center containers. It does not update the installable application containers - that should be done through the Command Center UI
```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
```
\ No newline at end of file
diff --git a/install/uninstall_nomad.sh b/install/uninstall_nomad.sh
new file mode 100644
index 00000000..6ff50b0f
--- /dev/null
+++ b/install/uninstall_nomad.sh
@@ -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
\ No newline at end of file