mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-04-05 08:16:16 +02:00
feat(Scripts): uninstall now removes non-management app containers
This commit is contained in:
parent
4da08a8312
commit
a4297aba36
|
|
@ -24,6 +24,18 @@ MANAGEMENT_COMPOSE_FILE="${NOMAD_DIR}/docker-compose-management.yaml"
|
||||||
# #
|
# #
|
||||||
###################################################################################################################################################################################################
|
###################################################################################################################################################################################################
|
||||||
|
|
||||||
|
check_has_sudo() {
|
||||||
|
if sudo -n true 2>/dev/null; then
|
||||||
|
echo -e "${GREEN}#${RESET} User has sudo permissions.\\n"
|
||||||
|
else
|
||||||
|
echo "User does not have sudo permissions"
|
||||||
|
header_red
|
||||||
|
echo -e "${RED}#${RESET} This script requires sudo permissions to run. Please run the script with sudo.\\n"
|
||||||
|
echo -e "${RED}#${RESET} For example: sudo bash $(basename "$0")"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
check_current_directory(){
|
check_current_directory(){
|
||||||
if [ "$(pwd)" == "${NOMAD_DIR}" ]; then
|
if [ "$(pwd)" == "${NOMAD_DIR}" ]; then
|
||||||
echo "Please run this script from a directory other than ${NOMAD_DIR}."
|
echo "Please run this script from a directory other than ${NOMAD_DIR}."
|
||||||
|
|
@ -64,11 +76,18 @@ ensure_docker_installed() {
|
||||||
}
|
}
|
||||||
|
|
||||||
uninstall_nomad() {
|
uninstall_nomad() {
|
||||||
echo "Stopping and removing Project N.O.M.A.D. containers..."
|
echo "Stopping and removing Project N.O.M.A.D. management containers..."
|
||||||
docker compose -f "${MANAGEMENT_COMPOSE_FILE}" down
|
docker compose -f "${MANAGEMENT_COMPOSE_FILE}" down
|
||||||
|
echo "Allowing some time for management containers to stop..."
|
||||||
|
sleep 5
|
||||||
|
|
||||||
echo "Allowing some time for containers to stop..."
|
|
||||||
sleep 15
|
# Stop and remove all containers where name starts with "nomad_"
|
||||||
|
echo "Stopping and removing all Project N.O.M.A.D. app containers..."
|
||||||
|
docker ps -a --filter "name=^nomad_" --format "{{.Names}}" | xargs -r docker rm -f
|
||||||
|
echo "Allowing some time for app containers to stop..."
|
||||||
|
sleep 5
|
||||||
|
|
||||||
echo "Containers should be stopped now."
|
echo "Containers should be stopped now."
|
||||||
|
|
||||||
echo "Removing Project N.O.M.A.D. files..."
|
echo "Removing Project N.O.M.A.D. files..."
|
||||||
|
|
@ -82,6 +101,7 @@ uninstall_nomad() {
|
||||||
# Main #
|
# Main #
|
||||||
# #
|
# #
|
||||||
###################################################################################################################################################################################################
|
###################################################################################################################################################################################################
|
||||||
|
check_has_sudo
|
||||||
check_current_directory
|
check_current_directory
|
||||||
ensure_management_compose_file_exists
|
ensure_management_compose_file_exists
|
||||||
ensure_docker_installed
|
ensure_docker_installed
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user