Upgrade
Version Management
1.Pre-Upgrade Checklist: bash
cat > ~/pre-upgrade-checklist.sh << 'EOF'
#!/bin/bash
CHECKLIST_FILE="/tmp/flowise-upgrade-checklist.txt"
echo "Flowise Upgrade Pre-flight Checklist - $(date)" > "$CHECKLIST_FILE"
echo "================================================" >> "$CHECKLIST_FILE"
# Check current version
echo "Current Version Check:" >> "$CHECKLIST_FILE"
npm list -g flowise --depth=0 >> "$CHECKLIST_FILE" 2>&1
# Check disk space
echo -e "\nDisk Space Check:" >> "$CHECKLIST_FILE"
df -h /var/lib/flowise >> "$CHECKLIST_FILE"
df -h /backup >> "$CHECKLIST_FILE" 2>/dev/null || echo "Backup directory not found" >> "$CHECKLIST_FILE"
# Check service status
echo -e "\nService Status:" >> "$CHECKLIST_FILE"
systemctl is-active flowise >> "$CHECKLIST_FILE"
systemctl is-enabled flowise >> "$CHECKLIST_FILE"
# Check database
echo -e "\nDatabase Check:" >> "$CHECKLIST_FILE"
if [ -f "/var/lib/flowise/database.sqlite" ]; then
sqlite3 /var/lib/flowise/database.sqlite "PRAGMA integrity_check;" >> "$CHECKLIST_FILE"
echo "Database size: $(du -h /var/lib/flowise/database.sqlite | cut -f1)" >> "$CHECKLIST_FILE"
else
echo "Database file not found" >> "$CHECKLIST_FILE"
fi
# Check for running flows
echo -e "\nActive Connections:" >> "$CHECKLIST_FILE"
netstat -an | grep :3000 | wc -l >> "$CHECKLIST_FILE"
# Backup status
echo -e "\nRecent Backups:" >> "$CHECKLIST_FILE"
ls -la /backup/flowise/*.tar.gz 2>/dev/null | tail -5 >> "$CHECKLIST_FILE" || echo "No backups found" >> "$CHECKLIST_FILE"
echo "Pre-upgrade checklist completed: $CHECKLIST_FILE"
cat "$CHECKLIST_FILE"
EOF
chmod +x ~/pre-upgrade-checklist.sh
Upgrade Procedures
2.Ubuntu Upgrade Process: bash
cat > ~/upgrade-flowise-ubuntu.sh << 'EOF'
#!/bin/bash
UPGRADE_LOG="/var/log/flowise/upgrade-$(date +%Y%m%d-%H%M%S).log"
BACKUP_DIR="/backup/flowise/upgrade-backup-$(date +%Y%m%d-%H%M%S)"
log_message() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a "$UPGRADE_LOG"
}
# Pre-upgrade backup
create_upgrade_backup() {
log_message "Creating upgrade backup..."
mkdir -p "$BACKUP_DIR"
# Backup database
if [ -f "/var/lib/flowise/database.sqlite" ]; then
cp /var/lib/flowise/database.sqlite "$BACKUP_DIR/"
fi
# Backup configuration
if [ -d "/etc/flowise" ]; then
cp -r /etc/flowise "$BACKUP_DIR/"
fi
# Backup current installation info
npm list -g flowise --depth=0 > "$BACKUP_DIR/current-version.txt" 2>&1
log_message "Backup completed: $BACKUP_DIR"
}
# Stop services
stop_services() {
log_message "Stopping Flowise service..."
sudo systemctl stop flowise
# Wait for process to fully stop
sleep 5
if pgrep -f "flowise" > /dev/null; then
log_message "Force killing remaining processes..."
sudo pkill -f "flowise"
sleep 2
fi
log_message "Services stopped"
}
# Upgrade Flowise
upgrade_flowise() {
log_message "Starting Flowise upgrade..."
# Update npm first
npm update -g npm
# Upgrade Flowise
npm update -g flowise
if [ $? -eq 0 ]; then
log_message "Flowise upgrade completed successfully"
npm list -g flowise --depth=0 >> "$UPGRADE_LOG" 2>&1
else
log_message "ERROR: Flowise upgrade failed"
return 1
fi
}
# Update Node.js if needed
update_nodejs() {
current_node=$(node --version | cut -d'v' -f2)
required_node="18.0.0"
if [ "$(printf '%s\n' "$required_node" "$current_node" | sort -V | head -n1)" = "$required_node" ]; then
log_message "Node.js version is current: v$current_node"
else
log_message "Updating Node.js..."
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
log_message "Node.js updated to: $(node --version)"
fi
}
# Post-upgrade verification
verify_upgrade() {
log_message "Verifying upgrade..."
# Start service
sudo systemctl start flowise
sleep 10
# Check service status
if systemctl is-active --quiet flowise; then
log_message "✓ Service started successfully"
else
log_message "✗ Service failed to start"
return 1
fi
# Check API response
http_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/api/v1/health)
if [ "$http_code" = "200" ]; then
log_message "✓ API health check passed"
else
log_message "