mirror of
https://github.com/kossakovsky/n8n-install.git
synced 2026-03-07 22:33:11 +00:00
6.3 KiB
6.3 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is the n8n-installer: a Docker Compose-based installer that creates a comprehensive self-hosted AI automation environment. It includes n8n, Flowise, Open WebUI, Supabase, Qdrant, Langfuse, Ollama, and 20+ other services that can be selectively deployed.
Essential Commands
Installation and Updates
# Main installation (from project root)
sudo bash ./scripts/install.sh
# Update all services to latest versions
sudo bash ./scripts/update.sh
# Clean up unused Docker resources
sudo bash ./scripts/docker_cleanup.sh
Docker Operations
# View running services
docker compose ps
# View logs for specific service
docker compose logs [service-name]
# Restart services with specific profiles
docker compose --profile n8n,flowise up -d
# Stop all services
docker compose down
Python Helper Script
# Start services with automatic profile detection
python3 start_services.py
Service Management
# Apply configuration updates to running services
sudo bash ./scripts/apply_update.sh
# View all available Docker Compose profiles
grep -E '^\s*profiles:' docker-compose.yml
# Check service health status
docker compose ps --format "table {{.Name}}\t{{.Status}}\t{{.Ports}}"
Architecture
Core Installation Flow
The installation follows a strict 6-step sequence managed by scripts/install.sh:
- 01_system_preparation.sh - Updates system, installs dependencies, configures security
- 02_install_docker.sh - Installs Docker Engine and Docker Compose
- 03_generate_secrets.sh - Creates .env file with secure passwords and keys
- 04_wizard.sh - Interactive service selection with whiptail UI
- 05_run_services.sh - Deploys selected services using Docker Compose profiles
- 06_final_report.sh - Displays access URLs and credentials
Docker Compose Architecture
- Profiles: Services are organized into profiles (n8n, flowise, monitoring, langfuse, ollama, etc.)
- Environment: All configuration through
.envfile generated in step 3 - Volumes: Named volumes for data persistence across container rebuilds
- Networks: All services on default Docker network with internal service discovery
Key Service Dependencies
- n8n: Requires postgres, redis. Runs in queue mode with configurable worker count
- Supabase: Full stack with postgres, auth, storage, analytics, edge functions
- Langfuse: Requires postgres, redis, clickhouse, minio for LLM observability
- Open WebUI: Can integrate with Ollama for local LLMs
Important Implementation Details
Environment Variable System
- Generated by
03_generate_secrets.shusingopenssl rand -hex - Contains service hostnames, passwords, API keys
- Used by both Docker Compose and Caddy for routing
Service Selection Wizard
04_wizard.shuses whiptail to create interactive checklist- Updates
COMPOSE_PROFILESin.envbased on user selections - Some services have dependencies (e.g., langfuse requires clickhouse)
Shared File Access
./shared/directory is mounted to/data/sharedinside n8n containers- Use this path in n8n workflows to read/write files on the host system
Custom n8n Configuration
- Pre-installs Node.js libraries: cheerio, axios, moment, lodash
- Runs in production mode with PostgreSQL backend
- Enables queue mode for parallel workflow processing with configurable worker count
- Community packages and AI runners enabled
- Configured for tool usage and external function calls
- Metrics enabled for monitoring integration
Network Architecture
- Caddy handles HTTPS/TLS termination and reverse proxy
- Services exposed via subdomains: n8n.domain.com, flowise.domain.com, grafana.domain.com, etc.
- Internal services (redis, postgres) not exposed externally
- Supports Cloudflare Tunnel as alternative to port exposure
Common Development Tasks
Testing Profile Changes
- Update
COMPOSE_PROFILESin.env - Run
docker compose --profile [profiles] up -d - Check
docker compose psto verify services started
Adding New Services
- Define service in
docker-compose.ymlwith appropriate profile - Add hostname variables to Caddy environment section
- Update
04_wizard.shto include in service selection - Add Caddyfile routing if service needs web access
- Consider service dependencies and health checks
Backup/Restore Workflows
- n8n workflows stored in
./n8n/backup/workflows/ - Credentials stored in
./n8n/backup/credentials/ - Import script:
./n8n/n8n_import_script.sh
Troubleshooting Service Issues
- Check service logs:
docker compose logs [service-name] - Verify environment variables in
.env - Check DNS configuration for domain-based services
- Monitor resource usage:
docker stats
Security Considerations
- All services require authentication (configured during setup)
- Firewall configured to only allow SSH, HTTP, HTTPS
- Fail2Ban enabled for brute-force protection
- SSL certificates managed by Caddy with Let's Encrypt
- Sensitive data in
.envfile (never commit to git)
File Structure Notes
memory-bank/- Project documentation and development notesflowise/- Flowise workflow templates and custom toolsn8n-tool-workflows/- n8n workflow tools for integrationgrafana/- Monitoring dashboards and provisioning configsscripts/- Installation and utility scripts (all bash)prometheus/- Prometheus monitoring configurationsearxng/- SearXNG search engine settingscaddy-addon/- Additional Caddy configuration filespython-runner/- Optional Python execution environment
Critical Implementation Notes
- Never modify the installation script sequence (01-06) without understanding dependencies
- Always use logging functions from
utils.shin new scripts - The
.envfile contains all secrets and must never be committed - Services use Docker health checks - respect dependency conditions
- Profile-based deployment allows selective service activation
- All bash scripts should be executable and follow the established patterns
- When modifying
docker-compose.yml, maintain the x-templates pattern for service definitions - Community workflows are imported during installation - see
n8n/backup/workflows/for examples