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

ops: added a check for docker-compose version in Nomad utility scripts

Jake Turner6934e8b4d1d8
diff --git a/install/install_nomad.sh b/install/install_nomad.sh
index 4a15d76f..62e79bc8 100644
--- a/install/install_nomad.sh
+++ b/install/install_nomad.sh
@@ -199,6 +199,16 @@ ensure_docker_installed() {
fi
}
+check_docker_compose() {
+ # Check if 'docker compose' (v2 plugin) is available
+ if ! docker compose version &>/dev/null; then
+ echo -e "${RED}#${RESET} Docker Compose v2 is not installed or not available as a Docker plugin."
+ echo -e "${YELLOW}#${RESET} This script requires 'docker compose' (v2), not 'docker-compose' (v1)."
+ echo -e "${YELLOW}#${RESET} Please read the Docker documentation at https://docs.docker.com/compose/install/ for instructions on how to install Docker Compose v2."
+ exit 1
+ fi
+}
+
setup_nvidia_container_toolkit() {
# This function attempts to set up NVIDIA GPU support but is non-blocking
# Any failures will result in warnings but will NOT stop the installation process
@@ -550,6 +560,7 @@ check_is_debug_mode
get_install_confirmation
accept_terms
ensure_docker_installed
+check_docker_compose
setup_nvidia_container_toolkit
get_local_ip
create_nomad_directory
diff --git a/install/uninstall_nomad.sh b/install/uninstall_nomad.sh
index 1ddf1066..be48931a 100644
--- a/install/uninstall_nomad.sh
+++ b/install/uninstall_nomad.sh
@@ -75,6 +75,16 @@ ensure_docker_installed() {
fi
}
+check_docker_compose() {
+ # Check if 'docker compose' (v2 plugin) is available
+ if ! docker compose version &>/dev/null; then
+ echo -e "${RED}#${RESET} Docker Compose v2 is not installed or not available as a Docker plugin."
+ echo -e "${YELLOW}#${RESET} This script requires 'docker compose' (v2), not 'docker-compose' (v1)."
+ echo -e "${YELLOW}#${RESET} Please read the Docker documentation at https://docs.docker.com/compose/install/ for instructions on how to install Docker Compose v2."
+ exit 1
+ fi
+}
+
storage_cleanup() {
read -p "Do you want to delete the Project N.O.M.A.D. storage directory (${NOMAD_DIR})? This is best if you want to start a completely fresh install. This will PERMANENTLY DELETE all stored Nomad data and can't be undone! (y/N): " delete_dir_choice
case "$delete_dir_choice" in
@@ -130,5 +140,6 @@ check_has_sudo
check_current_directory
ensure_management_compose_file_exists
ensure_docker_installed
+check_docker_compose
get_uninstall_confirmation
uninstall_nomad
\ No newline at end of file
diff --git a/install/update_nomad.sh b/install/update_nomad.sh
index d7be2d54..4e355287 100644
--- a/install/update_nomad.sh
+++ b/install/update_nomad.sh
@@ -94,6 +94,16 @@ ensure_docker_installed_and_running() {
fi
}
+check_docker_compose() {
+ # Check if 'docker compose' (v2 plugin) is available
+ if ! docker compose version &>/dev/null; then
+ echo -e "${RED}#${RESET} Docker Compose v2 is not installed or not available as a Docker plugin."
+ echo -e "${YELLOW}#${RESET} This script requires 'docker compose' (v2), not 'docker-compose' (v1)."
+ echo -e "${YELLOW}#${RESET} Please read the Docker documentation at https://docs.docker.com/compose/install/ for instructions on how to install Docker Compose v2."
+ exit 1
+ fi
+}
+
ensure_docker_compose_file_exists() {
if [ ! -f "/opt/project-nomad/compose.yml" ]; then
echo -e "${RED}#${RESET} compose.yml file not found. Please ensure it exists at /opt/project-nomad/compose.yml."
@@ -145,6 +155,7 @@ check_has_sudo
# Main update
get_update_confirmation
ensure_docker_installed_and_running
+check_docker_compose
ensure_docker_compose_file_exists
force_recreate
get_local_ip