Enhanced n8n with persistent Python packages, PostgreSQL database, and intelligent update system for professional workflow automation.
git clone https://github.com/StardawnAI/n8n-advanced.git
cd n8n-advanced/.devcontainer
docker-compose up -dAccess at: http://localhost:5678
This setup provides a production-ready n8n environment with:
- Persistent Data Storage: All workflows, credentials, and Python packages survive updates
- Intelligent Update System: Separate update paths for n8n, PostgreSQL, and Python packages
- Cross-Platform Compatibility: Works on Windows, macOS, and Linux
- Professional Monitoring: Python package installation status tracking
- PostgreSQL Database: Persistent data storage with automatic backups
- Python Environment: Pre-configured with scientific computing libraries
- Update Scripts: Granular control over component updates
- Default Workflows: Pre-imported automation templates
- Monitoring System: Real-time status tracking for all components
All data persists across container updates:
volumes:
n8n_data: # Workflows, credentials, executions
postgres_data: # Database content
python_packages: # Installed Python librariesWhat survives updates:
- All workflows and credentials
- Database content and user accounts
- Python packages (both pre-installed and manually added)
- Custom configurations and settings
# Update only n8n (30 seconds)
bash updates/update-n8n.sh
# Update only Python packages (1-2 minutes)
bash updates/update-packages.sh
# Update only PostgreSQL (30 seconds)
bash updates/update-postgres.sh
# Update everything (2-3 minutes)
bash updates/update-all.shSet up automatic updates with cron:
# Daily n8n updates
0 3 * * * /path/to/project/updates/update-n8n.sh >> /var/log/n8n-update.log 2>&1
# Weekly full updates
0 4 * * 0 /path/to/project/updates/update-all.sh >> /var/log/all-updates.log 2>&1Python packages install during container startup (not build time) for improved reliability:
- Container starts with n8n running immediately
- Workflows import within 30 seconds
- Python packages install in background (5 minutes initial setup)
- Status monitoring tracks installation progress
# Check installation status
docker-compose exec n8n-advanced cat /home/node/.n8n/python-status
# Possible values: installing, ready, failed, updatingMethod 1 - Runtime Installation (Temporary):
docker-compose exec n8n-advanced pip install new-package --break-system-packagesMethod 2 - Persistent Installation:
- Add package to
requirements.txt - Run:
bash updates/update-packages.sh - Package persists across all future updates
Container won't start? Fix line endings:
cd "path/to/n8n-advanced/.devcontainer"
(Get-Content setup-defaults.sh -Raw) -replace "`r`n","`n" | Set-Content setup-defaults.sh -NoNewline -Encoding ASCIIPrevention: In VS Code, change "CRLF" to "LF" in bottom-right status bar when editing .sh files.
Build vs Runtime: System packages install during build (30 seconds), Python packages install at container startup (5 minutes) for better reliability.
Fault Isolation: n8n starts immediately even if Python installation fails. Components degrade gracefully.
Cross-Platform: All scripts use /bin/bash for Windows/Linux compatibility.
# Manual import if needed
docker-compose exec n8n-advanced n8n import:workflow --input="/usr/src/app/default-workflows/" --separate- Most common cause: CRLF line endings in
.shfiles - Fix: Use the PowerShell command above
# Check status
docker-compose exec n8n-advanced cat /home/node/.n8n/python-status
# Restart if failed
docker-compose restart n8n-advancedFor production deployment with custom domain and SSL:
- Google Cloud: GCP n8n Guide
- Oracle Cloud: Oracle n8n Guide
Replace the Docker commands in those guides with this repo URL.
Updates happen automatically via GitHub Actions. Your custom files are protected by .gitattributes merge strategies.