This project contains n8n workflow automation setup for the neptune22h project with MongoDB support via Docker Compose.
- Docker
- Docker Compose
- Node.js (version 16 or later)
- npm (comes with Node.js)
-
Start the services:
npm run docker:up
This starts both n8n and MongoDB in Docker containers.
-
Access n8n:
- Open http://localhost:5678 in your browser
- Username:
admin - Password:
password
-
Access MongoDB (optional):
- Host:
localhost - Port:
27017 - Username:
admin - Password:
password123
- Host:
-
Build and start services:
npm run docker:build npm run docker:up
-
View logs:
npm run docker:logs
-
Stop services:
npm run docker:down
-
Install dependencies:
npm install
-
Start n8n locally:
npm start
- Start services:
npm run docker:up - Stop services:
npm run docker:down - View logs:
npm run docker:logs - Restart services:
npm run docker:restart - Build images:
npm run docker:build
Once started, n8n will be available at:
- URL: http://localhost:5678
- Username: admin
- Password: password
Security Note: Change the default credentials in the docker-compose.yml file before deploying to production.
The Docker setup includes:
- Database: MongoDB 7.0 with persistent storage
- Authentication: Basic auth enabled
- Execution: Regular mode with 1-hour timeout
- Logging: Console logging
- Networking: Isolated Docker network
The local setup includes:
- Database: SQLite (stored in
./n8n.db) - Authentication: Basic auth enabled
- Execution: Regular mode with 1-hour timeout
- Logging: Console and file logging (stored in
./logs/)
neptune22h/
├── .dockerignore # Docker ignore rules
├── .gitignore # Git ignore rules
├── .n8nrc # n8n configuration file
├── docker-compose.yml # Docker Compose configuration
├── Dockerfile # n8n Docker image
├── logs/ # Log files directory
├── mongo-init/ # MongoDB initialization scripts
│ └── init-n8n-db.js # Database setup script
├── node_modules/ # Dependencies (local only)
├── package.json # Node.js project configuration
└── README.md # This file
-
Start n8n:
- Docker:
npm run docker:up - Local:
npm start
- Docker:
-
Open the interface: http://localhost:5678
-
Login with the credentials above
-
Create workflow:
- Click "Add workflow"
- Add a trigger node (e.g., "Manual Trigger")
- Add action nodes for your automation tasks
- Connect nodes to define the workflow flow
- Test using "Execute Workflow" button
The Docker setup includes a fully configured MongoDB instance:
- Database:
n8n - User:
n8n(with read/write permissions) - Admin User:
admin(root access) - Persistent Storage: Data survives container restarts
- Initialization: Automatic database and user creation
Port conflicts:
# Check what's using port 5678
lsof -i :5678
# Stop conflicting services or change ports in docker-compose.ymlContainer won't start:
# Check logs
npm run docker:logs
# Rebuild containers
npm run docker:build
npm run docker:upMongoDB connection issues:
# Check MongoDB logs
docker-compose logs mongodb
# Restart MongoDB
docker-compose restart mongodbPort already in use:
N8N_PORT=5679 npm startDatabase issues:
# Reset SQLite database
rm n8n.db
npm start- Change default credentials before production use
- Use environment variables for sensitive configuration
- Enable HTTPS in production environments
- Consider using MongoDB authentication in production
- Regularly update Docker images for security patches
For production deployment:
- Update credentials in docker-compose.yml
- Set up proper networking and reverse proxy
- Enable HTTPS with SSL certificates
- Configure MongoDB authentication properly
- Set up monitoring and logging
- Use Docker secrets for sensitive data