Update documantation & scripts.
This commit is contained in:
35
remove.sh
35
remove.sh
@@ -31,7 +31,8 @@ remove_containers() {
|
||||
}
|
||||
|
||||
remove_images() {
|
||||
local images=$(sudo docker images -q --filter=reference="registry.callabacloud.com/*/*:*")
|
||||
OLD_STACK_VERSION=$(cat STACK_VERSION.txt)
|
||||
local images=$(sudo docker images -q --filter=reference="registry.callabacloud.com/*/*:$OLD_STACK_VERSION")
|
||||
|
||||
if [[ -n "$images" ]]; then
|
||||
if sudo docker rmi -f $images; then
|
||||
@@ -70,8 +71,8 @@ prune_network() {
|
||||
}
|
||||
|
||||
delete_rules() {
|
||||
local ports=(3000 3021 3031 27017)
|
||||
|
||||
local ports=(3000 3021 3031 27017, 27019, 6379)
|
||||
sudo chmod 600 /etc/iptables/rules.v4
|
||||
for port in ${ports[@]}; do
|
||||
if sudo iptables -D INPUT -p tcp --dport $port -j DROP; then
|
||||
echo "Rule for port $port deleted successfully"
|
||||
@@ -80,7 +81,7 @@ delete_rules() {
|
||||
fi
|
||||
done
|
||||
|
||||
if sudo iptables-save > /etc/iptables/rules.v4; then
|
||||
if sudo iptables-legacy-save >/etc/iptables/rules.v4 ; then
|
||||
echo "Iptables rules saved successfully"
|
||||
else
|
||||
echo "Error: Unable to save iptables rules" >&2
|
||||
@@ -88,11 +89,23 @@ delete_rules() {
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Uninstalling Callaba Cloud has been started. Please don't stop this process. It may take about 2 minutes."
|
||||
echo "Uninstalling... It may take some time."
|
||||
|
||||
stop_containers
|
||||
remove_containers
|
||||
remove_images
|
||||
remove_volumes
|
||||
prune_network
|
||||
delete_rules
|
||||
main() {
|
||||
echo "Are you sure you want to remove Callaba $STACK_VERSION ? (y/yes to confirm)"
|
||||
read -r confirmation
|
||||
if [[ "$confirmation" == "y" || "$confirmation" == "yes" ]]; then
|
||||
echo "Uninstalling... It may take some time."
|
||||
rm -f STACK_VERSION.txt
|
||||
stop_containers
|
||||
remove_containers
|
||||
remove_images
|
||||
remove_volumes
|
||||
prune_network
|
||||
delete_rules
|
||||
else
|
||||
echo "Operation cancelled."
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
Reference in New Issue
Block a user