Skip to content

Commit 4ab36f3

Browse files
committed
feat: uninstall script
1 parent 876475e commit 4ab36f3

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,13 @@ sudo bash /opt/project-nomad/start_nomad.sh
7878
###### 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
7979
```bash
8080
sudo bash /opt/project-nomad/update_nomad.sh
81+
```
82+
83+
###### Uninstall Script - Need to start fresh? Use the uninstall script to make your life easy. Note: this cannot be undone!
84+
```bash
85+
curl -fsSL https://raw.githubusercontent.com/Crosstalk-Solutions/project-nomad/refs/heads/master/install/uninstall_nomad.sh -o uninstall_nomad.sh
86+
```
87+
88+
```bash
89+
sudo bash uninstall_nomad.sh
8190
```

install/uninstall_nomad.sh

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/bin/bash
2+
3+
# Project N.O.M.A.D. Uninstall Script
4+
5+
###################################################################################################################################################################################################
6+
7+
# Script | Project N.O.M.A.D. Uninstall Script
8+
# Version | 1.0.0
9+
# Author | Crosstalk Solutions, LLC
10+
# Website | https://crosstalksolutions.com
11+
12+
###################################################################################################################################################################################################
13+
# #
14+
# Constants & Variables #
15+
# #
16+
###################################################################################################################################################################################################
17+
18+
NOMAD_DIR="/opt/project-nomad"
19+
MANAGEMENT_COMPOSE_FILE="${NOMAD_DIR}/docker-compose-management.yaml"
20+
21+
###################################################################################################################################################################################################
22+
# #
23+
# Functions #
24+
# #
25+
###################################################################################################################################################################################################
26+
27+
check_current_directory(){
28+
if [ "$(pwd)" == "${NOMAD_DIR}" ]; then
29+
echo "Please run this script from a directory other than ${NOMAD_DIR}."
30+
exit 1
31+
fi
32+
}
33+
34+
ensure_management_compose_file_exists(){
35+
if [ ! -f "${MANAGEMENT_COMPOSE_FILE}" ]; then
36+
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."
37+
exit 1
38+
fi
39+
}
40+
41+
get_uninstall_confirmation(){
42+
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
43+
case "$choice" in
44+
y|Y )
45+
echo -e "User chose to continue with the uninstallation."
46+
;;
47+
n|N )
48+
echo -e "User chose not to continue with the uninstallation."
49+
exit 0
50+
;;
51+
* )
52+
echo "Invalid Response"
53+
echo "User chose not to continue with the uninstallation."
54+
exit 0
55+
;;
56+
esac
57+
}
58+
59+
ensure_docker_installed() {
60+
if ! command -v docker &> /dev/null; then
61+
echo "Unable to find Docker. There may be a problem with your Docker installation."
62+
exit 1
63+
fi
64+
}
65+
66+
uninstall_nomad() {
67+
echo "Stopping and removing Project N.O.M.A.D. containers..."
68+
docker compose -f "${MANAGEMENT_COMPOSE_FILE}" down
69+
70+
echo "Allowing some time for containers to stop..."
71+
sleep 15
72+
echo "Containers should be stopped now."
73+
74+
echo "Removing Project N.O.M.A.D. files..."
75+
rm -rf "${NOMAD_DIR}"
76+
77+
echo "Project N.O.M.A.D. has been uninstalled. We hope to see you again soon!"
78+
}
79+
80+
###################################################################################################################################################################################################
81+
# #
82+
# Main #
83+
# #
84+
###################################################################################################################################################################################################
85+
check_current_directory
86+
ensure_management_compose_file_exists
87+
ensure_docker_installed
88+
get_uninstall_confirmation
89+
uninstall_nomad

0 commit comments

Comments
 (0)