Self-host n8n in Databricks Apps. This repo provides Node.js installation of n8n, and container-ready configurations tailored for Databricks Apps. Works in both Databricks Free Edition and paid versions.
This project enables you to run n8n (a powerful workflow automation tool) in Databricks Apps by providing ready-to-deploy setup Node.js project with configuration YAML.
- n8n Installation: Installs n8n via Node.js
- Webhook Integration: Uses Ngrok webhook URL (requires setup) to enable webhook in n8n
- Postgres Integration: Uses Postgres database (e.g., Supabase or Databricks Lakebase) to persist n8n workflow executions, history, and credentials, ensuring reliable storage and recovery of application data.
n8n-databricks-apps/
├── package.json # Node.js dependencies and scripts
├── app.yaml # Databricks deployment configuration
├── README.md # Project documentation
└── .gitignore # Git ignore rules
- Databricks Account: Free or paid Databricks account with access to Databricks Apps
- Ngrok Account: Free or paid Ngrok account with a reserved static URL and authentication token
- Postgres Database: Free or paid Supabase account or other Postgres databases such as Databricks Lakebase
- Secrets Configuration: The following secrets must be configured in Databricks:
n8n-encryption-key: (optional) user-defined encryption key for securing n8n credentialssupabase-host: Supabase database host URL (use Session pooler credentials)supabase-user: Supabase database usernamesupabase-pw: Supabase database passwordwebhook-url: Webhook endpoint URLngrok-token: Ngrok authentication token
-
Clone this repository into your Databricks workspace (doc)
-
Create a custom Databricks Apps (if not exist) (doc)
-
Configure app
- Sign up for Ngrok or other tunnel service and get tunnel URL and authentication token
- Sign up for Supabase and set up database and get host, user, and password
- Add above credentials as Databricks secrets and make them app resources
- Update
app.yamlto reference your secrets
-
Deploy n8n installation code to Databricks Apps (doc)
The application will:
- Install n8n and ngrok dependencies
- Configure ngrok with your authentication token
- Connect to Supabase database for data persistence
- Launch n8n on port 8000 with encryption enabled
- Set up ngrok tunnel for webhook access
- Make n8n available at
http://0.0.0.0:8000 - Enable automatic data pruning (7 days retention, max 20,000 executions)
The application uses the following environment variables (configured in app.yaml):
N8N_PORT: Port for n8n to run on (default: 8000)N8N_HOST: Host binding (default: 0.0.0.0)N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE: Enable community package tools (default: true)N8N_ENCRYPTION_KEY: Encryption key for securing credentials and data
DB_TYPE: Database type (postgresdb)DB_POSTGRESDB_DATABASE: Database name (n8ndb)DB_POSTGRESDB_SCHEMA: Database schema (n8n)DB_POSTGRESDB_PORT: Database port (5432)DB_POSTGRESDB_HOST: Database host (from secrets)DB_POSTGRESDB_USER: Database username (from secrets)DB_POSTGRESDB_PASSWORD: Database password (from secrets)DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED: SSL verification (false for development)
EXECUTIONS_DATA_PRUNE: Enable automatic data pruning (true)EXECUTIONS_DATA_MAX_AGE: Hours to keep execution data (168 = 7 days)EXECUTIONS_DATA_PRUNE_MAX_COUNT: Maximum executions to store (20000)
WEBHOOK_URL: Webhook endpoint URL (from secrets)NGROK_TOKEN: Ngrok authentication token (from secrets)
The package.json includes several useful scripts:
npm start: Full application startup with ngrok tunnelnpm run n8n: Run n8n onlynpm run ngrok: Start ngrok tunnel onlynpm run set-token: Configure ngrok authentication token
To modify n8n or ngrok versions, update the dependencies section in package.json:
{
"dependencies": {
"ngrok": "5.0.0",
"n8n": "1.28.0"
}
}Monitor application logs for app events and error messages.
-
Database Connection Fails
- Verify Supabase credentials in Databricks secrets
- Check database host accessibility
- Ensure SSL configuration matches your setup
-
Encryption Key Issues
- Verify
n8n-encryption-keysecret is properly set - Ensure encryption key is consistent across deployments
- Verify
-
Webhook Configuration
- Check
webhook-urlandngrok-tokensecrets - Verify ngrok tunnel is properly established
- Check
-
Port Already in Use
- Change
N8N_PORTinapp.yaml - Kill existing processes on the port
- Change
-
Data Pruning Issues
- Adjust
EXECUTIONS_DATA_MAX_AGEfor longer retention - Modify
EXECUTIONS_DATA_PRUNE_MAX_COUNTfor more executions
- Adjust
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
For issues and questions:
- Create an issue in the repository
- Check n8n documentation
- Check Databricks documentation for Databricks-specific issues
Note: This project is designed for Databricks environments and will require adjustments for other platforms.