feat(cnode): add standalone CLI for Docker server management
- Reorganized server management code: - Moved server_cli.py -> deploy/docker/cnode_cli.py - Moved server_manager.py -> deploy/docker/server_manager.py - Created fast Python-based installation (0.1s startup): - deploy/installer/cnode_pkg/ - Standalone package - deploy/installer/install-cnode.sh - Local installer - deploy/installer/deploy.sh - Remote installer for users - Added backward compatibility: - crawl4ai/cli.py: 'crwl server' redirects to 'cnode' - Updated tests to match new CLI structure (12/12 passing) - Automated sync workflow: - .githooks/pre-commit - Auto-syncs source to package - setup-hooks.sh - One-time setup for contributors - deploy/installer/sync-cnode.sh - Manual sync script Performance: - Startup time: 0.1s (49x faster than PyInstaller) - Size: ~50KB wrapper vs 8.8MB binary Commands: cnode start [--replicas N] # Start server/cluster cnode status # Check status cnode scale N # Scale replicas cnode logs [-f] # View logs cnode stop # Stop server
This commit is contained in:
31
.githooks/pre-commit
Executable file
31
.githooks/pre-commit
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
# Pre-commit hook: Auto-sync cnode files when cnode source is modified
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Check if cnode source files are being committed
|
||||
CNODE_FILES_CHANGED=$(git diff --cached --name-only | grep -E "deploy/docker/(cnode_cli|server_manager)\.py")
|
||||
|
||||
if [ -n "$CNODE_FILES_CHANGED" ]; then
|
||||
echo -e "${YELLOW}🔄 cnode source files modified, auto-syncing to package...${NC}"
|
||||
|
||||
# Run sync script
|
||||
if [ -f "deploy/installer/sync-cnode.sh" ]; then
|
||||
bash deploy/installer/sync-cnode.sh
|
||||
|
||||
# Stage the synced files
|
||||
git add deploy/installer/cnode_pkg/cli.py
|
||||
git add deploy/installer/cnode_pkg/server_manager.py
|
||||
|
||||
echo -e "${GREEN}✅ cnode package synced and staged${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Error: sync-cnode.sh not found${NC}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user