Introduced a new reset.sh script to facilitate the removal of the Seafile stack and its associated data directories, with user confirmation to prevent accidental data loss. Additionally, added stack.env.portainer file containing environment variables for Seafile services, enhancing configuration management and deployment consistency.
42 lines
1.3 KiB
Bash
Executable File
42 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Script to remove Seafile stack and volumes
|
|
|
|
STACK_NAME="seafile" # Change this to your actual stack name in Portainer
|
|
|
|
echo "Removing Seafile stack..."
|
|
docker stack rm $STACK_NAME
|
|
|
|
echo "Waiting for stack to be removed..."
|
|
sleep 10
|
|
|
|
echo "Removing Docker volumes..."
|
|
docker volume rm seafile_elasticsearch_data seafile_mysql_data seafile_shared seadoc_shared 2>/dev/null || true
|
|
|
|
echo "Removing data directories..."
|
|
echo "WARNING: This will delete all Seafile data!"
|
|
read -p "Are you sure you want to delete the data directories? (yes/no): " confirm
|
|
|
|
if [ "$confirm" = "yes" ]; then
|
|
sudo rm -rf /opt/seafile-elasticsearch/data
|
|
sudo rm -rf /opt/seafile-mysql/db
|
|
sudo rm -rf /opt/seafile-data
|
|
sudo rm -rf /opt/seadoc-data
|
|
|
|
echo "Creating empty directories..."
|
|
sudo mkdir -p /opt/seafile-elasticsearch/data
|
|
sudo mkdir -p /opt/seafile-mysql/db
|
|
sudo mkdir -p /opt/seafile-data
|
|
sudo mkdir -p /opt/seadoc-data
|
|
|
|
echo "Setting permissions..."
|
|
sudo chown -R 1000:1000 /opt/seafile-elasticsearch/data
|
|
sudo chown -R 999:999 /opt/seafile-mysql/db
|
|
sudo chown -R 1000:1000 /opt/seafile-data
|
|
sudo chown -R 1000:1000 /opt/seadoc-data
|
|
|
|
echo "Done! You can now redeploy the stack with your new admin email."
|
|
else
|
|
echo "Cancelled. Data directories were not deleted."
|
|
fi
|
|
|