Remove deployment success documentation for ScriptShare application on DigitalOcean, streamlining project files and eliminating outdated information.
This commit is contained in:
130
scripts/manage.sh
Normal file
130
scripts/manage.sh
Normal file
@ -0,0 +1,130 @@
|
||||
#!/bin/bash
|
||||
# ScriptShare Management Script
|
||||
|
||||
set -e
|
||||
|
||||
COMPOSE_FILE="docker-compose.prod.yml"
|
||||
|
||||
show_help() {
|
||||
echo "ScriptShare Management Script"
|
||||
echo ""
|
||||
echo "Usage: $0 [COMMAND]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " start Start all services"
|
||||
echo " stop Stop all services"
|
||||
echo " restart Restart all services"
|
||||
echo " logs Show logs for all services"
|
||||
echo " logs [svc] Show logs for specific service"
|
||||
echo " status Show status of all services"
|
||||
echo " backup Create database backup"
|
||||
echo " restore Restore database from backup"
|
||||
echo " update Update application (pull, build, restart)"
|
||||
echo " clean Clean up unused Docker resources"
|
||||
echo " shell [svc] Open shell in service container"
|
||||
echo " db Connect to database"
|
||||
echo " help Show this help message"
|
||||
echo ""
|
||||
echo "Services: scriptshare-db, scriptshare-api, scriptshare-frontend, scriptshare-proxy, scriptshare-redis"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "🚀 Starting ScriptShare services..."
|
||||
docker-compose -f "$COMPOSE_FILE" up -d
|
||||
echo "✅ Services started"
|
||||
;;
|
||||
|
||||
stop)
|
||||
echo "🛑 Stopping ScriptShare services..."
|
||||
docker-compose -f "$COMPOSE_FILE" down
|
||||
echo "✅ Services stopped"
|
||||
;;
|
||||
|
||||
restart)
|
||||
echo "🔄 Restarting ScriptShare services..."
|
||||
docker-compose -f "$COMPOSE_FILE" restart
|
||||
echo "✅ Services restarted"
|
||||
;;
|
||||
|
||||
logs)
|
||||
if [ -n "$2" ]; then
|
||||
echo "📋 Showing logs for $2..."
|
||||
docker-compose -f "$COMPOSE_FILE" logs -f "$2"
|
||||
else
|
||||
echo "📋 Showing logs for all services..."
|
||||
docker-compose -f "$COMPOSE_FILE" logs -f
|
||||
fi
|
||||
;;
|
||||
|
||||
status)
|
||||
echo "📊 Service Status:"
|
||||
docker-compose -f "$COMPOSE_FILE" ps
|
||||
echo ""
|
||||
echo "🏥 Health Status:"
|
||||
for service in scriptshare-db scriptshare-api scriptshare-frontend scriptshare-proxy; do
|
||||
health=$(docker inspect --format='{{.State.Health.Status}}' "$service" 2>/dev/null || echo "not found")
|
||||
echo " $service: $health"
|
||||
done
|
||||
;;
|
||||
|
||||
backup)
|
||||
echo "🗄️ Creating database backup..."
|
||||
./scripts/backup.sh
|
||||
;;
|
||||
|
||||
restore)
|
||||
if [ -z "$2" ]; then
|
||||
echo "❌ Please specify backup file to restore"
|
||||
echo "Usage: $0 restore <backup-file>"
|
||||
exit 1
|
||||
fi
|
||||
echo "🔄 Restoring database from $2..."
|
||||
# Implementation for restore would go here
|
||||
echo "⚠️ Restore functionality not yet implemented"
|
||||
;;
|
||||
|
||||
update)
|
||||
echo "🔄 Updating ScriptShare application..."
|
||||
docker-compose -f "$COMPOSE_FILE" pull
|
||||
docker-compose -f "$COMPOSE_FILE" build --no-cache
|
||||
docker-compose -f "$COMPOSE_FILE" up -d
|
||||
echo "✅ Application updated"
|
||||
;;
|
||||
|
||||
clean)
|
||||
echo "🧹 Cleaning up Docker resources..."
|
||||
docker system prune -f
|
||||
docker volume prune -f
|
||||
echo "✅ Cleanup completed"
|
||||
;;
|
||||
|
||||
shell)
|
||||
if [ -z "$2" ]; then
|
||||
echo "❌ Please specify service name"
|
||||
echo "Available services: scriptshare-db, scriptshare-api, scriptshare-frontend, scriptshare-proxy"
|
||||
exit 1
|
||||
fi
|
||||
echo "💻 Opening shell in $2..."
|
||||
docker-compose -f "$COMPOSE_FILE" exec "$2" /bin/sh
|
||||
;;
|
||||
|
||||
db)
|
||||
echo "🗃️ Connecting to database..."
|
||||
if [ -f ".env" ]; then
|
||||
source .env
|
||||
fi
|
||||
docker-compose -f "$COMPOSE_FILE" exec scriptshare-db mysql -u "${DB_USER:-scriptshare_user}" -p"${DB_PASSWORD:-ScriptShare_App_2024_Secure!}" "${DB_NAME:-scriptshare}"
|
||||
;;
|
||||
|
||||
help|--help|-h)
|
||||
show_help
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "❌ Unknown command: $1"
|
||||
echo ""
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
Reference in New Issue
Block a user