refactor(installer): rename deploy.sh to install-cnode.sh for consistency
- Renamed deploy.sh -> install-cnode.sh (clearer name) - Updated all references in README.md - Single consistent naming: install-cnode.sh everywhere
This commit is contained in:
@@ -21,7 +21,7 @@ deploy/installer/
|
||||
│ ├── server_manager.py # Docker orchestration logic
|
||||
│ └── requirements.txt # Python dependencies
|
||||
├── install-cnode.sh # Local installation script
|
||||
├── deploy.sh # Remote installation script (for users)
|
||||
├── install-cnode.sh # Remote installation script (for users)
|
||||
└── releases/ # Release artifacts for distribution
|
||||
```
|
||||
|
||||
@@ -189,21 +189,21 @@ cnode start --help
|
||||
```
|
||||
|
||||
4. **Update deployment script** (if needed):
|
||||
- Update `deploy.sh` with new version/URL
|
||||
- Update `install-cnode.sh` with new version/URL
|
||||
- Upload to hosting (e.g., `https://crawl4ai.com/install-cnode.sh`)
|
||||
|
||||
## Deployment
|
||||
|
||||
### Remote Installation Script
|
||||
|
||||
The `deploy.sh` script is meant to be hosted at a public URL for user installation:
|
||||
The `install-cnode.sh` script is meant to be hosted at a public URL for user installation:
|
||||
|
||||
```bash
|
||||
# Upload to your server
|
||||
scp deploy.sh user@crawl4ai.com:/var/www/html/install-cnode.sh
|
||||
scp install-cnode.sh user@crawl4ai.com:/var/www/html/install-cnode.sh
|
||||
|
||||
# Or use GitHub raw URL
|
||||
https://raw.githubusercontent.com/unclecode/crawl4ai/main/deploy/installer/deploy.sh
|
||||
https://raw.githubusercontent.com/unclecode/crawl4ai/main/deploy/installer/install-cnode.sh
|
||||
```
|
||||
|
||||
Users can then install with:
|
||||
|
||||
@@ -1,171 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Crawl4AI Node Manager (cnode) Remote Installation Script
|
||||
# Usage: curl -sSL https://crawl4ai.com/install-cnode.sh | bash
|
||||
# Or: wget -qO- https://crawl4ai.com/install-cnode.sh | bash
|
||||
|
||||
set -e
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Configuration
|
||||
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
|
||||
LIB_DIR="${LIB_DIR:-/usr/local/lib/cnode}"
|
||||
GITHUB_REPO="unclecode/crawl4ai"
|
||||
BRANCH="${CNODE_BRANCH:-main}"
|
||||
|
||||
echo -e "${GREEN}╔══════════════════════════════════════════════════════════════╗${NC}"
|
||||
echo -e "${GREEN}║ Crawl4AI Node Manager (cnode) Installation Script ║${NC}"
|
||||
echo -e "${GREEN}╚══════════════════════════════════════════════════════════════╝${NC}\n"
|
||||
|
||||
# Check Python
|
||||
echo -e "${BLUE}Checking Python installation...${NC}"
|
||||
if command -v python3 &> /dev/null; then
|
||||
PYTHON_CMD="python3"
|
||||
elif command -v python &> /dev/null; then
|
||||
PYTHON_CMD="python"
|
||||
else
|
||||
echo -e "${RED}Error: Python 3.8+ is required but not found${NC}"
|
||||
echo -e "${YELLOW}Install from: https://www.python.org/downloads/${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check Python version
|
||||
PYTHON_VERSION=$($PYTHON_CMD -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
|
||||
echo -e "${GREEN}✓ Found Python $PYTHON_VERSION${NC}"
|
||||
|
||||
if [ "$(printf '%s\n' "3.8" "$PYTHON_VERSION" | sort -V | head -n1)" != "3.8" ]; then
|
||||
echo -e "${RED}Error: Python 3.8+ required, found $PYTHON_VERSION${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check pip
|
||||
if ! $PYTHON_CMD -m pip --version &> /dev/null; then
|
||||
echo -e "${RED}Error: pip is required${NC}"
|
||||
echo -e "${YELLOW}Install pip: $PYTHON_CMD -m ensurepip${NC}"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${GREEN}✓ pip is available${NC}"
|
||||
|
||||
# Check Docker
|
||||
echo -e "\n${BLUE}Checking Docker...${NC}"
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo -e "${YELLOW}⚠️ Docker not found (required for running servers)${NC}"
|
||||
echo -e "${YELLOW}Install from: https://docs.docker.com/get-docker/${NC}\n"
|
||||
else
|
||||
echo -e "${GREEN}✓ Docker is installed${NC}"
|
||||
fi
|
||||
|
||||
# Check permissions
|
||||
USE_SUDO=""
|
||||
if [ ! -w "$INSTALL_DIR" ] || [ ! -w "/usr/local" ]; then
|
||||
echo -e "\n${YELLOW}⚠️ Root permission required for installation${NC}"
|
||||
USE_SUDO="sudo"
|
||||
fi
|
||||
|
||||
# Create temp directory
|
||||
TMP_DIR="$(mktemp -d)"
|
||||
cd "$TMP_DIR"
|
||||
|
||||
# Download only cnode_pkg from GitHub using sparse checkout
|
||||
echo -e "\n${BLUE}Downloading cnode package from GitHub...${NC}"
|
||||
|
||||
if ! command -v git &> /dev/null; then
|
||||
echo -e "${RED}Error: git is required but not found${NC}"
|
||||
echo -e "${YELLOW}Install git and try again${NC}"
|
||||
rm -rf "$TMP_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Initialize sparse checkout
|
||||
git init -q
|
||||
git remote add origin "https://github.com/$GITHUB_REPO.git"
|
||||
git config core.sparseCheckout true
|
||||
|
||||
# Only checkout the cnode_pkg directory
|
||||
echo "deploy/installer/cnode_pkg/*" > .git/info/sparse-checkout
|
||||
|
||||
# Pull only the needed files
|
||||
if ! git pull -q --depth=1 origin "$BRANCH"; then
|
||||
echo -e "${RED}Error: Failed to download package${NC}"
|
||||
rm -rf "$TMP_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "deploy/installer/cnode_pkg" ]; then
|
||||
echo -e "${RED}Error: Package directory not found${NC}"
|
||||
rm -rf "$TMP_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✓ Package downloaded${NC}"
|
||||
|
||||
REPO_DIR="."
|
||||
|
||||
# Install Python dependencies
|
||||
echo -e "\n${BLUE}Installing Python dependencies...${NC}"
|
||||
$PYTHON_CMD -m pip install --quiet --user -r "$REPO_DIR/deploy/installer/cnode_pkg/requirements.txt" 2>/dev/null || \
|
||||
$PYTHON_CMD -m pip install --quiet --user --break-system-packages -r "$REPO_DIR/deploy/installer/cnode_pkg/requirements.txt" 2>/dev/null || {
|
||||
echo -e "${YELLOW}⚠️ Could not install dependencies with pip${NC}"
|
||||
echo -e "${YELLOW}Trying to continue anyway (dependencies may already be installed)${NC}"
|
||||
}
|
||||
echo -e "${GREEN}✓ Dependencies check complete${NC}"
|
||||
|
||||
# Install cnode package
|
||||
echo -e "\n${BLUE}Installing cnode package...${NC}"
|
||||
$USE_SUDO mkdir -p "$LIB_DIR"
|
||||
$USE_SUDO cp -r "$REPO_DIR/deploy/installer/cnode_pkg" "$LIB_DIR/"
|
||||
echo -e "${GREEN}✓ Package installed to $LIB_DIR${NC}"
|
||||
|
||||
# Create wrapper script
|
||||
echo -e "\n${BLUE}Creating cnode command...${NC}"
|
||||
$USE_SUDO tee "$INSTALL_DIR/cnode" > /dev/null << 'EOF'
|
||||
#!/usr/bin/env bash
|
||||
# Crawl4AI Node Manager (cnode) wrapper
|
||||
|
||||
set -e
|
||||
|
||||
# Find Python
|
||||
if command -v python3 &> /dev/null; then
|
||||
PYTHON_CMD="python3"
|
||||
elif command -v python &> /dev/null; then
|
||||
PYTHON_CMD="python"
|
||||
else
|
||||
echo "Error: Python 3.8+ required" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Add cnode to Python path and run
|
||||
export PYTHONPATH="/usr/local/lib/cnode:$PYTHONPATH"
|
||||
exec $PYTHON_CMD -m cnode_pkg.cli "$@"
|
||||
EOF
|
||||
|
||||
$USE_SUDO chmod +x "$INSTALL_DIR/cnode"
|
||||
echo -e "${GREEN}✓ cnode command created${NC}"
|
||||
|
||||
# Cleanup
|
||||
rm -rf "$TMP_DIR"
|
||||
|
||||
echo -e "\n${GREEN}✓ Installation complete${NC}"
|
||||
|
||||
# Success message
|
||||
echo -e "\n${GREEN}╔══════════════════════════════════════════════════════════════╗${NC}"
|
||||
echo -e "${GREEN}║ Installation Complete! ║${NC}"
|
||||
echo -e "${GREEN}╚══════════════════════════════════════════════════════════════╝${NC}\n"
|
||||
|
||||
echo -e "${BLUE}cnode is now installed and ready!${NC}\n"
|
||||
|
||||
echo -e "${YELLOW}Quick Start:${NC}"
|
||||
echo -e " ${GREEN}cnode start${NC} # Start single server"
|
||||
echo -e " ${GREEN}cnode start --replicas 5${NC} # Start 5-replica cluster"
|
||||
echo -e " ${GREEN}cnode status${NC} # Check status"
|
||||
echo -e " ${GREEN}cnode logs -f${NC} # Follow logs"
|
||||
echo -e " ${GREEN}cnode stop${NC} # Stop server"
|
||||
|
||||
echo -e "\n${YELLOW}More help:${NC}"
|
||||
echo -e " ${BLUE}cnode --help${NC}"
|
||||
echo -e " ${BLUE}https://github.com/$GITHUB_REPO${NC}\n"
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
# Crawl4AI Node Manager (cnode) - Fast Installation Script
|
||||
# This installs cnode as a Python package with a wrapper script
|
||||
# Crawl4AI Node Manager (cnode) Remote Installation Script
|
||||
# Usage: curl -sSL https://crawl4ai.com/install-cnode.sh | bash
|
||||
# Or: wget -qO- https://crawl4ai.com/install-cnode.sh | bash
|
||||
|
||||
set -e
|
||||
|
||||
@@ -11,13 +12,15 @@ YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo -e "${GREEN}╔══════════════════════════════════════════════════════════════╗${NC}"
|
||||
echo -e "${GREEN}║ Crawl4AI Node Manager (cnode) - Fast Installer ║${NC}"
|
||||
echo -e "${GREEN}╚══════════════════════════════════════════════════════════════╝${NC}\n"
|
||||
|
||||
# Configuration
|
||||
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
|
||||
LIB_DIR="${LIB_DIR:-/usr/local/lib/cnode}"
|
||||
GITHUB_REPO="unclecode/crawl4ai"
|
||||
BRANCH="${CNODE_BRANCH:-main}"
|
||||
|
||||
echo -e "${GREEN}╔══════════════════════════════════════════════════════════════╗${NC}"
|
||||
echo -e "${GREEN}║ Crawl4AI Node Manager (cnode) Installation Script ║${NC}"
|
||||
echo -e "${GREEN}╚══════════════════════════════════════════════════════════════╝${NC}\n"
|
||||
|
||||
# Check Python
|
||||
echo -e "${BLUE}Checking Python installation...${NC}"
|
||||
@@ -46,7 +49,6 @@ if ! $PYTHON_CMD -m pip --version &> /dev/null; then
|
||||
echo -e "${YELLOW}Install pip: $PYTHON_CMD -m ensurepip${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✓ pip is available${NC}"
|
||||
|
||||
# Check Docker
|
||||
@@ -65,22 +67,58 @@ if [ ! -w "$INSTALL_DIR" ] || [ ! -w "/usr/local" ]; then
|
||||
USE_SUDO="sudo"
|
||||
fi
|
||||
|
||||
# Get script directory
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# Create temp directory
|
||||
TMP_DIR="$(mktemp -d)"
|
||||
cd "$TMP_DIR"
|
||||
|
||||
# Download only cnode_pkg from GitHub using sparse checkout
|
||||
echo -e "\n${BLUE}Downloading cnode package from GitHub...${NC}"
|
||||
|
||||
if ! command -v git &> /dev/null; then
|
||||
echo -e "${RED}Error: git is required but not found${NC}"
|
||||
echo -e "${YELLOW}Install git and try again${NC}"
|
||||
rm -rf "$TMP_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Initialize sparse checkout
|
||||
git init -q
|
||||
git remote add origin "https://github.com/$GITHUB_REPO.git"
|
||||
git config core.sparseCheckout true
|
||||
|
||||
# Only checkout the cnode_pkg directory
|
||||
echo "deploy/installer/cnode_pkg/*" > .git/info/sparse-checkout
|
||||
|
||||
# Pull only the needed files
|
||||
if ! git pull -q --depth=1 origin "$BRANCH"; then
|
||||
echo -e "${RED}Error: Failed to download package${NC}"
|
||||
rm -rf "$TMP_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "deploy/installer/cnode_pkg" ]; then
|
||||
echo -e "${RED}Error: Package directory not found${NC}"
|
||||
rm -rf "$TMP_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✓ Package downloaded${NC}"
|
||||
|
||||
REPO_DIR="."
|
||||
|
||||
# Install Python dependencies
|
||||
echo -e "\n${BLUE}Installing Python dependencies...${NC}"
|
||||
$PYTHON_CMD -m pip install --quiet --user -r "$SCRIPT_DIR/cnode_pkg/requirements.txt" 2>/dev/null || \
|
||||
$PYTHON_CMD -m pip install --quiet --user --break-system-packages -r "$SCRIPT_DIR/cnode_pkg/requirements.txt" 2>/dev/null || {
|
||||
$PYTHON_CMD -m pip install --quiet --user -r "$REPO_DIR/deploy/installer/cnode_pkg/requirements.txt" 2>/dev/null || \
|
||||
$PYTHON_CMD -m pip install --quiet --user --break-system-packages -r "$REPO_DIR/deploy/installer/cnode_pkg/requirements.txt" 2>/dev/null || {
|
||||
echo -e "${YELLOW}⚠️ Could not install dependencies with pip${NC}"
|
||||
echo -e "${YELLOW}Trying to continue anyway (dependencies may already be installed)${NC}"
|
||||
}
|
||||
echo -e "${GREEN}✓ Dependencies check complete${NC}"
|
||||
|
||||
# Create lib directory
|
||||
# Install cnode package
|
||||
echo -e "\n${BLUE}Installing cnode package...${NC}"
|
||||
$USE_SUDO mkdir -p "$LIB_DIR"
|
||||
$USE_SUDO cp -r "$SCRIPT_DIR/cnode_pkg" "$LIB_DIR/"
|
||||
$USE_SUDO cp -r "$REPO_DIR/deploy/installer/cnode_pkg" "$LIB_DIR/"
|
||||
echo -e "${GREEN}✓ Package installed to $LIB_DIR${NC}"
|
||||
|
||||
# Create wrapper script
|
||||
@@ -109,20 +147,10 @@ EOF
|
||||
$USE_SUDO chmod +x "$INSTALL_DIR/cnode"
|
||||
echo -e "${GREEN}✓ cnode command created${NC}"
|
||||
|
||||
# Verify installation
|
||||
echo -e "\n${BLUE}Verifying installation...${NC}"
|
||||
if ! command -v cnode &> /dev/null; then
|
||||
echo -e "${RED}Error: cnode not found in PATH${NC}"
|
||||
echo -e "${YELLOW}Add $INSTALL_DIR to your PATH${NC}"
|
||||
exit 1
|
||||
fi
|
||||
# Cleanup
|
||||
rm -rf "$TMP_DIR"
|
||||
|
||||
if ! cnode --help &> /dev/null; then
|
||||
echo -e "${RED}Error: cnode command failed${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✓ Installation verified${NC}"
|
||||
echo -e "\n${GREEN}✓ Installation complete${NC}"
|
||||
|
||||
# Success message
|
||||
echo -e "\n${GREEN}╔══════════════════════════════════════════════════════════════╗${NC}"
|
||||
@@ -139,4 +167,5 @@ echo -e " ${GREEN}cnode logs -f${NC} # Follow logs"
|
||||
echo -e " ${GREEN}cnode stop${NC} # Stop server"
|
||||
|
||||
echo -e "\n${YELLOW}More help:${NC}"
|
||||
echo -e " ${BLUE}cnode --help${NC}\n"
|
||||
echo -e " ${BLUE}cnode --help${NC}"
|
||||
echo -e " ${BLUE}https://github.com/$GITHUB_REPO${NC}\n"
|
||||
|
||||
Reference in New Issue
Block a user