n8n on Phala Cloud
Deploy n8n workflow automation platform on Phala Cloud's secure, TEE-protected infrastructure.
What is n8n?
n8n is a powerful workflow automation tool that allows you to connect different services and automate tasks. With n8n, you can:
- Create complex workflows with a visual interface
- Connect to 400+ services and APIs
- Process data, send notifications, and automate business processes
- Self-host with full control over your data
Why Deploy on Phala Cloud?
- Confidential Computing: Your workflows run in secure TEE environments
- Data Privacy: Sensitive API keys and data are protected by hardware-level encryption
- Always On: Reliable cloud infrastructure with automatic scaling
- Easy Deployment: One-click deployment with Phala CLI
Quick Start
Prerequisites
- Phala CLI installed
- Phala Cloud account with API key
- Docker installed (for local development)
Deploy to Phala Cloud
-
Clone this template
git clone https://github.com/your-repo/phala-n8n-template.git cd phala-n8n-template
-
Configure environment variables
cp .env.example .env # Edit .env with your credentials
-
Deploy with Phala CLI
# Login to Phala Cloud phala auth login # Deploy n8n phala cvms create --name my-n8n --compose docker-compose.yml --env-file .env
-
Access your n8n instance
- Your n8n URL will be provided after deployment
- Login with the credentials from your
.env
file - Start building workflows!
Configuration
Environment Variables
Variable | Description | Required |
---|---|---|
N8N_USER |
Admin username | Yes |
N8N_PASSWORD |
Admin password | Yes |
N8N_ENCRYPTION_KEY |
Encryption key for credentials | Yes |
OPENAI_API_KEY |
OpenAI API key for AI workflows | No |
GOOGLE_OAUTH_CLIENT_ID |
Google OAuth client ID | No |
GOOGLE_OAUTH_CLIENT_SECRET |
Google OAuth client secret | No |
OAuth Setup (Google/Gmail)
For Gmail integration:
- Go to Google Cloud Console
- Create OAuth 2.0 credentials
- Add your n8n URL as authorized redirect URI:
https://your-instance-domain.dstack-prod10.phala.network/rest/oauth2-credential/callback
- Add the client ID and secret to your
.env
file
Management Commands
# List deployments
phala cvms list
# Get deployment details
phala cvms get your-app-id
# Update deployment
phala cvms upgrade your-app-id --compose docker-compose.yml --env-file .env
# Stop deployment
phala cvms stop your-app-id
# Start deployment
phala cvms start your-app-id
# Delete deployment
phala cvms delete your-app-id
Common Use Cases
Email Automation
- Gmail lead detection and CRM integration
- Automated email responses
- Email parsing and data extraction
Communication
- Slack/Discord notifications
- Telegram bots
- SMS alerts via Twilio
Data Processing
- API data synchronization
- File processing and conversion
- Database operations
AI Workflows
- OpenAI integration for content generation
- Document analysis and summarization
- Automated decision making
Security Features
TEE Protection
Your n8n instance runs in Phala Cloud's Trusted Execution Environment (TEE), providing:
- Hardware-level encryption of sensitive data
- Isolated execution environment
- Tamper-proof workflow execution
Credential Security
- API keys encrypted with TEE protection
- Secure credential storage in n8n vault
- No plain-text secrets in logs or memory dumps
Troubleshooting
OAuth Issues
If OAuth callbacks fail:
- Verify the redirect URI in your OAuth provider
- Ensure it matches your Phala Cloud domain exactly
- Check that
DSTACK_GATEWAY_DOMAIN
is properly set
Workflow Execution Issues
- Check the execution logs in n8n UI
- Verify API credentials are correctly configured
- Ensure required environment variables are set
Performance Optimization
- Use webhooks instead of polling when possible
- Implement proper error handling in workflows
- Monitor execution times and optimize bottlenecks
Support
Contributing
We welcome contributions to improve this template:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
License
This template is released under the MIT License.