ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Add app cleanup and database migration commands
Juan Denis81179411d68a
diff --git a/docs/DEPLOYMENT.md b/docs/DEPLOYMENT.mdindex ca232ae3..cd3d949b 100644--- a/docs/DEPLOYMENT.md+++ b/docs/DEPLOYMENT.md@@ -82,6 +82,9 @@ serverkit activate-user# Initialize databaseserverkit init-db+# Apply database migrations (after updates)+serverkit migrate-db+# Backup databaseserverkit backup-db# Creates: backup/serverkit-YYYYMMDD-HHMMSS.db@@ -90,6 +93,25 @@ serverkit backup-dbserverkit restore-db backup/serverkit-20240115-120000.db```+### App & Cleanup Commands++```bash+# List all installed applications+serverkit list-apps++# Delete all apps, containers, and folders+serverkit cleanup-apps++# Also delete Docker volumes+serverkit cleanup-apps --delete-volumes++# Keep database records (only delete containers/folders)+serverkit cleanup-apps --keep-db++# Complete factory reset (delete everything and start fresh)+serverkit factory-reset+```+### Utility Commands```bashdiff --git a/serverkit b/serverkitindex 64baa003..449dd8cc 100644--- a/serverkit+++ b/serverkit@@ -166,9 +166,14 @@ cmd_help() {echo ""echo "Database Commands:"echo " init-db Initialize the database"+ echo " migrate-db Apply database migrations"echo " backup-db Backup the database"echo " restore-db Restore database from backup"echo ""+ echo "Cleanup Commands:"+ echo " cleanup-apps Delete all apps and containers"+ echo " factory-reset Complete reset (delete everything)"+ echo ""echo "App Management:"echo " create-app Show how to create apps (via web UI)"echo " list-apps List all deployed apps"@@ -491,6 +496,44 @@ cmd_init_db() {run_cli init-db}+cmd_migrate_db() {+ check_installed+ run_cli migrate-db+}++cmd_cleanup_apps() {+ check_root+ check_installed++ DELETE_VOLUMES=""+ KEEP_DB=""++ # Parse arguments+ while [[ $# -gt 0 ]]; do+ case $1 in+ --delete-volumes|-v)+ DELETE_VOLUMES="--delete-volumes"+ shift+ ;;+ --keep-db|-k)+ KEEP_DB="--keep-db"+ shift+ ;;+ *)+ shift+ ;;+ esac+ done++ run_cli cleanup-apps $DELETE_VOLUMES $KEEP_DB+}++cmd_factory_reset() {+ check_root+ check_installed+ run_cli factory-reset+}+cmd_backup_db() {check_installedBACKUP_DIR="$INSTALL_DIR/backups"@@ -600,39 +643,8 @@ cmd_create_app() {}cmd_list_apps() {- print_header- echo ""- echo "Deployed Applications:"- echo "─────────────────────────────────────────"-- if [ -d /var/www ]; then- for app_dir in /var/www/*/; do- if [ -f "$app_dir/docker-compose.yml" ]; then- APP_NAME=$(basename "$app_dir")-- # Get port from .env- if [ -f "$app_dir/.env" ]; then- PORT=$(grep "^PORT=" "$app_dir/.env" | cut -d= -f2)- else- PORT="?"- fi-- # Check if running- if docker compose -f "$app_dir/docker-compose.yml" ps 2>/dev/null | grep -q "running"; then- STATUS="${GREEN}●${NC} running"- else- STATUS="${RED}○${NC} stopped"- fi-- printf " %b %-20s port %-6s %s\n" "$STATUS" "$APP_NAME" "$PORT" "$app_dir"- fi- done- else- echo " No apps found in /var/www/"- fi- echo ""- echo "Install new apps via the Templates page in the ServerKit web interface."- echo ""+ check_installed+ run_cli list-apps}cmd_start_app() {@@ -875,6 +887,16 @@ case "${1:-help}" ininit-db)cmd_init_db;;+ migrate-db)+ cmd_migrate_db+ ;;+ cleanup-apps)+ shift+ cmd_cleanup_apps "$@"+ ;;+ factory-reset)+ cmd_factory_reset+ ;;backup-db)cmd_backup_db;;