N8n
Overview
n8n is a powerful workflow automation platform that allows you to connect various services and applications to create automated workflows. This document covers the deployment and configuration of n8n using Docker Compose with Traefik as a reverse proxy.
Service Details
Component | Value |
---|---|
URL | https://automations.trymondo.com |
Image | n8nio/n8n:1.88.0 |
Container | n8n |
Database | PostgreSQL 17.4 |
Networks | traefik-net, n8n-net |
Data Storage | ./data directory |
Architecture
n8n is deployed as a multi-container application with the following components:
- n8n: Main application container serving the workflow editor and execution engine
- PostgreSQL: Database for storing workflows, credentials, and execution data
Prerequisites
- Docker Engine (24.0+)
- Docker Compose v2
- Traefik reverse proxy configured and running
- External networks:
traefik-net
andn8n-net
- DNS configured for
automations.trymondo.com
- SMTP credentials for email notifications
Deployment Configuration
Environment Variables
Create a .env
file with the following variables:
Generate a secure, random string for N8N_ENCRYPTION_KEY. This is used to encrypt credentials and sensitive data.
You can generate a secure random string with: bash openssl rand -hex 16
Docker Compose File
Network Configuration
Before deployment, ensure the required networks exist:
Deployment Instructions
-
Create the deployment directory structure:
-
Create the configuration files:
-
Deploy the service:
-
Verify the services are running:
-
Access n8n at
https://automations.trymondo.com
and log in with the credentials specified in the.env
file.
Traefik Integration
n8n is configured with the following Traefik settings:
- Host Rule:
automations.trymondo.com
- Entrypoint: websecure (HTTPS)
- TLS: Enabled with production certificate resolver
- Backend Port: 5678
- Middlewares: Rate limiting and secure headers
Configuration Highlights
Security Configuration
n8n is configured with several security features:
- Basic Authentication: Requires username/password to access the UI
- Encryption Key: All sensitive data is encrypted at rest
- HTTPS: All traffic is encrypted via Traefik
- Rate Limiting: Prevents brute force attacks
Workflow Execution Settings
The n8n instance is configured with the following execution settings:
- Regular Execution Mode: Workflows run in the main process
- Data Retention: Error execution data is saved, successful executions are not
- Data Pruning: Old execution data is automatically removed after 336 hours (14 days)
- Runners Enabled: Allows distributed workflow execution
Email Notifications
Email is configured using SMTP with the following settings:
- SMTP Host: smtp.mailersend.net
- SMTP Port: 587
- Sender: info@trymondo.com
Maintenance
Backup Strategy
Back up n8n regularly using the following commands:
Updates
To update n8n:
-
Update the image tag in
docker-compose.yml
-
Apply the update:
-
Check logs for any issues:
Always back up your data before updating n8n to a new version.
Troubleshooting
Database Connection Issues
If n8n can’t connect to the database:
-
Verify PostgreSQL container is running:
-
Check database logs:
-
Verify credentials in
.env
file match what n8n is using
Webhook Issues
If webhooks are not working correctly:
-
Verify the webhook URL configuration:
-
Check that the URL is accessible from the internet
-
Verify Traefik is properly routing requests
Authentication Problems
If you’re having trouble logging in:
-
Check the basic auth settings:
-
Reset the admin password by updating the
.env
file and restarting the container
Example Workflows
Webflow Form to Mautic Integration
This workflow captures form submissions from Webflow and adds contacts to Mautic:
- Create a webhook node as the trigger
- Copy the webhook URL to your Webflow form’s action URL
- Add a Mautic node to create/update contacts
- Configure the mapping between Webflow form fields and Mautic contact fields
Daily Database Backup Notification
This workflow creates and notifies about database backups:
- Set up a Cron node to trigger daily at a specific time
- Add an Execute Command node to run pg_dump
- Add a Send Email node to notify about successful backups
- Add error handling to notify about failures
Security Considerations
- Credential Storage: All API credentials are encrypted using the N8N_ENCRYPTION_KEY
- Basic Authentication: The UI is protected with username/password
- HTTPS: All traffic is encrypted via Traefik
- Database Security: The PostgreSQL database is not exposed outside the Docker network
- Execution Data: Only error execution data is saved to reduce sensitive data exposure
Additional Resources
- Official n8n Documentation
- n8n Docker Image Documentation
- n8n Community Forums
- PostgreSQL Documentation
- Traefik Documentation
Integration with Other Mondo Services
n8n can be integrated with other Mondo services:
- Mautic: Use the Mautic nodes to manage contacts and campaigns
- EspoCRM: Use HTTP Request nodes or custom nodes to interact with the CRM API
- Gitea: Use Webhook triggers for repository events
- Traefik: Ensure proper routing and HTTPS termination
Was this page helpful?