Files
sriphat-dataplatform/04-ingestion/uninstall-airbyte.sh
2026-03-02 21:58:51 +07:00

55 lines
1.5 KiB
Bash

#!/bin/bash
# Uninstall Airbyte
# This script completely removes the Airbyte deployment
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
echo -e "${RED}=== Airbyte Uninstall ===${NC}"
echo "This will completely remove Airbyte and all its data."
echo ""
read -p "Are you sure you want to continue? (yes/no): " -r
echo
if [[ ! $REPLY =~ ^[Yy][Ee][Ss]$ ]]; then
echo "Uninstall cancelled"
exit 0
fi
# Check if abctl is installed
if ! command -v abctl &> /dev/null; then
echo -e "${YELLOW}abctl is not installed. Skipping abctl uninstall.${NC}"
else
echo -e "${YELLOW}Uninstalling Airbyte...${NC}"
abctl local uninstall
fi
# Remove local data directories
echo -e "${YELLOW}Removing local data directories...${NC}"
if [ -d "./data" ]; then
rm -rf ./data
echo "Removed ./data"
fi
# Ask about database cleanup
echo ""
read -p "Do you want to drop Airbyte databases from PostgreSQL? (yes/no): " -r
echo
if [[ $REPLY =~ ^[Yy][Ee][Ss]$ ]]; then
echo -e "${YELLOW}Dropping databases...${NC}"
docker exec postgres psql -U postgres -c "DROP DATABASE IF EXISTS airbyte;" 2>/dev/null || true
docker exec postgres psql -U postgres -c "DROP DATABASE IF EXISTS temporal;" 2>/dev/null || true
docker exec postgres psql -U postgres -c "DROP DATABASE IF EXISTS temporal_visibility;" 2>/dev/null || true
echo -e "${GREEN}Databases dropped${NC}"
fi
echo ""
echo -e "${GREEN}Airbyte uninstall complete${NC}"